From bc1391738bd8aa8f1cfe49aca8d9dae469db9344 Mon Sep 17 00:00:00 2001 From: Orual Date: Tue, 20 Jan 2026 13:00:49 -0500 Subject: [PATCH] api updates plus initial lazy disk-spilling collection stuff for embedded pds --- Cargo.lock | 316 +- crates/jacquard-api/Cargo.toml | 14 +- .../lexicons/app_bsky_actor_defs.json | 12 + .../lexicons/app_bsky_ageassurance_defs.json | 5 + .../app_bsky_unspecced_getSuggestedUsers.json | 4 + ...y_unspecced_getSuggestedUsersSkeleton.json | 4 + .../lexicons/app_juttu_articleLink.json | 41 + .../lexicons/app_offprint_content.json | 38 + .../app_offprint_document_article.json | 23 + .../lexicons/app_offprint_publication.json | 23 + .../lexicons/blog_pckt_content.json | 23 + .../lexicons/blue_atplay_score_defs.json | 31 + .../lexicons/blue_skytalk_talk_thread.json | 42 + .../lexicons/cat_vt3e_gallery_group.json | 31 + .../lexicons/cat_vt3e_gallery_groupItem.json | 38 + .../lexicons/cat_vt3e_gallery_image.json | 65 + .../lexicons/city_yoyle_status.json | 28 + .../community_lexicon_calendar_getEvent.json | 71 + ...mmunity_lexicon_calendar_searchEvents.json | 99 + .../dev_baileytownsend_demo_example.json | 31 + .../lexicons/dev_tsunagite_difficulty.json | 29 + .../lexicons/dev_tsunagite_game.json | 204 + .../lexicons/dev_tsunagite_song.json | 72 + .../lexicons/dev_tsunagite_types.json | 50 + .../lexicons/dev_vielle_guestbook_book.json | 26 + .../lexicons/dev_vielle_guestbook_entry.json | 27 + ...vents_smokesignal_calendar_acceptance.json | 24 + .../lexicons/events_smokesignal_lfg.json | 59 + .../lexicons/events_smokesignal_profile.json | 73 + .../fyi_questionable_actor_profile.json | 5 + ..._lexicon_conquering-wolfhound_example.json | 16 + .../lexicons/garden_lexicon_example.json | 39 + ...garden_lexicon_joyous-grackle_example.json | 16 + ...n_lexicon_lawyerlike-deangelo_example.json | 16 + .../lexicons/garden_lexicon_service.json | 103 + ...n_lexicon_stunning-leafcutter_example.json | 16 + ...n_lexicon_unconquered-modesto_example.json | 22 + .../lexicons/io_atcr_hold_stats.json | 58 + .../lexicons/io_whiteley_ATlas_pin.json | 47 + .../net_asadaame5121_at-circle_request.json | 52 + .../lexicons/org_okazu-diary_feed_entry.json | 12 +- .../org_okazu-diary_material_collection.json | 41 + ...g_okazu-diary_material_collectionItem.json | 51 + .../org_okazu-diary_material_defs.json | 19 + .../org_okazu-diary_material_external.json | 83 + .../org_stormlightlabs_malfestio_deck.json | 84 + ...ormlightlabs_malfestio_thread_comment.json | 40 + .../place_stream_branding_deleteBlob.json | 54 + .../place_stream_branding_getBlob.json | 37 + .../place_stream_branding_getBranding.json | 74 + .../place_stream_branding_updateBlob.json | 72 + ...place_stream_broadcast_getBroadcaster.json | 12 +- .../place_stream_moderation_createBlock.json | 73 + .../place_stream_moderation_createGate.json | 68 + .../place_stream_moderation_defs.json | 36 + .../place_stream_moderation_deleteBlock.json | 53 + .../place_stream_moderation_deleteGate.json | 53 + .../place_stream_moderation_permission.json | 48 + ...ce_stream_moderation_updateLivestream.json | 78 + ...place_stream_multistream_createTarget.json | 38 + .../place_stream_multistream_defs.json | 57 + ...place_stream_multistream_deleteTarget.json | 34 + .../place_stream_multistream_listTargets.json | 68 + .../place_stream_multistream_putTarget.json | 44 + .../place_stream_multistream_target.json | 40 + .../lexicons/pub_leaflet_blocks_text.json | 8 + .../lexicons/pub_leaflet_publication.json | 5 + .../lexicons/sh_tangled_repo_pull.json | 12 +- .../lexicons/site_standard_document.json | 25 +- .../site_standard_graph_subscription.json | 1 + .../lexicons/site_standard_publication.json | 9 + .../lexicons/site_standard_theme_basic.json | 5 + .../lexicons/social_pace_daily_ring.json | 53 + .../lexicons/social_pace_daily_step.json | 35 + .../lexicons/social_tophhie_profile.json | 70 + .../tech_tokimeki_kaku_collection.json | 42 + .../tech_tokimeki_kaku_collectionItem.json | 40 + .../lexicons/tech_tokimeki_kaku_defs.json | 367 ++ .../lexicons/tech_tokimeki_kaku_post.json | 66 + .../lexicons/tech_tokimeki_kaku_reaction.json | 41 + .../lexicons/tech_tokimeki_kaku_request.json | 62 + .../tech_tokimeki_kaku_requestResponse.json | 41 + .../lexicons/tech_tokimeki_kaku_roomGate.json | 35 + .../lexicons/uk_skyblur_post.json | 5 +- crates/jacquard-api/src/app_bsky/actor.rs | 351 +- .../jacquard-api/src/app_bsky/actor/status.rs | 26 +- .../jacquard-api/src/app_bsky/ageassurance.rs | 211 +- crates/jacquard-api/src/app_bsky/bookmark.rs | 26 +- .../src/app_bsky/bookmark/create_bookmark.rs | 26 +- .../src/app_bsky/embed/external.rs | 60 +- .../jacquard-api/src/app_bsky/embed/images.rs | 56 +- .../jacquard-api/src/app_bsky/embed/record.rs | 136 +- .../jacquard-api/src/app_bsky/embed/video.rs | 52 +- crates/jacquard-api/src/app_bsky/feed.rs | 214 +- .../src/app_bsky/feed/generator.rs | 30 +- .../src/app_bsky/feed/get_likes.rs | 30 +- crates/jacquard-api/src/app_bsky/feed/post.rs | 74 +- .../jacquard-api/src/app_bsky/feed/repost.rs | 26 +- .../src/app_bsky/feed/threadgate.rs | 26 +- crates/jacquard-api/src/app_bsky/graph.rs | 302 +- .../jacquard-api/src/app_bsky/graph/follow.rs | 26 +- .../jacquard-api/src/app_bsky/graph/list.rs | 30 +- .../src/app_bsky/graph/listblock.rs | 26 +- .../src/app_bsky/graph/listitem.rs | 30 +- .../src/app_bsky/graph/starterpack.rs | 30 +- .../src/app_bsky/graph/verification.rs | 34 +- crates/jacquard-api/src/app_bsky/labeler.rs | 166 +- .../jacquard-api/src/app_bsky/notification.rs | 336 +- .../notification/list_notifications.rs | 104 +- .../app_bsky/notification/register_push.rs | 60 +- .../app_bsky/notification/unregister_push.rs | 56 +- crates/jacquard-api/src/app_bsky/unspecced.rs | 300 +- .../unspecced/get_post_thread_other_v2.rs | 30 +- .../app_bsky/unspecced/get_post_thread_v2.rs | 30 +- .../app_bsky/unspecced/get_suggested_users.rs | 3 + .../unspecced/get_suggested_users_skeleton.rs | 3 + .../unspecced/get_tagged_suggestions.rs | 30 +- crates/jacquard-api/src/app_bsky/video.rs | 30 +- .../src/app_dropanchor/checkin.rs | 88 +- .../src/app_dropanchor/comment.rs | 48 +- .../jacquard-api/src/app_dropanchor/like.rs | 26 +- crates/jacquard-api/src/app_juttu.rs | 6 + .../src/app_juttu/article_link.rs | 443 ++ crates/jacquard-api/src/app_ocho/auth.rs | 58 +- .../src/app_ocho/auth/at_proto_callback.rs | 48 +- .../src/app_ocho/auth/authorize.rs | 26 +- .../src/app_ocho/auth/github_callback.rs | 26 +- .../src/app_ocho/auth/google_callback.rs | 26 +- .../src/app_ocho/edu/verification.rs | 30 +- crates/jacquard-api/src/app_ocho/plugin.rs | 174 +- .../src/app_ocho/plugin/get_launch_asset.rs | 26 +- crates/jacquard-api/src/app_offprint.rs | 8 + .../jacquard-api/src/app_offprint/content.rs | 219 + .../jacquard-api/src/app_offprint/document.rs | 6 + .../src/app_offprint/document/article.rs | 265 ++ .../src/app_offprint/publication.rs | 265 ++ crates/jacquard-api/src/app_rocksky/album.rs | 30 +- crates/jacquard-api/src/app_rocksky/artist.rs | 26 +- .../jacquard-api/src/app_rocksky/playlist.rs | 26 +- crates/jacquard-api/src/app_rocksky/radio.rs | 30 +- .../jacquard-api/src/app_rocksky/scrobble.rs | 78 +- crates/jacquard-api/src/app_rocksky/shout.rs | 30 +- crates/jacquard-api/src/app_rocksky/song.rs | 78 +- .../src/art_cllctv/embed/external.rs | 78 +- .../src/art_cllctv/embed/images.rs | 56 +- .../beauty_cybernetic/trustcow/transaction.rs | 64 +- crates/jacquard-api/src/blog_pckt.rs | 1 + .../jacquard-api/src/blog_pckt/block/image.rs | 26 +- .../src/blog_pckt/block/task_item.rs | 26 +- crates/jacquard-api/src/blog_pckt/content.rs | 190 + crates/jacquard-api/src/blog_pckt/document.rs | 26 +- .../src/blog_pckt/richtext/facet.rs | 52 +- crates/jacquard-api/src/blue__2048.rs | 34 +- crates/jacquard-api/src/blue__2048/game.rs | 70 +- crates/jacquard-api/src/blue__2048/key.rs | 30 +- .../jacquard-api/src/blue__2048/key/game.rs | 26 +- .../src/blue__2048/key/player/stats.rs | 26 +- .../src/blue__2048/player/profile.rs | 30 +- .../src/blue__2048/player/stats.rs | 192 +- .../src/blue__2048/verification.rs | 38 +- crates/jacquard-api/src/blue_atplay.rs | 6 + crates/jacquard-api/src/blue_atplay/score.rs | 311 ++ crates/jacquard-api/src/blue_recipes/feed.rs | 90 +- .../src/blue_recipes/feed/recipe.rs | 30 +- .../src/blue_rito/feed/bookmark.rs | 30 +- .../jacquard-api/src/blue_rito/feed/like.rs | 26 +- .../src/blue_rito/label/auto/like/settings.rs | 26 +- .../src/blue_rito/label/auto/post.rs | 70 +- .../src/blue_rito/service/get_schema.rs | 30 +- crates/jacquard-api/src/blue_skytalk.rs | 6 + crates/jacquard-api/src/blue_skytalk/talk.rs | 6 + .../src/blue_skytalk/talk/thread.rs | 491 +++ crates/jacquard-api/src/buzz_bookhive.rs | 442 +- crates/jacquard-api/src/buzz_bookhive/book.rs | 34 +- crates/jacquard-api/src/buzz_bookhive/buzz.rs | 34 +- .../src/buzz_bookhive/hive_book.rs | 96 +- crates/jacquard-api/src/cat_vt3e.rs | 6 + crates/jacquard-api/src/cat_vt3e/gallery.rs | 8 + .../src/cat_vt3e/gallery/group.rs | 367 ++ .../src/cat_vt3e/gallery/group_item.rs | 421 ++ .../src/cat_vt3e/gallery/image.rs | 712 ++++ crates/jacquard-api/src/chat_bsky/actor.rs | 26 +- crates/jacquard-api/src/chat_bsky/convo.rs | 408 +- .../src/chat_bsky/convo/send_message.rs | 26 +- .../src/chat_bsky/convo/send_message_batch.rs | 26 +- .../moderation/get_actor_metadata.rs | 60 +- .../moderation/update_actor_access.rs | 26 +- crates/jacquard-api/src/city_yoyle.rs | 6 + crates/jacquard-api/src/city_yoyle/status.rs | 332 ++ .../src/club_stellz/evm/address_control.rs | 172 +- crates/jacquard-api/src/com_atproto/admin.rs | 30 +- .../com_atproto/admin/update_account_email.rs | 26 +- .../jacquard-api/src/com_atproto/identity.rs | 30 +- crates/jacquard-api/src/com_atproto/label.rs | 148 +- .../src/com_atproto/repo/apply_writes.rs | 108 +- .../src/com_atproto/repo/create_record.rs | 30 +- .../src/com_atproto/repo/delete_record.rs | 30 +- .../src/com_atproto/repo/get_record.rs | 30 +- .../com_atproto/repo/list_missing_blobs.rs | 26 +- .../src/com_atproto/repo/list_records.rs | 56 +- .../src/com_atproto/repo/put_record.rs | 60 +- crates/jacquard-api/src/com_atproto/server.rs | 110 +- .../com_atproto/server/create_app_password.rs | 30 +- .../com_atproto/server/create_invite_codes.rs | 52 +- .../src/com_atproto/server/delete_account.rs | 48 +- .../com_atproto/server/list_app_passwords.rs | 26 +- .../src/com_atproto/sync/get_blocks.rs | 26 +- .../src/com_atproto/sync/get_record.rs | 30 +- .../src/com_atproto/sync/list_repos.rs | 30 +- .../src/com_atproto/sync/subscribe_repos.rs | 404 +- .../src/com_atprotofans/validate_supporter.rs | 30 +- .../src/com_crabdance/nandi/post.rs | 48 +- .../com_shinolabs/pinksea/app_view_defs.rs | 78 +- .../src/com_shinolabs/pinksea/get_oekaki.rs | 26 +- .../pinksea/get_parent_for_reply.rs | 26 +- .../src/com_shinolabs/pinksea/profile.rs | 26 +- .../src/com_yuna0x0/guestbook/sign.rs | 30 +- .../community_lexicon/bookmarks/bookmark.rs | 26 +- .../src/community_lexicon/calendar.rs | 4 +- .../src/community_lexicon/calendar/event.rs | 26 +- .../community_lexicon/calendar/get_event.rs | 649 +++ .../calendar/search_events.rs | 711 ++++ .../src/computer_aesthetic/mood.rs | 30 +- .../src/computer_aesthetic/painting.rs | 86 +- .../src/computer_aesthetic/piece.rs | 30 +- .../src/computer_aesthetic/tape.rs | 30 +- crates/jacquard-api/src/dev_baileytownsend.rs | 1 + .../src/dev_baileytownsend/demo.rs | 6 + .../src/dev_baileytownsend/demo/example.rs | 365 ++ .../src/dev_baileytownsend/health/rings.rs | 46 +- .../src/dev_baileytownsend/health/steps.rs | 26 +- .../src/dev_baileytownsend/health/workout.rs | 120 +- .../experimental/atforumv1/feed/post.rs | 94 +- .../experimental/atforumv1/feed/question.rs | 106 +- .../experimental/atforumv1/feed/reply.rs | 30 +- .../experimental/atforumv1/forum/category.rs | 30 +- .../src/dev_ocbwoy3/blueboard/board.rs | 64 +- .../src/dev_ocbwoy3/blueboard/post.rs | 30 +- .../src/dev_regnault/webfishing/savefile.rs | 26 +- crates/jacquard-api/src/dev_tsunagite.rs | 9 + .../src/dev_tsunagite/difficulty.rs | 298 ++ crates/jacquard-api/src/dev_tsunagite/game.rs | 1880 +++++++++ crates/jacquard-api/src/dev_tsunagite/song.rs | 553 +++ .../jacquard-api/src/dev_tsunagite/types.rs | 442 ++ crates/jacquard-api/src/dev_vielle.rs | 6 + .../jacquard-api/src/dev_vielle/guestbook.rs | 7 + .../src/dev_vielle/guestbook/book.rs | 295 ++ .../src/dev_vielle/guestbook/entry.rs | 313 ++ crates/jacquard-api/src/events_smokesignal.rs | 4 +- .../src/events_smokesignal/calendar.rs | 6 + .../events_smokesignal/calendar/acceptance.rs | 268 ++ .../src/events_smokesignal/lfg.rs | 594 +++ .../src/events_smokesignal/profile.rs | 688 ++++ .../jacquard-api/src/fm_teal/alpha/stats.rs | 60 +- .../src/fyi_frontpage/feed/comment.rs | 30 +- .../src/fyi_frontpage/feed/post.rs | 30 +- .../src/fyi_questionable/actor/profile.rs | 82 +- .../src/fyi_questionable/question.rs | 30 +- .../src/fyi_unravel/frontpage/comment.rs | 30 +- .../src/fyi_unravel/frontpage/post.rs | 30 +- .../src/fyi_unravel/frontpage/vote.rs | 26 +- .../barklesheep/place_sheeps.rs | 30 +- crates/jacquard-api/src/garden_lexicon.rs | 9 +- .../garden_lexicon/conquering_wolfhound.rs | 6 + .../conquering_wolfhound/example.rs | 135 + .../src/garden_lexicon/example.rs | 423 ++ .../src/garden_lexicon/joyous_grackle.rs | 6 + .../garden_lexicon/joyous_grackle/example.rs | 133 + .../src/garden_lexicon/lawyerlike_deangelo.rs | 6 + .../lawyerlike_deangelo/example.rs | 133 + .../src/garden_lexicon/service.rs | 835 ++++ .../src/garden_lexicon/stunning_leafcutter.rs | 6 + .../stunning_leafcutter/example.rs | 133 + .../src/garden_lexicon/unconquered_modesto.rs | 6 + .../unconquered_modesto/example.rs | 261 ++ crates/jacquard-api/src/io_atcr/hold.rs | 3 +- .../jacquard-api/src/io_atcr/hold/captain.rs | 90 +- crates/jacquard-api/src/io_atcr/hold/crew.rs | 34 +- crates/jacquard-api/src/io_atcr/hold/layer.rs | 134 +- crates/jacquard-api/src/io_atcr/hold/stats.rs | 636 +++ crates/jacquard-api/src/io_atcr/manifest.rs | 116 +- crates/jacquard-api/src/io_atcr/repo/page.rs | 30 +- .../jacquard-api/src/io_atcr/sailor/star.rs | 26 +- crates/jacquard-api/src/io_atcr/tag.rs | 30 +- crates/jacquard-api/src/io_whiteley.rs | 1 + crates/jacquard-api/src/io_whiteley/ATlas.rs | 6 + .../jacquard-api/src/io_whiteley/ATlas/pin.rs | 584 +++ .../src/io_whiteley/luke/ATlas/pin.rs | 68 +- .../jacquard-api/src/io_whiteside/profile.rs | 30 +- crates/jacquard-api/src/lib.rs | 36 + .../src/link_bridgebeats/lookup.rs | 86 +- .../src/moe_karashiiro/kpaste/paste.rs | 26 +- crates/jacquard-api/src/my_skylights/rel.rs | 30 +- .../src/net_aftertheinter/coolthingtwo.rs | 26 +- crates/jacquard-api/src/net_altq/aqfile.rs | 74 +- .../src/net_anisota/beta/game/collection.rs | 58 +- .../src/net_anisota/beta/game/inventory.rs | 58 +- .../src/net_anisota/beta/game/log.rs | 30 +- .../src/net_anisota/beta/game/pack.rs | 64 +- .../src/net_anisota/beta/game/progress.rs | 70 +- .../src/net_anisota/beta/game/session.rs | 62 +- .../jacquard-api/src/net_anisota/feed/like.rs | 26 +- .../src/net_anisota/feed/list_item.rs | 30 +- .../jacquard-api/src/net_anisota/feed/post.rs | 26 +- .../src/net_anisota/harvest/minigame.rs | 86 +- .../jacquard-api/src/net_anisota/settings.rs | 30 +- .../src/net_asadaame5121/at_circle.rs | 1 + .../src/net_asadaame5121/at_circle/banner.rs | 30 +- .../src/net_asadaame5121/at_circle/block.rs | 30 +- .../src/net_asadaame5121/at_circle/member.rs | 56 +- .../src/net_asadaame5121/at_circle/request.rs | 586 +++ .../src/net_asadaame5121/at_circle/ring.rs | 30 +- .../jacquard-api/src/net_mmatt/vitals/car.rs | 88 +- .../src/network_slices/lexicon.rs | 34 +- .../jacquard-api/src/network_slices/slice.rs | 164 +- .../slice/create_o_auth_client.rs | 30 +- .../src/network_slices/slice/get_actors.rs | 30 +- .../src/network_slices/slice/get_job_logs.rs | 84 +- .../network_slices/slice/get_job_status.rs | 120 +- .../slice/get_o_auth_clients.rs | 108 +- .../network_slices/slice/get_slice_records.rs | 90 +- .../network_slices/slice/get_sync_summary.rs | 30 +- .../src/network_slices/slice/stats.rs | 48 +- .../jacquard-api/src/network_slices/tools.rs | 26 +- .../src/network_slices/tools/bug.rs | 80 +- .../src/network_slices/tools/bug/comment.rs | 30 +- .../src/network_slices/tools/bug/issue.rs | 30 +- .../src/network_slices/tools/bug/response.rs | 30 +- .../src/network_slices/tools/document.rs | 88 +- .../network_slices/tools/richtext/facet.rs | 52 +- .../src/network_slices/waitlist.rs | 30 +- .../jacquard-api/src/org_devcon/event/test.rs | 48 +- crates/jacquard-api/src/org_okazu_diary.rs | 3 +- .../org_okazu_diary/feed/collection_item.rs | 30 +- .../src/org_okazu_diary/feed/entry.rs | 38 +- .../src/org_okazu_diary/material.rs | 115 + .../org_okazu_diary/material/collection.rs | 442 ++ .../material/collection_item.rs | 530 +++ .../src/org_okazu_diary/material/external.rs | 805 ++++ crates/jacquard-api/src/org_stormlightlabs.rs | 6 + .../src/org_stormlightlabs/malfestio.rs | 7 + .../src/org_stormlightlabs/malfestio/deck.rs | 873 ++++ .../org_stormlightlabs/malfestio/thread.rs | 6 + .../malfestio/thread/comment.rs | 446 ++ .../src/place_atwork/endorsement.rs | 34 +- .../src/place_atwork/get_listing.rs | 26 +- .../jacquard-api/src/place_atwork/listing.rs | 52 +- .../src/place_atwork/search_listings.rs | 26 +- crates/jacquard-api/src/place_stream.rs | 93 +- .../jacquard-api/src/place_stream/branding.rs | 9 + .../src/place_stream/branding/delete_blob.rs | 118 + .../src/place_stream/branding/get_blob.rs | 227 + .../src/place_stream/branding/get_branding.rs | 390 ++ .../src/place_stream/branding/update_blob.rs | 130 + .../src/place_stream/broadcast.rs | 78 +- .../place_stream/broadcast/get_broadcaster.rs | 29 +- .../src/place_stream/broadcast/origin.rs | 48 +- crates/jacquard-api/src/place_stream/chat.rs | 56 +- .../src/place_stream/chat/message.rs | 74 +- .../src/place_stream/chat/profile.rs | 30 +- .../place_stream/graph/get_following_user.rs | 26 +- crates/jacquard-api/src/place_stream/key.rs | 26 +- .../live/search_actors_typeahead.rs | 26 +- .../src/place_stream/livestream.rs | 70 +- .../src/place_stream/moderation.rs | 364 ++ .../place_stream/moderation/create_block.rs | 294 ++ .../place_stream/moderation/create_gate.rs | 271 ++ .../place_stream/moderation/delete_block.rs | 264 ++ .../place_stream/moderation/delete_gate.rs | 264 ++ .../src/place_stream/moderation/permission.rs | 446 ++ .../moderation/update_livestream.rs | 304 ++ .../src/place_stream/multistream.rs | 617 +++ .../place_stream/multistream/create_target.rs | 209 + .../place_stream/multistream/delete_target.rs | 204 + .../place_stream/multistream/list_targets.rs | 494 +++ .../place_stream/multistream/put_target.rs | 253 ++ .../src/place_stream/multistream/target.rs | 431 ++ .../src/place_stream/richtext/facet.rs | 26 +- .../jacquard-api/src/place_stream/segment.rs | 112 +- .../jacquard-api/src/place_stream/server.rs | 64 +- .../src/place_stream/server/create_webhook.rs | 26 +- crates/jacquard-api/src/place_wisp/fs.rs | 82 +- .../src/pub_leaflet/blocks/image.rs | 26 +- .../src/pub_leaflet/blocks/text.rs | 18 + .../jacquard-api/src/pub_leaflet/comment.rs | 26 +- .../jacquard-api/src/pub_leaflet/document.rs | 30 +- .../src/pub_leaflet/pages/canvas.rs | 34 +- .../jacquard-api/src/pub_leaflet/poll/vote.rs | 26 +- .../src/pub_leaflet/publication.rs | 37 + .../src/pub_leaflet/richtext/facet.rs | 52 +- .../src/pub_leaflet/theme/color.rs | 64 +- .../jacquard-api/src/sh_tangled/feed/star.rs | 26 +- .../src/sh_tangled/git/ref_update.rs | 172 +- .../src/sh_tangled/graph/follow.rs | 26 +- .../src/sh_tangled/knot/list_keys.rs | 30 +- .../src/sh_tangled/label/definition.rs | 34 +- .../jacquard-api/src/sh_tangled/label/op.rs | 34 +- .../jacquard-api/src/sh_tangled/pipeline.rs | 174 +- .../src/sh_tangled/pipeline/status.rs | 58 +- .../jacquard-api/src/sh_tangled/public_key.rs | 30 +- .../src/sh_tangled/repo/add_secret.rs | 30 +- .../src/sh_tangled/repo/artifact.rs | 70 +- .../jacquard-api/src/sh_tangled/repo/blob.rs | 78 +- .../src/sh_tangled/repo/branch.rs | 48 +- .../src/sh_tangled/repo/compare.rs | 48 +- .../src/sh_tangled/repo/delete.rs | 30 +- .../src/sh_tangled/repo/fork_status.rs | 88 +- .../src/sh_tangled/repo/fork_sync.rs | 34 +- .../src/sh_tangled/repo/get_default_branch.rs | 30 +- .../jacquard-api/src/sh_tangled/repo/issue.rs | 30 +- .../src/sh_tangled/repo/issue/comment.rs | 30 +- .../src/sh_tangled/repo/list_secrets.rs | 64 +- .../jacquard-api/src/sh_tangled/repo/merge.rs | 52 +- .../src/sh_tangled/repo/merge_check.rs | 52 +- .../jacquard-api/src/sh_tangled/repo/pull.rs | 134 +- .../src/sh_tangled/repo/pull/comment.rs | 30 +- .../jacquard-api/src/sh_tangled/repo/tree.rs | 78 +- .../src/sh_tangled/spindle/member.rs | 30 +- crates/jacquard-api/src/sh_tangled/string.rs | 34 +- crates/jacquard-api/src/sh_weaver/actor.rs | 82 +- crates/jacquard-api/src/sh_weaver/collab.rs | 298 +- .../src/sh_weaver/collab/accept.rs | 30 +- .../src/sh_weaver/collab/invite.rs | 30 +- .../src/sh_weaver/collab/session.rs | 30 +- crates/jacquard-api/src/sh_weaver/edit.rs | 164 +- .../jacquard-api/src/sh_weaver/edit/cursor.rs | 26 +- .../jacquard-api/src/sh_weaver/edit/diff.rs | 26 +- .../src/sh_weaver/edit/list_drafts.rs | 30 +- crates/jacquard-api/src/sh_weaver/embed.rs | 52 +- .../src/sh_weaver/embed/external.rs | 60 +- .../src/sh_weaver/embed/images.rs | 56 +- .../src/sh_weaver/embed/record_with_media.rs | 26 +- .../src/sh_weaver/embed/records.rs | 86 +- .../jacquard-api/src/sh_weaver/embed/video.rs | 26 +- crates/jacquard-api/src/sh_weaver/graph.rs | 222 +- .../jacquard-api/src/sh_weaver/graph/list.rs | 30 +- .../src/sh_weaver/graph/subscribe.rs | 26 +- .../src/sh_weaver/graph/subscribe_accept.rs | 26 +- .../jacquard-api/src/sh_weaver/graph/tag.rs | 48 +- crates/jacquard-api/src/sh_weaver/notebook.rs | 468 +-- .../src/sh_weaver/notebook/chapter.rs | 48 +- .../src/sh_weaver/notebook/colour_scheme.rs | 30 +- .../src/sh_weaver/notebook/entry.rs | 64 +- .../sh_weaver/notebook/get_entry_notebooks.rs | 26 +- .../notebook/get_notebook_by_title.rs | 26 +- .../sh_weaver/notebook/get_reading_history.rs | 26 +- .../src/sh_weaver/notebook/resolve_entry.rs | 30 +- .../src/sh_weaver/notebook/theme.rs | 200 +- .../src/sh_weaver/notification.rs | 186 +- .../src/sh_weaver/publish/blob.rs | 26 +- .../src/site_standard/document.rs | 85 +- .../src/site_standard/graph/subscription.rs | 7 +- .../src/site_standard/publication.rs | 65 +- .../src/site_standard/theme/basic.rs | 87 +- .../src/site_standard/theme/color.rs | 64 +- .../jacquard-api/src/social_clippr/actor.rs | 30 +- .../src/social_clippr/actor/profile.rs | 26 +- crates/jacquard-api/src/social_clippr/feed.rs | 100 +- .../src/social_clippr/feed/clip.rs | 86 +- crates/jacquard-api/src/social_grain/actor.rs | 26 +- .../jacquard-api/src/social_grain/favorite.rs | 26 +- .../jacquard-api/src/social_grain/gallery.rs | 88 +- .../src/social_grain/gallery/item.rs | 30 +- crates/jacquard-api/src/social_grain/photo.rs | 82 +- .../src/social_grain/photo/exif.rs | 26 +- crates/jacquard-api/src/social_pace.rs | 6 + crates/jacquard-api/src/social_pace/daily.rs | 7 + .../src/social_pace/daily/ring.rs | 598 +++ .../src/social_pace/daily/step.rs | 381 ++ .../jacquard-api/src/social_pmsky/proposal.rs | 68 +- crates/jacquard-api/src/social_pmsky/vote.rs | 34 +- .../jacquard-api/src/social_psky/chat/room.rs | 26 +- .../src/social_psky/richtext/facet.rs | 52 +- crates/jacquard-api/src/social_tophhie.rs | 6 + .../src/social_tophhie/profile.rs | 664 +++ .../src/tech_manos/twmirror/post.rs | 64 +- crates/jacquard-api/src/tech_tokimeki.rs | 1 + crates/jacquard-api/src/tech_tokimeki/kaku.rs | 3641 +++++++++++++++++ .../src/tech_tokimeki/kaku/collection.rs | 471 +++ .../src/tech_tokimeki/kaku/collection_item.rs | 405 ++ .../src/tech_tokimeki/kaku/post.rs | 578 +++ .../src/tech_tokimeki/kaku/reaction.rs | 472 +++ .../src/tech_tokimeki/kaku/request.rs | 551 +++ .../tech_tokimeki/kaku/request_response.rs | 434 ++ .../src/tech_tokimeki/kaku/room_gate.rs | 346 ++ .../src/tech_tokimeki/poll/poll.rs | 30 +- .../src/tech_tokimeki/poll/vote.rs | 30 +- .../src/tools_ozone/communication.rs | 146 +- .../hosting/get_account_history.rs | 48 +- .../src/tools_ozone/moderation.rs | 1094 ++--- .../moderation/get_account_timeline.rs | 30 +- .../tools_ozone/moderation/schedule_action.rs | 84 +- .../jacquard-api/src/tools_ozone/safelink.rs | 236 +- .../src/tools_ozone/safelink/add_rule.rs | 34 +- .../src/tools_ozone/safelink/remove_rule.rs | 26 +- .../src/tools_ozone/safelink/update_rule.rs | 34 +- crates/jacquard-api/src/tools_ozone/set.rs | 34 +- .../src/tools_ozone/set/delete_values.rs | 26 +- .../jacquard-api/src/tools_ozone/setting.rs | 96 +- .../src/tools_ozone/setting/upsert_option.rs | 30 +- crates/jacquard-api/src/tools_ozone/team.rs | 26 +- .../src/tools_ozone/team/add_member.rs | 26 +- .../src/tools_ozone/verification.rs | 60 +- .../verification/grant_verifications.rs | 56 +- crates/jacquard-api/src/uk_skyblur/post.rs | 38 +- .../src/uk_skyblur/post/decrypt_by_cid.rs | 34 +- crates/jacquard-api/src/us_polhem/blog.rs | 26 +- .../src/us_polhem/blog/content.rs | 30 +- .../jacquard-api/src/us_polhem/blog/post.rs | 34 +- crates/jacquard-api/src/us_polhem/blog/tag.rs | 52 +- .../src/win_tomo_x/pushat/push_notify.rs | 26 +- crates/lazy-collections/Cargo.toml | 84 + crates/lazy-collections/src/deferred.rs | 53 + crates/lazy-collections/src/io.rs | 1180 ++++++ crates/lazy-collections/src/io/bufreader.rs | 945 +++++ crates/lazy-collections/src/io/bufwriter.rs | 353 ++ crates/lazy-collections/src/io/cursor.rs | 647 +++ crates/lazy-collections/src/io/embedded.rs | 107 + crates/lazy-collections/src/io/error.rs | 306 ++ crates/lazy-collections/src/io/impls.rs | 305 ++ crates/lazy-collections/src/io/initializer.rs | 40 + crates/lazy-collections/src/io/prelude.rs | 10 + crates/lazy-collections/src/io/std_io.rs | 107 + crates/lazy-collections/src/io/util.rs | 215 + crates/lazy-collections/src/lib.rs | 120 + crates/lazy-collections/src/map.rs | 525 +++ crates/lazy-collections/src/storage.rs | 21 + crates/lazy-collections/src/vector.rs | 550 +++ 528 files changed, 52334 insertions(+), 10179 deletions(-) create mode 100644 crates/jacquard-api/lexicons/app_juttu_articleLink.json create mode 100644 crates/jacquard-api/lexicons/app_offprint_content.json create mode 100644 crates/jacquard-api/lexicons/app_offprint_document_article.json create mode 100644 crates/jacquard-api/lexicons/app_offprint_publication.json create mode 100644 crates/jacquard-api/lexicons/blog_pckt_content.json create mode 100644 crates/jacquard-api/lexicons/blue_atplay_score_defs.json create mode 100644 crates/jacquard-api/lexicons/blue_skytalk_talk_thread.json create mode 100644 crates/jacquard-api/lexicons/cat_vt3e_gallery_group.json create mode 100644 crates/jacquard-api/lexicons/cat_vt3e_gallery_groupItem.json create mode 100644 crates/jacquard-api/lexicons/cat_vt3e_gallery_image.json create mode 100644 crates/jacquard-api/lexicons/city_yoyle_status.json create mode 100644 crates/jacquard-api/lexicons/community_lexicon_calendar_getEvent.json create mode 100644 crates/jacquard-api/lexicons/community_lexicon_calendar_searchEvents.json create mode 100644 crates/jacquard-api/lexicons/dev_baileytownsend_demo_example.json create mode 100644 crates/jacquard-api/lexicons/dev_tsunagite_difficulty.json create mode 100644 crates/jacquard-api/lexicons/dev_tsunagite_game.json create mode 100644 crates/jacquard-api/lexicons/dev_tsunagite_song.json create mode 100644 crates/jacquard-api/lexicons/dev_tsunagite_types.json create mode 100644 crates/jacquard-api/lexicons/dev_vielle_guestbook_book.json create mode 100644 crates/jacquard-api/lexicons/dev_vielle_guestbook_entry.json create mode 100644 crates/jacquard-api/lexicons/events_smokesignal_calendar_acceptance.json create mode 100644 crates/jacquard-api/lexicons/events_smokesignal_lfg.json create mode 100644 crates/jacquard-api/lexicons/events_smokesignal_profile.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_conquering-wolfhound_example.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_example.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_joyous-grackle_example.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_lawyerlike-deangelo_example.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_service.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_stunning-leafcutter_example.json create mode 100644 crates/jacquard-api/lexicons/garden_lexicon_unconquered-modesto_example.json create mode 100644 crates/jacquard-api/lexicons/io_atcr_hold_stats.json create mode 100644 crates/jacquard-api/lexicons/io_whiteley_ATlas_pin.json create mode 100644 crates/jacquard-api/lexicons/net_asadaame5121_at-circle_request.json create mode 100644 crates/jacquard-api/lexicons/org_okazu-diary_material_collection.json create mode 100644 crates/jacquard-api/lexicons/org_okazu-diary_material_collectionItem.json create mode 100644 crates/jacquard-api/lexicons/org_okazu-diary_material_defs.json create mode 100644 crates/jacquard-api/lexicons/org_okazu-diary_material_external.json create mode 100644 crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_deck.json create mode 100644 crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_thread_comment.json create mode 100644 crates/jacquard-api/lexicons/place_stream_branding_deleteBlob.json create mode 100644 crates/jacquard-api/lexicons/place_stream_branding_getBlob.json create mode 100644 crates/jacquard-api/lexicons/place_stream_branding_getBranding.json create mode 100644 crates/jacquard-api/lexicons/place_stream_branding_updateBlob.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_createBlock.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_createGate.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_defs.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_deleteBlock.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_deleteGate.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_permission.json create mode 100644 crates/jacquard-api/lexicons/place_stream_moderation_updateLivestream.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_createTarget.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_defs.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_deleteTarget.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_listTargets.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_putTarget.json create mode 100644 crates/jacquard-api/lexicons/place_stream_multistream_target.json create mode 100644 crates/jacquard-api/lexicons/social_pace_daily_ring.json create mode 100644 crates/jacquard-api/lexicons/social_pace_daily_step.json create mode 100644 crates/jacquard-api/lexicons/social_tophhie_profile.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_collection.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_collectionItem.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_defs.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_post.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_reaction.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_request.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_requestResponse.json create mode 100644 crates/jacquard-api/lexicons/tech_tokimeki_kaku_roomGate.json create mode 100644 crates/jacquard-api/src/app_juttu.rs create mode 100644 crates/jacquard-api/src/app_juttu/article_link.rs create mode 100644 crates/jacquard-api/src/app_offprint.rs create mode 100644 crates/jacquard-api/src/app_offprint/content.rs create mode 100644 crates/jacquard-api/src/app_offprint/document.rs create mode 100644 crates/jacquard-api/src/app_offprint/document/article.rs create mode 100644 crates/jacquard-api/src/app_offprint/publication.rs create mode 100644 crates/jacquard-api/src/blog_pckt/content.rs create mode 100644 crates/jacquard-api/src/blue_atplay.rs create mode 100644 crates/jacquard-api/src/blue_atplay/score.rs create mode 100644 crates/jacquard-api/src/blue_skytalk.rs create mode 100644 crates/jacquard-api/src/blue_skytalk/talk.rs create mode 100644 crates/jacquard-api/src/blue_skytalk/talk/thread.rs create mode 100644 crates/jacquard-api/src/cat_vt3e.rs create mode 100644 crates/jacquard-api/src/cat_vt3e/gallery.rs create mode 100644 crates/jacquard-api/src/cat_vt3e/gallery/group.rs create mode 100644 crates/jacquard-api/src/cat_vt3e/gallery/group_item.rs create mode 100644 crates/jacquard-api/src/cat_vt3e/gallery/image.rs create mode 100644 crates/jacquard-api/src/city_yoyle.rs create mode 100644 crates/jacquard-api/src/city_yoyle/status.rs create mode 100644 crates/jacquard-api/src/community_lexicon/calendar/get_event.rs create mode 100644 crates/jacquard-api/src/community_lexicon/calendar/search_events.rs create mode 100644 crates/jacquard-api/src/dev_baileytownsend/demo.rs create mode 100644 crates/jacquard-api/src/dev_baileytownsend/demo/example.rs create mode 100644 crates/jacquard-api/src/dev_tsunagite.rs create mode 100644 crates/jacquard-api/src/dev_tsunagite/difficulty.rs create mode 100644 crates/jacquard-api/src/dev_tsunagite/game.rs create mode 100644 crates/jacquard-api/src/dev_tsunagite/song.rs create mode 100644 crates/jacquard-api/src/dev_tsunagite/types.rs create mode 100644 crates/jacquard-api/src/dev_vielle.rs create mode 100644 crates/jacquard-api/src/dev_vielle/guestbook.rs create mode 100644 crates/jacquard-api/src/dev_vielle/guestbook/book.rs create mode 100644 crates/jacquard-api/src/dev_vielle/guestbook/entry.rs create mode 100644 crates/jacquard-api/src/events_smokesignal/calendar.rs create mode 100644 crates/jacquard-api/src/events_smokesignal/calendar/acceptance.rs create mode 100644 crates/jacquard-api/src/events_smokesignal/lfg.rs create mode 100644 crates/jacquard-api/src/events_smokesignal/profile.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/conquering_wolfhound.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/conquering_wolfhound/example.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/example.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/joyous_grackle.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/joyous_grackle/example.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo/example.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/service.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/stunning_leafcutter.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/stunning_leafcutter/example.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/unconquered_modesto.rs create mode 100644 crates/jacquard-api/src/garden_lexicon/unconquered_modesto/example.rs create mode 100644 crates/jacquard-api/src/io_atcr/hold/stats.rs create mode 100644 crates/jacquard-api/src/io_whiteley/ATlas.rs create mode 100644 crates/jacquard-api/src/io_whiteley/ATlas/pin.rs create mode 100644 crates/jacquard-api/src/net_asadaame5121/at_circle/request.rs create mode 100644 crates/jacquard-api/src/org_okazu_diary/material.rs create mode 100644 crates/jacquard-api/src/org_okazu_diary/material/collection.rs create mode 100644 crates/jacquard-api/src/org_okazu_diary/material/collection_item.rs create mode 100644 crates/jacquard-api/src/org_okazu_diary/material/external.rs create mode 100644 crates/jacquard-api/src/org_stormlightlabs.rs create mode 100644 crates/jacquard-api/src/org_stormlightlabs/malfestio.rs create mode 100644 crates/jacquard-api/src/org_stormlightlabs/malfestio/deck.rs create mode 100644 crates/jacquard-api/src/org_stormlightlabs/malfestio/thread.rs create mode 100644 crates/jacquard-api/src/org_stormlightlabs/malfestio/thread/comment.rs create mode 100644 crates/jacquard-api/src/place_stream/branding.rs create mode 100644 crates/jacquard-api/src/place_stream/branding/delete_blob.rs create mode 100644 crates/jacquard-api/src/place_stream/branding/get_blob.rs create mode 100644 crates/jacquard-api/src/place_stream/branding/get_branding.rs create mode 100644 crates/jacquard-api/src/place_stream/branding/update_blob.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/create_block.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/create_gate.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/delete_block.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/delete_gate.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/permission.rs create mode 100644 crates/jacquard-api/src/place_stream/moderation/update_livestream.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream/create_target.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream/delete_target.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream/list_targets.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream/put_target.rs create mode 100644 crates/jacquard-api/src/place_stream/multistream/target.rs create mode 100644 crates/jacquard-api/src/social_pace.rs create mode 100644 crates/jacquard-api/src/social_pace/daily.rs create mode 100644 crates/jacquard-api/src/social_pace/daily/ring.rs create mode 100644 crates/jacquard-api/src/social_pace/daily/step.rs create mode 100644 crates/jacquard-api/src/social_tophhie.rs create mode 100644 crates/jacquard-api/src/social_tophhie/profile.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/collection.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/collection_item.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/post.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/reaction.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/request.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/request_response.rs create mode 100644 crates/jacquard-api/src/tech_tokimeki/kaku/room_gate.rs create mode 100644 crates/lazy-collections/Cargo.toml create mode 100644 crates/lazy-collections/src/deferred.rs create mode 100644 crates/lazy-collections/src/io.rs create mode 100644 crates/lazy-collections/src/io/bufreader.rs create mode 100644 crates/lazy-collections/src/io/bufwriter.rs create mode 100644 crates/lazy-collections/src/io/cursor.rs create mode 100644 crates/lazy-collections/src/io/embedded.rs create mode 100644 crates/lazy-collections/src/io/error.rs create mode 100644 crates/lazy-collections/src/io/impls.rs create mode 100644 crates/lazy-collections/src/io/initializer.rs create mode 100644 crates/lazy-collections/src/io/prelude.rs create mode 100644 crates/lazy-collections/src/io/std_io.rs create mode 100644 crates/lazy-collections/src/io/util.rs create mode 100644 crates/lazy-collections/src/lib.rs create mode 100644 crates/lazy-collections/src/map.rs create mode 100644 crates/lazy-collections/src/storage.rs create mode 100644 crates/lazy-collections/src/vector.rs diff --git a/Cargo.lock b/Cargo.lock index 34d6987c..7db6fe16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,6 +174,12 @@ dependencies = [ "syn 2.0.112", ] +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "arrayvec" version = "0.7.6" @@ -249,7 +255,7 @@ dependencies = [ "aligned", "anyhow", "arg_enum_proc_macro", - "arrayvec", + "arrayvec 0.7.6", "log", "num-rational", "num-traits", @@ -267,7 +273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" dependencies = [ "anyhow", - "arrayvec", + "arrayvec 0.7.6", "log", "nom", "num-rational", @@ -280,7 +286,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", ] [[package]] @@ -313,7 +319,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -332,7 +338,7 @@ dependencies = [ "sync_wrapper", "tower-layer", "tower-service", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -439,6 +445,21 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bit_field" version = "0.10.3" @@ -534,6 +555,16 @@ dependencies = [ "safemem", ] +[[package]] +name = "buffer" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab7228d32b5d95be40adeba1d9461c8547b5dadf5f9cbfba09b6d578991df28" +dependencies = [ + "arrayvec 0.5.2", + "mac 0.0.2", +] + [[package]] name = "built" version = "0.8.0" @@ -833,7 +864,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a" dependencies = [ "loom", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1253,6 +1284,26 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" +[[package]] +name = "embedded-io-adapters" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ccf22c3feffc79593914c0b4be9a2ed6b11e44cf1f84fd6b77d2ee92de0077" +dependencies = [ + "embedded-io 0.6.1", + "embedded-io-async", + "tokio", +] + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io 0.6.1", +] + [[package]] name = "encode_unicode" version = "1.0.0" @@ -1477,7 +1528,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" dependencies = [ - "mac", + "mac 0.1.1", "new_debug_unreachable", ] @@ -1735,7 +1786,7 @@ dependencies = [ "slab", "tokio", "tokio-util", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1758,6 +1809,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -1788,13 +1848,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" dependencies = [ "atomic-polyfill", - "hash32", + "hash32 0.2.1", "rustc_version", "serde", "spin 0.9.8", "stable_deref_trait", ] +[[package]] +name = "heapless" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" +dependencies = [ + "hash32 0.3.1", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.4.1" @@ -1839,7 +1909,7 @@ dependencies = [ "thiserror 1.0.69", "tinyvec", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "url", ] @@ -1861,7 +1931,7 @@ dependencies = [ "smallvec", "thiserror 1.0.69", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1880,7 +1950,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" dependencies = [ "log", - "mac", + "mac 0.1.1", "markup5ever", "proc-macro2", "quote", @@ -1994,7 +2064,7 @@ dependencies = [ "system-configuration", "tokio", "tower-service", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "windows-registry", ] @@ -2310,7 +2380,7 @@ dependencies = [ "thiserror 2.0.17", "tiff 0.6.1", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "trait-variant", "url", "viuer", @@ -2361,8 +2431,8 @@ dependencies = [ "tokio", "tower", "tower-http", - "tracing", - "tracing-subscriber", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-subscriber 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2385,7 +2455,7 @@ dependencies = [ "http", "ipld-core", "k256", - "maitake-sync", + "maitake-sync 0.1.2", "miette", "multibase", "multihash", @@ -2411,7 +2481,7 @@ dependencies = [ "tokio", "tokio-tungstenite-wasm", "tokio-util", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "trait-variant", "url", "zstd", @@ -2454,7 +2524,7 @@ dependencies = [ "serde_json", "thiserror 2.0.17", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "trait-variant", "url", "urlencoding", @@ -2542,7 +2612,7 @@ dependencies = [ "smol_str", "thiserror 2.0.17", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "trait-variant", "url", "webbrowser", @@ -2688,6 +2758,35 @@ dependencies = [ "winnow 0.6.24", ] +[[package]] +name = "lazy-collections" +version = "0.9.5" +dependencies = [ + "buffer", + "bytes", + "chrono", + "embedded-io 0.6.1", + "embedded-io-adapters", + "embedded-io-async", + "heapless 0.9.2", + "lock_api", + "loom", + "maitake-sync 0.2.2", + "managed", + "miette", + "n0-future", + "pin-project", + "postcard", + "proptest", + "serde", + "serde_bytes", + "tokio", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.44 (git+https://github.com/tokio-rs/tracing)", + "tracing-subscriber 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-subscriber 0.3.22 (git+https://github.com/tokio-rs/tracing)", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2784,8 +2883,8 @@ dependencies = [ "cfg-if", "generator", "scoped-tls", - "tracing", - "tracing-subscriber", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-subscriber 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2812,6 +2911,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "mac" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1db08c0d0ddbb591e65f1da58d1cefccc94a2faa0c55bf979ce215a3e04d5e" + [[package]] name = "mac" version = "0.1.1" @@ -2831,6 +2936,27 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "maitake-sync" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "748f86d9befd480b602c3bebc9ef30dbf2f3dfc8acc4a73d07b90f0117e6de3f" +dependencies = [ + "cordyceps", + "loom", + "mutex-traits", + "mycelium-bitfield", + "pin-project", + "portable-atomic", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + [[package]] name = "markup5ever" version = "0.12.1" @@ -3055,6 +3181,12 @@ dependencies = [ "twoway", ] +[[package]] +name = "mutex-traits" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3929f2b5633d29cf7b6624992e5f3c1e9334f1193423e12d17be4faf678cde3f" + [[package]] name = "mycelium-bitfield" version = "0.1.5" @@ -3544,7 +3676,7 @@ dependencies = [ "cobs", "embedded-io 0.4.0", "embedded-io 0.6.1", - "heapless", + "heapless 0.7.17", "serde", ] @@ -3648,6 +3780,25 @@ dependencies = [ "syn 2.0.112", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "pxfm" version = "0.1.27" @@ -3694,7 +3845,7 @@ dependencies = [ "socket2 0.6.1", "thiserror 2.0.17", "tokio", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "web-time", ] @@ -3715,7 +3866,7 @@ dependencies = [ "slab", "thiserror 2.0.17", "tinyvec", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "web-time", ] @@ -3729,7 +3880,7 @@ dependencies = [ "libc", "once_cell", "socket2 0.6.1", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "windows-sys 0.60.2", ] @@ -3807,6 +3958,15 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rav1e" version = "0.8.1" @@ -3816,7 +3976,7 @@ dependencies = [ "aligned-vec", "arbitrary", "arg_enum_proc_macro", - "arrayvec", + "arrayvec 0.7.6", "av-scenechange", "av1-grain", "bitstream-io", @@ -4187,6 +4347,18 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.22" @@ -4762,7 +4934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" dependencies = [ "futf", - "mac", + "mac 0.1.1", "utf-8", ] @@ -5128,7 +5300,7 @@ dependencies = [ "tokio", "tower-layer", "tower-service", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5152,7 +5324,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", - "tracing", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5175,8 +5347,18 @@ checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", - "tracing-attributes", - "tracing-core", + "tracing-attributes 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "git+https://github.com/tokio-rs/tracing#efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed" +dependencies = [ + "pin-project-lite", + "tracing-attributes 0.1.31 (git+https://github.com/tokio-rs/tracing)", + "tracing-core 0.1.36 (git+https://github.com/tokio-rs/tracing)", ] [[package]] @@ -5190,6 +5372,16 @@ dependencies = [ "syn 2.0.112", ] +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "git+https://github.com/tokio-rs/tracing#efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.112", +] + [[package]] name = "tracing-core" version = "0.1.36" @@ -5200,6 +5392,14 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "git+https://github.com/tokio-rs/tracing#efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed" +dependencies = [ + "valuable", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -5208,7 +5408,17 @@ checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ "log", "once_cell", - "tracing-core", + "tracing-core 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "git+https://github.com/tokio-rs/tracing#efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed" +dependencies = [ + "log", + "once_cell", + "tracing-core 0.1.36 (git+https://github.com/tokio-rs/tracing)", ] [[package]] @@ -5225,9 +5435,26 @@ dependencies = [ "smallvec", "thread_local", "time", - "tracing", - "tracing-core", - "tracing-log", + "tracing 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-log 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "git+https://github.com/tokio-rs/tracing#efc690fa6bd1d9c3a57528b9bc8ac80504a7a6ed" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing 0.1.44 (git+https://github.com/tokio-rs/tracing)", + "tracing-core 0.1.36 (git+https://github.com/tokio-rs/tracing)", + "tracing-log 0.2.0 (git+https://github.com/tokio-rs/tracing)", ] [[package]] @@ -5333,6 +5560,12 @@ dependencies = [ "syn 2.0.112", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.8.1" @@ -5478,6 +5711,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -6129,7 +6371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69" dependencies = [ "log", - "mac", + "mac 0.1.1", "markup5ever", ] diff --git a/crates/jacquard-api/Cargo.toml b/crates/jacquard-api/Cargo.toml index ce3de493..6dfdbde5 100644 --- a/crates/jacquard-api/Cargo.toml +++ b/crates/jacquard-api/Cargo.toml @@ -49,19 +49,25 @@ streaming = ["jacquard-common/websocket"] app_blebbit = [] app_bsky = ["com_atproto"] app_dropanchor = [] +app_juttu = ["com_atproto"] app_ocho = [] +app_offprint = [] app_rocksky = ["com_atproto"] art_cllctv = ["app_bsky", "com_atproto"] beauty_cybernetic = [] blog_pckt = ["com_atproto"] blue__2048 = [] blue_atplane = [] +blue_atplay = [] blue_linkat = [] blue_recipes = [] blue_rito = [] +blue_skytalk = [] blue_zio = [] buzz_bookhive = ["com_atproto"] +cat_vt3e = [] chat_bsky = ["app_bsky"] +city_yoyle = [] club_stellz = [] com__5jiji = [] com_atproto = [] @@ -77,6 +83,9 @@ dev_baileytownsend = [] dev_fudgeu = [] dev_ocbwoy3 = [] dev_regnault = [] +dev_tsunagite = [] +dev_vielle = [] +events_smokesignal = ["community_lexicon"] fm_teal = [] fyi_frontpage = ["com_atproto"] fyi_questionable = ["com_atproto"] @@ -104,6 +113,7 @@ org_devcon = [] org_farmapps = [] org_okazu_diary = ["com_atproto"] org_robocracy = [] +org_stormlightlabs = [] org_user_intents = [] place_atwork = [] place_stream = ["app_bsky", "com_atproto"] @@ -115,11 +125,13 @@ site_standard = ["com_atproto"] social_clippr = [] social_flockfeeds = [] social_grain = ["com_atproto"] +social_pace = [] social_pmsky = [] social_psky = ["com_atproto"] social_sket = [] +social_tophhie = [] tech_manos = ["com_atproto"] -tech_tokimeki = ["com_atproto"] +tech_tokimeki = ["app_bsky", "com_atproto"] tools_ozone = ["app_bsky", "chat_bsky", "com_atproto"] tools_smokesignal = [] uk_ewancroft = [] diff --git a/crates/jacquard-api/lexicons/app_bsky_actor_defs.json b/crates/jacquard-api/lexicons/app_bsky_actor_defs.json index b482859e..02bb6199 100644 --- a/crates/jacquard-api/lexicons/app_bsky_actor_defs.json +++ b/crates/jacquard-api/lexicons/app_bsky_actor_defs.json @@ -731,6 +731,10 @@ "record" ], "properties": { + "cid": { + "type": "string", + "format": "cid" + }, "embed": { "type": "union", "description": "An optional embed associated with the status.", @@ -747,6 +751,10 @@ "type": "boolean", "description": "True if the status is not expired, false if it is expired. Only present if expiration was set." }, + "isDisabled": { + "type": "boolean", + "description": "True if the user's go-live access has been disabled by a moderator, false otherwise." + }, "record": { "type": "unknown" }, @@ -756,6 +764,10 @@ "knownValues": [ "app.bsky.actor.status#live" ] + }, + "uri": { + "type": "string", + "format": "at-uri" } } }, diff --git a/crates/jacquard-api/lexicons/app_bsky_ageassurance_defs.json b/crates/jacquard-api/lexicons/app_bsky_ageassurance_defs.json index cddd57c7..d20daf11 100644 --- a/crates/jacquard-api/lexicons/app_bsky_ageassurance_defs.json +++ b/crates/jacquard-api/lexicons/app_bsky_ageassurance_defs.json @@ -34,6 +34,7 @@ "description": "The Age Assurance configuration for a specific region.", "required": [ "countryCode", + "minAccessAge", "rules" ], "properties": { @@ -41,6 +42,10 @@ "type": "string", "description": "The ISO 3166-1 alpha-2 country code this configuration applies to." }, + "minAccessAge": { + "type": "integer", + "description": "The minimum age (as a whole integer) required to use Bluesky in this region." + }, "regionCode": { "type": "string", "description": "The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country." diff --git a/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsers.json b/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsers.json index bc653c8f..305ee88e 100644 --- a/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsers.json +++ b/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsers.json @@ -34,6 +34,10 @@ "type": "ref", "ref": "app.bsky.actor.defs#profileView" } + }, + "recId": { + "type": "integer", + "description": "Snowflake for this recommendation, use when submitting recommendation events." } } } diff --git a/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsersSkeleton.json b/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsersSkeleton.json index 118a8bcb..d5fe6914 100644 --- a/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsersSkeleton.json +++ b/crates/jacquard-api/lexicons/app_bsky_unspecced_getSuggestedUsersSkeleton.json @@ -39,6 +39,10 @@ "type": "string", "format": "did" } + }, + "recId": { + "type": "integer", + "description": "Snowflake for this recommendation, use when submitting recommendation events." } } } diff --git a/crates/jacquard-api/lexicons/app_juttu_articleLink.json b/crates/jacquard-api/lexicons/app_juttu_articleLink.json new file mode 100644 index 00000000..48ec8171 --- /dev/null +++ b/crates/jacquard-api/lexicons/app_juttu_articleLink.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "app.juttu.articleLink", + "defs": { + "main": { + "type": "record", + "description": "Maps a unique article ID to its Bluesky comments thread, preserving original creation time.", + "key": "any", + "record": { + "type": "object", + "required": [ + "articleId", + "commentsThread", + "createdAt" + ], + "properties": { + "articleId": { + "type": "string", + "description": "The site-specific unique identifier for the article (e.g., slug).", + "maxLength": 300 + }, + "articleUrl": { + "type": "string", + "description": "The URL of the article.", + "format": "uri" + }, + "commentsThread": { + "type": "ref", + "description": "A strong reference to the root post (e.g., app.bsky.feed.post) of the comments thread.", + "ref": "com.atproto.repo.strongRef" + }, + "createdAt": { + "type": "string", + "description": "The original publication timestamp of the article.", + "format": "datetime" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/app_offprint_content.json b/crates/jacquard-api/lexicons/app_offprint_content.json new file mode 100644 index 00000000..d39291a1 --- /dev/null +++ b/crates/jacquard-api/lexicons/app_offprint_content.json @@ -0,0 +1,38 @@ +{ + "lexicon": 1, + "id": "app.offprint.content", + "defs": { + "main": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "Required array of `app.offprint.block.*` unions.", + "items": { + "type": "union", + "refs": [ + "app.offprint.block.text", + "app.offprint.block.heading", + "app.offprint.block.blockquote", + "app.offprint.block.callout", + "app.offprint.block.unorderedList", + "app.offprint.block.orderedList", + "app.offprint.block.todoList", + "app.offprint.block.image", + "app.offprint.block.imageGrid", + "app.offprint.block.button", + "app.offprint.block.codeBlock", + "app.offprint.block.horizontalRule", + "app.offprint.block.bskyPost", + "app.offprint.block.iframeEmbed", + "app.offprint.block.linkEmbed" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/app_offprint_document_article.json b/crates/jacquard-api/lexicons/app_offprint_document_article.json new file mode 100644 index 00000000..38ed6772 --- /dev/null +++ b/crates/jacquard-api/lexicons/app_offprint_document_article.json @@ -0,0 +1,23 @@ +{ + "lexicon": 1, + "id": "app.offprint.document.article", + "defs": { + "main": { + "type": "record", + "key": "tid", + "record": { + "type": "object", + "required": [ + "document" + ], + "properties": { + "document": { + "type": "string", + "description": "Required AT-URI to a `site.standard.document` compatible record. Used to display articles with-in a publication.", + "format": "at-uri" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/app_offprint_publication.json b/crates/jacquard-api/lexicons/app_offprint_publication.json new file mode 100644 index 00000000..27fad369 --- /dev/null +++ b/crates/jacquard-api/lexicons/app_offprint_publication.json @@ -0,0 +1,23 @@ +{ + "lexicon": 1, + "id": "app.offprint.publication", + "defs": { + "main": { + "type": "record", + "key": "tid", + "record": { + "type": "object", + "required": [ + "publication" + ], + "properties": { + "publication": { + "type": "string", + "description": "Required AT-URI to a `site.standard.publication` compatible record.", + "format": "at-uri" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/blog_pckt_content.json b/crates/jacquard-api/lexicons/blog_pckt_content.json new file mode 100644 index 00000000..007fbc58 --- /dev/null +++ b/crates/jacquard-api/lexicons/blog_pckt_content.json @@ -0,0 +1,23 @@ +{ + "lexicon": 1, + "id": "blog.pckt.content", + "defs": { + "main": { + "type": "object", + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "Array of content blocks", + "items": { + "type": "union", + "refs": [], + "closed": false + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/blue_atplay_score_defs.json b/crates/jacquard-api/lexicons/blue_atplay_score_defs.json new file mode 100644 index 00000000..263c1b5d --- /dev/null +++ b/crates/jacquard-api/lexicons/blue_atplay_score_defs.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "blue.atplay.score.defs", + "defs": { + "attestation": { + "type": "object", + "description": "Attestation signature proving a score was submitted through ATPlay SDK", + "required": [ + "key", + "signature" + ], + "properties": { + "attestedAt": { + "type": "string", + "description": "Timestamp when the attestation was created (optional)", + "format": "datetime" + }, + "key": { + "type": "string", + "description": "DID key reference for verifying the signature", + "maxLength": 512 + }, + "signature": { + "type": "bytes", + "description": "ES256 signature over the score record CID", + "maxLength": 8192 + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/blue_skytalk_talk_thread.json b/crates/jacquard-api/lexicons/blue_skytalk_talk_thread.json new file mode 100644 index 00000000..86767c30 --- /dev/null +++ b/crates/jacquard-api/lexicons/blue_skytalk_talk_thread.json @@ -0,0 +1,42 @@ +{ + "lexicon": 1, + "id": "blue.skytalk.talk.thread", + "defs": { + "main": { + "type": "record", + "description": "A thread in a channel", + "key": "tid", + "record": { + "type": "object", + "required": [ + "channelId", + "title", + "createdAt" + ], + "properties": { + "channelId": { + "type": "string", + "description": "The channel this thread belongs to" + }, + "createdAt": { + "type": "string", + "description": "Timestamp of thread creation", + "format": "datetime" + }, + "text": { + "type": "string", + "description": "The text content of the thread", + "maxLength": 4000, + "maxGraphemes": 40000 + }, + "title": { + "type": "string", + "description": "The title of the thread", + "maxLength": 300, + "maxGraphemes": 3000 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/cat_vt3e_gallery_group.json b/crates/jacquard-api/lexicons/cat_vt3e_gallery_group.json new file mode 100644 index 00000000..b5845fd7 --- /dev/null +++ b/crates/jacquard-api/lexicons/cat_vt3e_gallery_group.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "cat.vt3e.gallery.group", + "defs": { + "main": { + "type": "record", + "description": "defines a group of images in the gallery", + "key": "tid", + "record": { + "type": "object", + "required": [ + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "description": { + "type": "string", + "maxLength": 1000 + }, + "title": { + "type": "string", + "maxLength": 300 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/cat_vt3e_gallery_groupItem.json b/crates/jacquard-api/lexicons/cat_vt3e_gallery_groupItem.json new file mode 100644 index 00000000..e5559236 --- /dev/null +++ b/crates/jacquard-api/lexicons/cat_vt3e_gallery_groupItem.json @@ -0,0 +1,38 @@ +{ + "lexicon": 1, + "id": "cat.vt3e.gallery.groupItem", + "defs": { + "main": { + "type": "record", + "description": "defines an item in a gallery group", + "key": "tid", + "record": { + "type": "object", + "required": [ + "group", + "image", + "addedAt" + ], + "properties": { + "addedAt": { + "type": "string", + "format": "datetime" + }, + "group": { + "type": "string", + "description": "uri of the group that the image belongs to", + "format": "at-uri" + }, + "image": { + "type": "string", + "description": "uri of the image that this item represents", + "format": "at-uri" + }, + "note": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/cat_vt3e_gallery_image.json b/crates/jacquard-api/lexicons/cat_vt3e_gallery_image.json new file mode 100644 index 00000000..89871d9e --- /dev/null +++ b/crates/jacquard-api/lexicons/cat_vt3e_gallery_image.json @@ -0,0 +1,65 @@ +{ + "lexicon": 1, + "id": "cat.vt3e.gallery.image", + "defs": { + "main": { + "type": "record", + "description": "defines an image in the gallery", + "key": "tid", + "record": { + "type": "object", + "required": [ + "image", + "createdAt" + ], + "properties": { + "alt": { + "type": "string", + "maxLength": 2000 + }, + "aspectRatio": { + "type": "integer" + }, + "blurhash": { + "type": "string", + "description": "provides a blurred preview of the image for use while loading, see github.com/woltapp/blurhash" + }, + "caption": { + "type": "string", + "maxLength": 2000 + }, + "checksum": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "dominantColour": { + "type": "string" + }, + "height": { + "type": "integer" + }, + "image": { + "type": "blob", + "accept": [ + "image/*" + ], + "maxSize": 32000000 + }, + "sizeInBytes": { + "type": "integer" + }, + "title": { + "type": "string", + "maxLength": 512 + }, + "width": { + "type": "integer" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/city_yoyle_status.json b/crates/jacquard-api/lexicons/city_yoyle_status.json new file mode 100644 index 00000000..4cde4039 --- /dev/null +++ b/crates/jacquard-api/lexicons/city_yoyle_status.json @@ -0,0 +1,28 @@ +{ + "lexicon": 1, + "id": "city.yoyle.status", + "defs": { + "main": { + "type": "record", + "description": "Short status update", + "key": "tid", + "record": { + "type": "object", + "required": [ + "text" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "text": { + "type": "string", + "maxLength": 3000, + "maxGraphemes": 300 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/community_lexicon_calendar_getEvent.json b/crates/jacquard-api/lexicons/community_lexicon_calendar_getEvent.json new file mode 100644 index 00000000..1b2d7593 --- /dev/null +++ b/crates/jacquard-api/lexicons/community_lexicon_calendar_getEvent.json @@ -0,0 +1,71 @@ +{ + "lexicon": 1, + "id": "community.lexicon.calendar.getEvent", + "defs": { + "eventView": { + "type": "object", + "description": "An event record with RSVP counts and URL.", + "required": [ + "countGoing", + "countInterested", + "countNotGoing", + "url" + ], + "properties": { + "countGoing": { + "type": "integer", + "description": "Number of users who have RSVP'd as going." + }, + "countInterested": { + "type": "integer", + "description": "Number of users who have RSVP'd as interested." + }, + "countNotGoing": { + "type": "integer", + "description": "Number of users who have RSVP'd as not going." + }, + "url": { + "type": "string", + "description": "The canonical URL for this event on Smoke Signal.", + "format": "uri" + } + } + }, + "main": { + "type": "query", + "description": "Get a single event by repository and record key.", + "parameters": { + "type": "params", + "required": [ + "repository", + "recordKey" + ], + "properties": { + "recordKey": { + "type": "string", + "description": "The record key (rkey) of the event.", + "maxLength": 150, + "maxGraphemes": 150 + }, + "repository": { + "type": "string", + "description": "The DID of the repository containing the event.", + "format": "did" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "#eventView" + } + }, + "errors": [ + { + "name": "NotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/community_lexicon_calendar_searchEvents.json b/crates/jacquard-api/lexicons/community_lexicon_calendar_searchEvents.json new file mode 100644 index 00000000..da2d162d --- /dev/null +++ b/crates/jacquard-api/lexicons/community_lexicon_calendar_searchEvents.json @@ -0,0 +1,99 @@ +{ + "lexicon": 1, + "id": "community.lexicon.calendar.searchEvents", + "defs": { + "eventView": { + "type": "object", + "description": "An event record with RSVP counts and URL.", + "required": [ + "countGoing", + "countInterested", + "countNotGoing", + "url" + ], + "properties": { + "countGoing": { + "type": "integer", + "description": "Number of users who have RSVP'd as going." + }, + "countInterested": { + "type": "integer", + "description": "Number of users who have RSVP'd as interested." + }, + "countNotGoing": { + "type": "integer", + "description": "Number of users who have RSVP'd as not going." + }, + "url": { + "type": "string", + "description": "The canonical web URL for this event.", + "format": "uri" + } + } + }, + "main": { + "type": "query", + "description": "Search for events. Supports full-text search, filtering by repository, and filtering by location CIDs.", + "parameters": { + "type": "params", + "properties": { + "limit": { + "type": "integer", + "description": "Maximum number of results to return.", + "default": 10, + "minimum": 1, + "maximum": 100 + }, + "location": { + "type": "array", + "description": "Filter events by location CIDs. Can be specified multiple times.", + "items": { + "type": "string", + "format": "cid" + } + }, + "query": { + "type": "string", + "description": "Full-text search query.", + "maxLength": 150, + "maxGraphemes": 150 + }, + "repository": { + "type": "string", + "description": "Filter events by DID.", + "format": "did" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "results" + ], + "properties": { + "results": { + "type": "array", + "items": { + "type": "ref", + "ref": "#eventView" + } + } + } + } + }, + "errors": [ + { + "name": "InvalidRepository" + }, + { + "name": "SearchUnavailable" + }, + { + "name": "SearchError" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_baileytownsend_demo_example.json b/crates/jacquard-api/lexicons/dev_baileytownsend_demo_example.json new file mode 100644 index 00000000..e2469b64 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_baileytownsend_demo_example.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "dev.baileytownsend.demo.example", + "defs": { + "main": { + "type": "record", + "description": "An example record for showing permissions ets", + "key": "tid", + "record": { + "type": "object", + "required": [ + "name", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "name": { + "type": "string", + "description": "A name of something", + "minLength": 1, + "maxLength": 640, + "maxGraphemes": 64 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_tsunagite_difficulty.json b/crates/jacquard-api/lexicons/dev_tsunagite_difficulty.json new file mode 100644 index 00000000..5491c822 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_tsunagite_difficulty.json @@ -0,0 +1,29 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.difficulty", + "description": "Definitions related to difficulty slots in games hosting leaderboards via Tsunagite.", + "defs": { + "main": { + "type": "record", + "description": "A difficulty slot in a game hosting leaderboards via Tsunagite.", + "key": "any", + "record": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "color": { + "type": "string", + "description": "The hex code color of the difficulty slot." + }, + "name": { + "type": "ref", + "description": "The human-readable name of the difficulty slot for use in UI.", + "ref": "dev.tsunagite.translatable" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_tsunagite_game.json b/crates/jacquard-api/lexicons/dev_tsunagite_game.json new file mode 100644 index 00000000..aae17393 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_tsunagite_game.json @@ -0,0 +1,204 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.game", + "description": "Definitions related to games hosting leaderboards via Tunagite.", + "defs": { + "enum": { + "type": "object", + "description": "A closed set of indexable named values.", + "required": [ + "name", + "id", + "values" + ], + "properties": { + "id": { + "type": "string", + "description": "The internal ID of this component, limited to the RecordKey characterset.", + "format": "record-key", + "minLength": 1, + "maxLength": 32 + }, + "name": { + "type": "ref", + "description": "The human-readable name of this component in UI.", + "ref": "dev.tsunagite.translatable" + }, + "values": { + "type": "array", + "description": "The allowed values for this enum to take.", + "items": { + "type": "ref", + "ref": "dev.tsunagite.types#indexable" + } + } + } + }, + "main": { + "type": "record", + "description": "A record describing a game hosting leaderboards via Tsunagite.", + "key": "any", + "record": { + "type": "object", + "required": [ + "name", + "judgments", + "scoreComponents", + "defaultComponent" + ], + "properties": { + "defaultComponent": { + "type": "string", + "description": "The default component for leaderboard sorting.", + "format": "record-key" + }, + "inputMethods": { + "type": "array", + "description": "An array of usable input methods for the game. Optional if the game only has one input method or doesn't separate leaderboards by method.", + "items": { + "type": "string", + "description": "Can be tokens or raw strings.", + "knownValues": [ + "dev.tsunagite.keyboard", + "dev.tsunagite.gamepad" + ] + } + }, + "judgments": { + "type": "array", + "description": "The obtainable judgments during gameplay.", + "items": { + "type": "ref", + "description": "Indices will be displayed in ascending order.", + "ref": "dev.tsunagite.types#indexable" + } + }, + "logo": { + "type": "blob", + "description": "The logo of the game, for display in UI.", + "accept": [ + "image/png", + "image/jpeg", + "image/jxl", + "image/webp" + ], + "maxSize": 8000000 + }, + "modes": { + "type": "array", + "description": "An array of playable game modes with different gameplay configurations. Optional if the game only has one mode.", + "items": { + "type": "string", + "description": "Can be tokens or raw strings.", + "knownValues": [ + "dev.tsunagite.singles", + "dev.tsunagite.doubles" + ] + } + }, + "name": { + "type": "ref", + "description": "The human-readable name of the game, for display in UI.", + "ref": "dev.tsunagite.translatable" + }, + "scoreComponents": { + "type": "array", + "description": "All the components of a score in the game, including grades, lamps, EX score, and whatever other constructs are used.", + "items": { + "type": "union", + "description": "If you need a component type that doesn't exist yet, contact @lemmaeof.gay", + "refs": [ + "#enum", + "#points", + "#percentage", + "#text" + ] + } + } + } + } + }, + "percentage": { + "type": "object", + "description": "A percentage score with customizable precision.", + "required": [ + "name", + "id", + "maximum", + "precision" + ], + "properties": { + "id": { + "type": "string", + "description": "The internal ID of this component, limited to the RecordKey characterset.", + "format": "record-key", + "minLength": 1, + "maxLength": 32 + }, + "maximum": { + "type": "integer", + "description": "The maximum allowed percentage for this score.", + "default": 100 + }, + "name": { + "type": "ref", + "description": "The human-readable name of this component in UI.", + "ref": "dev.tsunagite.translatable" + }, + "precision": { + "type": "integer", + "description": "The number of decimal places to include in the percentage.", + "default": 2 + } + } + }, + "points": { + "type": "object", + "description": "An integer point score, with or without a cap.", + "required": [ + "name", + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The internal ID of this component, limited to the RecordKey characterset.", + "format": "record-key", + "minLength": 1, + "maxLength": 32 + }, + "maximum": { + "type": "integer", + "description": "The maximum allowed value for this score." + }, + "name": { + "type": "ref", + "description": "The human-readable name of this component in UI.", + "ref": "dev.tsunagite.translatable" + } + } + }, + "text": { + "type": "object", + "description": "A fallback component for displaying arbitrary text.", + "required": [ + "name", + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The internal ID of this component, limited to the RecordKey characterset.", + "format": "record-key", + "minLength": 1, + "maxLength": 32 + }, + "name": { + "type": "ref", + "description": "The human-readable name of this component in UI.", + "ref": "dev.tsunagite.translatable" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_tsunagite_song.json b/crates/jacquard-api/lexicons/dev_tsunagite_song.json new file mode 100644 index 00000000..cfd8b046 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_tsunagite_song.json @@ -0,0 +1,72 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.song", + "description": "Definitions related to songs included in games hosting leaderboards via Tsunagite.", + "defs": { + "main": { + "type": "record", + "description": "A song included in a game hosting leaderboards via Tsunagite.", + "key": "any", + "record": { + "type": "object", + "required": [ + "game", + "title", + "composer" + ], + "properties": { + "composer": { + "type": "ref", + "description": "The name of the composer of this song. Translations will typically be listed alongside the default.", + "ref": "dev.tsunagite.translatable" + }, + "game": { + "type": "array", + "description": "The game(s) this song is included in.", + "items": { + "type": "string", + "description": "All URIs must point to records of type `dev.tsunagite.game`.", + "format": "at-uri" + } + }, + "genre": { + "type": "ref", + "description": "The genre this song belongs to.", + "ref": "dev.tsunagite.translatable" + }, + "jacket": { + "type": "blob", + "description": "The jacket or banner art of this song, for display in UI.", + "accept": [ + "image/png", + "image/jpeg", + "image/jxl", + "image/webp" + ], + "maxSize": 8000000 + }, + "jacketArtist": { + "type": "ref", + "description": "The name of the jacket artist for this song.", + "ref": "dev.tsunagite.translatable" + }, + "source": { + "type": "ref", + "description": "The source this song is from - an album, competition, other game, etc.", + "ref": "dev.tsunagite.translatable" + }, + "subtitle": { + "type": "ref", + "description": "The human-readable subtitle of this song.", + "ref": "dev.tsunagite.translatable" + }, + "title": { + "type": "ref", + "description": "The human-readable title of this song in UI. Translations will typically be listed alongside the default.", + "ref": "dev.tsunagite.translatable" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_tsunagite_types.json b/crates/jacquard-api/lexicons/dev_tsunagite_types.json new file mode 100644 index 00000000..95d73be8 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_tsunagite_types.json @@ -0,0 +1,50 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.types", + "description": "Assistant data types for Tsunagite lexicons.", + "defs": { + "indexable": { + "type": "object", + "description": "A named value with a numeric index for sorting.", + "required": [ + "id", + "name", + "index" + ], + "properties": { + "id": { + "type": "string", + "description": "The internal ID for the value, limited to the RecordKey character set.", + "format": "record-key", + "minLength": 1, + "maxLength": 32 + }, + "index": { + "type": "integer", + "description": "The numeric index used for sorting." + }, + "name": { + "type": "ref", + "description": "The human-readable name of the value for displaying in UIs.", + "ref": "dev.tsunagite.translatable" + } + } + }, + "typedRef": { + "type": "object", + "description": "A typed record reference that does not require a CID hash.", + "properties": { + "ref": { + "type": "string", + "description": "The AT URI of the record this object references.", + "format": "at-uri" + }, + "type": { + "type": "string", + "description": "The type of the record this object references.", + "format": "record-key" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_vielle_guestbook_book.json b/crates/jacquard-api/lexicons/dev_vielle_guestbook_book.json new file mode 100644 index 00000000..c6384609 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_vielle_guestbook_book.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "dev.vielle.guestbook.book", + "description": "Book for guesbook signing. dev.vielle.guestbook.entry records will refer to this. The rkey should be nsid (reverse dns) for the domain this is a guestbook for", + "defs": { + "main": { + "type": "record", + "key": "nsid", + "record": { + "type": "object", + "required": [ + "site" + ], + "properties": { + "site": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/dev_vielle_guestbook_entry.json b/crates/jacquard-api/lexicons/dev_vielle_guestbook_entry.json new file mode 100644 index 00000000..a6ce7099 --- /dev/null +++ b/crates/jacquard-api/lexicons/dev_vielle_guestbook_entry.json @@ -0,0 +1,27 @@ +{ + "lexicon": 1, + "id": "dev.vielle.guestbook.entry", + "description": "Signature for a guestbook. This references the dev.vielle.guestbook.book record for the given website. The rkey should be nsid (reverse dns) for the domain this is a signature for", + "defs": { + "main": { + "type": "record", + "key": "nsid", + "record": { + "type": "object", + "required": [ + "book", + "contents" + ], + "properties": { + "book": { + "type": "string", + "format": "at-uri" + }, + "contents": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/events_smokesignal_calendar_acceptance.json b/crates/jacquard-api/lexicons/events_smokesignal_calendar_acceptance.json new file mode 100644 index 00000000..a1baba3c --- /dev/null +++ b/crates/jacquard-api/lexicons/events_smokesignal_calendar_acceptance.json @@ -0,0 +1,24 @@ +{ + "lexicon": 1, + "id": "events.smokesignal.calendar.acceptance", + "defs": { + "main": { + "type": "record", + "description": "A cryptographic proof record that contains RSVP acceptance data.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "cid" + ], + "properties": { + "cid": { + "type": "string", + "description": "The CID (Content Identifier) of the rsvp that this proof validates.", + "format": "cid" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/events_smokesignal_lfg.json b/crates/jacquard-api/lexicons/events_smokesignal_lfg.json new file mode 100644 index 00000000..a4c24f31 --- /dev/null +++ b/crates/jacquard-api/lexicons/events_smokesignal_lfg.json @@ -0,0 +1,59 @@ +{ + "lexicon": 1, + "id": "events.smokesignal.lfg", + "defs": { + "main": { + "type": "record", + "description": "A Looking For Group record that broadcasts interest in finding activity partners within a geographic area.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "location", + "tags", + "startsAt", + "endsAt", + "createdAt", + "active" + ], + "properties": { + "active": { + "type": "boolean", + "description": "Whether the LFG is currently active and visible to others." + }, + "createdAt": { + "type": "string", + "description": "Record creation timestamp.", + "format": "datetime" + }, + "endsAt": { + "type": "string", + "description": "When the LFG expires and is no longer visible.", + "format": "datetime" + }, + "location": { + "type": "ref", + "description": "The geographic location for activity partner matching.", + "ref": "community.lexicon.location#geo" + }, + "startsAt": { + "type": "string", + "description": "When the LFG becomes active.", + "format": "datetime" + }, + "tags": { + "type": "array", + "description": "Interest tags for matching with events and other users.", + "items": { + "type": "string", + "maxLength": 64, + "maxGraphemes": 64 + }, + "minLength": 1, + "maxLength": 10 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/events_smokesignal_profile.json b/crates/jacquard-api/lexicons/events_smokesignal_profile.json new file mode 100644 index 00000000..42bf5c14 --- /dev/null +++ b/crates/jacquard-api/lexicons/events_smokesignal_profile.json @@ -0,0 +1,73 @@ +{ + "lexicon": 1, + "id": "events.smokesignal.profile", + "defs": { + "forhire": { + "type": "token", + "description": "Indicates the identity is available for hire" + }, + "hiring": { + "type": "token", + "description": "Indicates the identity is actively hiring" + }, + "main": { + "type": "record", + "description": "A user profile for Smoke Signal", + "key": "literal:self", + "record": { + "type": "object", + "properties": { + "avatar": { + "type": "blob", + "description": "Small image to be displayed next to events. AKA, 'profile picture'", + "accept": [ + "image/png", + "image/jpeg" + ], + "maxSize": 3000000 + }, + "banner": { + "type": "blob", + "description": "Larger horizontal image to display behind profile view.", + "accept": [ + "image/png", + "image/jpeg" + ], + "maxSize": 3000000 + }, + "description": { + "type": "string", + "description": "A free text description of the identity.", + "maxLength": 2000, + "maxGraphemes": 2000 + }, + "displayName": { + "type": "string", + "description": "The display name of the identity.", + "maxLength": 200, + "maxGraphemes": 200 + }, + "facets": { + "type": "array", + "description": "Annotations of text (mentions, URLs, hashtags, etc) in the description.", + "items": { + "type": "ref", + "ref": "app.bsky.richtext.facet" + } + }, + "profileHost": { + "type": "string", + "description": "The format used for profile links", + "maxLength": 60, + "maxGraphemes": 60, + "knownValues": [ + "bsky.app", + "blacksky.community", + "aturi" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/fyi_questionable_actor_profile.json b/crates/jacquard-api/lexicons/fyi_questionable_actor_profile.json index d14dab2f..c15e68fc 100644 --- a/crates/jacquard-api/lexicons/fyi_questionable_actor_profile.json +++ b/crates/jacquard-api/lexicons/fyi_questionable_actor_profile.json @@ -13,6 +13,11 @@ "type": "string", "format": "datetime" }, + "description": { + "type": "string", + "maxLength": 2560, + "maxGraphemes": 256 + }, "displayName": { "type": "string", "maxLength": 640, diff --git a/crates/jacquard-api/lexicons/garden_lexicon_conquering-wolfhound_example.json b/crates/jacquard-api/lexicons/garden_lexicon_conquering-wolfhound_example.json new file mode 100644 index 00000000..681465fd --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_conquering-wolfhound_example.json @@ -0,0 +1,16 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.conquering-wolfhound.example", + "defs": { + "main": { + "type": "record", + "description": "The Conquering Wolfhound!!!!!!", + "key": "tid", + "record": { + "type": "object", + "required": [], + "properties": {} + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_example.json b/crates/jacquard-api/lexicons/garden_lexicon_example.json new file mode 100644 index 00000000..3d21ea5a --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_example.json @@ -0,0 +1,39 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.example", + "defs": { + "main": { + "type": "record", + "description": "An example value for a lexicon schema", + "key": "tid", + "record": { + "type": "object", + "required": [ + "lexicon", + "value", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "The user-supplied date and time the example was created.", + "format": "datetime" + }, + "description": { + "type": "string", + "description": "A description of the example." + }, + "lexicon": { + "type": "string", + "description": "The NSID that the example is of.", + "format": "nsid" + }, + "value": { + "type": "unknown", + "description": "The example itself." + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_joyous-grackle_example.json b/crates/jacquard-api/lexicons/garden_lexicon_joyous-grackle_example.json new file mode 100644 index 00000000..1e7559e1 --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_joyous-grackle_example.json @@ -0,0 +1,16 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.joyous-grackle.example", + "defs": { + "main": { + "type": "record", + "description": "My lexicon description", + "key": "tid", + "record": { + "type": "object", + "required": [], + "properties": {} + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_lawyerlike-deangelo_example.json b/crates/jacquard-api/lexicons/garden_lexicon_lawyerlike-deangelo_example.json new file mode 100644 index 00000000..bf0664d4 --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_lawyerlike-deangelo_example.json @@ -0,0 +1,16 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.lawyerlike-deangelo.example", + "defs": { + "main": { + "type": "record", + "description": "My lexicon description", + "key": "tid", + "record": { + "type": "object", + "required": [], + "properties": {} + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_service.json b/crates/jacquard-api/lexicons/garden_lexicon_service.json new file mode 100644 index 00000000..5e750ab3 --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_service.json @@ -0,0 +1,103 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.service", + "defs": { + "main": { + "type": "record", + "description": "Declares XRPC methods available on a DID document service. The rkey is the service fragment ID without the # prefix (e.g., 'atproto_pds' for '#atproto_pds').", + "key": "any", + "record": { + "type": "object", + "required": [ + "serviceType" + ], + "properties": { + "description": { + "type": "string", + "description": "Description of what this service provides.", + "maxLength": 1000 + }, + "methods": { + "type": "array", + "description": "Methods available on this service.", + "items": { + "type": "ref", + "ref": "#method" + } + }, + "serviceType": { + "type": "string", + "description": "The type of service being declared.", + "maxLength": 100 + }, + "urlTemplates": { + "type": "array", + "description": "URL templates for constructing web URLs from AT-URIs or record data. Useful for linking to web views of records.", + "items": { + "type": "ref", + "ref": "#urlTemplate" + } + } + } + } + }, + "method": { + "type": "object", + "required": [ + "lexicon" + ], + "properties": { + "authMethods": { + "type": "array", + "description": "Authentication methods supported by this method.", + "items": { + "type": "string", + "maxLength": 50, + "knownValues": [ + "none", + "atproto.admin", + "atproto.bearer", + "atproto.oauth", + "atproto.inter-service" + ] + } + }, + "deprecated": { + "type": "boolean", + "description": "Whether this method is deprecated and should no longer be used." + }, + "lexicon": { + "type": "string", + "description": "AT-URI pointing to a lexicon schema that defines this method.", + "format": "at-uri" + } + } + }, + "urlTemplate": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "collections": { + "type": "array", + "description": "NSIDs of collections this URL template applies to.", + "items": { + "type": "string", + "format": "nsid" + } + }, + "description": { + "type": "string", + "description": "Description of what this URL template is for.", + "maxLength": 1000 + }, + "url": { + "type": "string", + "description": "URI template with placeholders for record data", + "maxLength": 2000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_stunning-leafcutter_example.json b/crates/jacquard-api/lexicons/garden_lexicon_stunning-leafcutter_example.json new file mode 100644 index 00000000..fd1b462a --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_stunning-leafcutter_example.json @@ -0,0 +1,16 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.stunning-leafcutter.example", + "defs": { + "main": { + "type": "record", + "description": "My lexicon description", + "key": "tid", + "record": { + "type": "object", + "required": [], + "properties": {} + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/garden_lexicon_unconquered-modesto_example.json b/crates/jacquard-api/lexicons/garden_lexicon_unconquered-modesto_example.json new file mode 100644 index 00000000..dc7ed3bd --- /dev/null +++ b/crates/jacquard-api/lexicons/garden_lexicon_unconquered-modesto_example.json @@ -0,0 +1,22 @@ +{ + "lexicon": 1, + "id": "garden.lexicon.unconquered-modesto.example", + "defs": { + "main": { + "type": "record", + "description": "My lexicon description", + "key": "tid", + "record": { + "type": "object", + "required": [ + "message2" + ], + "properties": { + "message2": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/io_atcr_hold_stats.json b/crates/jacquard-api/lexicons/io_atcr_hold_stats.json new file mode 100644 index 00000000..ffd4bd68 --- /dev/null +++ b/crates/jacquard-api/lexicons/io_atcr_hold_stats.json @@ -0,0 +1,58 @@ +{ + "lexicon": 1, + "id": "io.atcr.hold.stats", + "defs": { + "main": { + "type": "record", + "description": "Repository statistics stored in the hold's embedded PDS. Tracks pull/push counts per owner+repository combination. Record key is deterministic: base32(sha256(ownerDID + \"/\" + repository)[:16]).", + "key": "any", + "record": { + "type": "object", + "required": [ + "ownerDid", + "repository", + "pullCount", + "pushCount", + "updatedAt" + ], + "properties": { + "lastPull": { + "type": "string", + "description": "RFC3339 timestamp of last pull", + "format": "datetime" + }, + "lastPush": { + "type": "string", + "description": "RFC3339 timestamp of last push", + "format": "datetime" + }, + "ownerDid": { + "type": "string", + "description": "DID of the image owner (e.g., did:plc:xyz123)", + "format": "did" + }, + "pullCount": { + "type": "integer", + "description": "Number of manifest downloads", + "minimum": 0 + }, + "pushCount": { + "type": "integer", + "description": "Number of manifest uploads", + "minimum": 0 + }, + "repository": { + "type": "string", + "description": "Repository name (e.g., myapp)", + "maxLength": 256 + }, + "updatedAt": { + "type": "string", + "description": "RFC3339 timestamp of when this record was last updated", + "format": "datetime" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/io_whiteley_ATlas_pin.json b/crates/jacquard-api/lexicons/io_whiteley_ATlas_pin.json new file mode 100644 index 00000000..176d7108 --- /dev/null +++ b/crates/jacquard-api/lexicons/io_whiteley_ATlas_pin.json @@ -0,0 +1,47 @@ +{ + "lexicon": 1, + "id": "io.whiteley.ATlas.pin", + "defs": { + "main": { + "type": "record", + "description": "A user's geographical pin on the atlas", + "key": "literal:self", + "record": { + "type": "object", + "required": [ + "did", + "longitude", + "latitude", + "description", + "placedAt" + ], + "properties": { + "description": { + "type": "string", + "maxLength": 256 + }, + "did": { + "type": "string", + "format": "did" + }, + "latitude": { + "type": "string", + "maxLength": 32 + }, + "longitude": { + "type": "string", + "maxLength": 32 + }, + "placedAt": { + "type": "string", + "format": "datetime" + }, + "website": { + "type": "string", + "maxLength": 256 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/net_asadaame5121_at-circle_request.json b/crates/jacquard-api/lexicons/net_asadaame5121_at-circle_request.json new file mode 100644 index 00000000..20639855 --- /dev/null +++ b/crates/jacquard-api/lexicons/net_asadaame5121_at-circle_request.json @@ -0,0 +1,52 @@ +{ + "lexicon": 1, + "id": "net.asadaame5121.at-circle.request", + "defs": { + "main": { + "type": "record", + "description": "A request to join a webring", + "key": "tid", + "record": { + "type": "object", + "required": [ + "ring", + "siteUrl", + "siteTitle", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "message": { + "type": "string", + "description": "Introduction message", + "maxLength": 1000, + "maxGraphemes": 100 + }, + "ring": { + "type": "ref", + "ref": "net.asadaame5121.at-circle.defs#ringRef" + }, + "rssUrl": { + "type": "string", + "description": "RSS feed URL of the site", + "format": "uri" + }, + "siteTitle": { + "type": "string", + "description": "Title of the site", + "maxLength": 1000, + "maxGraphemes": 100 + }, + "siteUrl": { + "type": "string", + "description": "URL of the site to register", + "format": "uri" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_okazu-diary_feed_entry.json b/crates/jacquard-api/lexicons/org_okazu-diary_feed_entry.json index c0070825..d7098a58 100644 --- a/crates/jacquard-api/lexicons/org_okazu-diary_feed_entry.json +++ b/crates/jacquard-api/lexicons/org_okazu-diary_feed_entry.json @@ -23,7 +23,7 @@ }, "labels": { "type": "union", - "description": "General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the subjects, tags, and the note are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so. To put warnings on the subject even for explicit users of the Okazu-Diary.org application, put self-labels in the `labels` property value of individual `subject` values as well.", + "description": "Self-label values for this post. Effectively content warnings for the note and tags.", "refs": [ "com.atproto.label.defs#selfLabels" ] @@ -36,25 +36,25 @@ }, "subjects": { "type": "array", - "description": "Materials used for gratification. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain.", + "description": "References to `org.okazu-diary.material.external` records associated with the activity. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain. Although this property uses a `strongRef` to make a reference to an external repository reliable to some extent, it is recommended that you copy the record to your own repository if you want to reference a record from another repository.", "items": { "type": "ref", - "ref": "org.okazu-diary.feed.defs#subject" + "ref": "com.atproto.repo.strongRef" }, "maxLength": 16 }, "tags": { "type": "array", - "description": "User-specified tags for the entry.", + "description": "User-specified tags for the activity.", "items": { "type": "ref", - "ref": "org.okazu-diary.feed.defs#tag" + "ref": "org.okazu-diary.material.defs#tag" }, "maxLength": 64 }, "via": { "type": "ref", - "description": "Reference to another `org.okazu-diary.feed.entry` record or an `org.okazu-diary.feed.collectionItem` record whose `subjects` this collection item is derived from.", + "description": "Reference to another `org.okazu-diary.feed.entry` record or an `org.okazu-diary.material.collectionItem` record from this entry is derived.", "ref": "com.atproto.repo.strongRef" }, "visibility": { diff --git a/crates/jacquard-api/lexicons/org_okazu-diary_material_collection.json b/crates/jacquard-api/lexicons/org_okazu-diary_material_collection.json new file mode 100644 index 00000000..7e9b261f --- /dev/null +++ b/crates/jacquard-api/lexicons/org_okazu-diary_material_collection.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "org.okazu-diary.material.collection", + "defs": { + "main": { + "type": "record", + "description": "Record representing a user-curated colleciton of materials.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "description": { + "type": "string", + "maxLength": 3000, + "maxGraphemes": 300 + }, + "labels": { + "type": "union", + "description": "General-purpose self-label values primarily for consumption by generic AT clients. See the `labels` property of `org.okazu-diary.feed.entry` for details.", + "refs": [ + "com.atproto.label.defs#selfLabels" + ] + }, + "name": { + "type": "string", + "description": "Display name for the collection.", + "minLength": 1, + "maxLength": 64 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_okazu-diary_material_collectionItem.json b/crates/jacquard-api/lexicons/org_okazu-diary_material_collectionItem.json new file mode 100644 index 00000000..9558ba91 --- /dev/null +++ b/crates/jacquard-api/lexicons/org_okazu-diary_material_collectionItem.json @@ -0,0 +1,51 @@ +{ + "lexicon": 1, + "id": "org.okazu-diary.material.collectionItem", + "defs": { + "main": { + "type": "record", + "description": "Record declaring the inclusion of a single material or a set of materials in a specific collection.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "collection", + "subjects", + "createdAt" + ], + "properties": { + "collection": { + "type": "string", + "description": "Reference to the collection record (`org.okazu-diary.feed.collection`).", + "format": "at-uri" + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "note": { + "type": "string", + "description": "Remarks on the collection item.", + "maxLength": 5000, + "maxGraphemes": 500 + }, + "subjects": { + "type": "array", + "description": "Reference(s) to a material or set of materials (`org.okazu-diary.material.external`) to be included in the collection.", + "items": { + "type": "string", + "format": "at-uri" + }, + "minLength": 1, + "maxLength": 16 + }, + "via": { + "type": "ref", + "description": "Reference to an `org.okazu-diary.feed.entry` record or an `org.okazu-diary.material.collectionItem` of another collection from which this collection item is derived.", + "ref": "com.atproto.repo.strongRef" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_okazu-diary_material_defs.json b/crates/jacquard-api/lexicons/org_okazu-diary_material_defs.json new file mode 100644 index 00000000..dda52007 --- /dev/null +++ b/crates/jacquard-api/lexicons/org_okazu-diary_material_defs.json @@ -0,0 +1,19 @@ +{ + "lexicon": 1, + "id": "org.okazu-diary.material.defs", + "defs": { + "tag": { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "string", + "minLength": 1, + "maxLength": 256 + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_okazu-diary_material_external.json b/crates/jacquard-api/lexicons/org_okazu-diary_material_external.json new file mode 100644 index 00000000..dd086766 --- /dev/null +++ b/crates/jacquard-api/lexicons/org_okazu-diary_material_external.json @@ -0,0 +1,83 @@ +{ + "lexicon": 1, + "id": "org.okazu-diary.material.external", + "defs": { + "main": { + "type": "record", + "description": "A descriptor of a pornographic material.", + "key": "tid", + "record": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Description of the material, typically taken from the material's HTML metadata." + }, + "genericLabels": { + "type": "union", + "description": "General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the material and tags are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so.", + "refs": [ + "com.atproto.label.defs#selfLabels" + ] + }, + "labels": { + "type": "union", + "description": "User-specified self-label values for the material. While the Lexicon by its nature assumes the material to be possibly sensitive by default, these label values are intended to signal that a warning should be put on the material even for the explicit Okazu-Diary.org application users who are willing to see mature contents in general.", + "refs": [ + "com.atproto.label.defs#selfLabels" + ] + }, + "record": { + "type": "ref", + "description": "Reference to a record representing the material, such as a Bluesky post.", + "ref": "com.atproto.repo.strongRef" + }, + "tags": { + "type": "array", + "description": "User-specified tags for the material.", + "items": { + "type": "ref", + "ref": "org.okazu-diary.material.defs#tag" + }, + "maxLength": 64 + }, + "thumb": { + "type": "ref", + "description": "Link to a thumbnail of the material, typically taken from the material's HTML metadata.", + "ref": "#thumb" + }, + "title": { + "type": "string", + "description": "Title of the material, typically taken from the material's HTML `` element." + }, + "uri": { + "type": "string", + "description": "URI of the material, typically an HTTP(S) URL. If the URL is of a Web interface for an AT resource (such as a `bsky.app` URL), the record should also include the `record` property referencing the AT resource.", + "format": "uri" + }, + "via": { + "type": "ref", + "description": "Reference to an `org.okazu-diary.feed.material` record from another repository from which this collection item is derived. Clients can use this property to offer the user to update this record if the original record have updated from the referenced version.", + "ref": "com.atproto.repo.strongRef" + } + } + } + }, + "thumb": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "cid": { + "type": "string", + "format": "cid" + }, + "url": { + "type": "string", + "format": "uri" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_deck.json b/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_deck.json new file mode 100644 index 00000000..adc99fb2 --- /dev/null +++ b/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_deck.json @@ -0,0 +1,84 @@ +{ + "lexicon": 1, + "id": "org.stormlightlabs.malfestio.deck", + "defs": { + "main": { + "type": "record", + "description": "A collection of flashcards and sources.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "title", + "createdAt" + ], + "properties": { + "cardRefs": { + "type": "array", + "description": "Ordered list of references to cards in this deck.", + "items": { + "type": "string", + "format": "at-uri" + } + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "description": { + "type": "string", + "description": "Description of the deck context.", + "maxLength": 3000 + }, + "language": { + "type": "string", + "description": "Language code for the deck content (e.g., 'en', 'es', 'fr').", + "maxLength": 20 + }, + "license": { + "type": "string", + "description": "License for the deck content.", + "maxLength": 500 + }, + "sourceRefs": { + "type": "array", + "description": "References to source materials (articles, lectures) used in this deck.", + "items": { + "type": "string", + "format": "at-uri" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "maxLength": 100 + }, + "maxLength": 64 + }, + "title": { + "type": "string", + "description": "Title of the deck.", + "maxLength": 300 + }, + "updatedAt": { + "type": "string", + "description": "Timestamp of last update.", + "format": "datetime" + }, + "visibility": { + "type": "string", + "description": "Visibility setting for the deck.", + "default": "public", + "maxLength": 100, + "knownValues": [ + "private", + "unlisted", + "public" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_thread_comment.json b/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_thread_comment.json new file mode 100644 index 00000000..004e39b9 --- /dev/null +++ b/crates/jacquard-api/lexicons/org_stormlightlabs_malfestio_thread_comment.json @@ -0,0 +1,40 @@ +{ + "lexicon": 1, + "id": "org.stormlightlabs.malfestio.thread.comment", + "defs": { + "main": { + "type": "record", + "description": "A comment on a deck, card, or note.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "subjectRef", + "body", + "createdAt" + ], + "properties": { + "body": { + "type": "string", + "description": "The comment text.", + "maxLength": 5000 + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "replyTo": { + "type": "string", + "description": "The parent comment if this is a reply.", + "format": "at-uri" + }, + "subjectRef": { + "type": "string", + "description": "The root subject being commented on.", + "format": "at-uri" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_branding_deleteBlob.json b/crates/jacquard-api/lexicons/place_stream_branding_deleteBlob.json new file mode 100644 index 00000000..9fc20c38 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_branding_deleteBlob.json @@ -0,0 +1,54 @@ +{ + "lexicon": 1, + "id": "place.stream.branding.deleteBlob", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a branding asset blob. Requires admin authorization.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "broadcaster": { + "type": "string", + "description": "DID of the broadcaster. If not provided, uses the server's default broadcaster.", + "format": "did" + }, + "key": { + "type": "string", + "description": "Branding asset key (mainLogo, favicon, siteTitle, etc.)" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + } + }, + "errors": [ + { + "description": "The authenticated DID is not authorized to modify branding", + "name": "Unauthorized" + }, + { + "description": "The requested branding asset does not exist", + "name": "BrandingNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_branding_getBlob.json b/crates/jacquard-api/lexicons/place_stream_branding_getBlob.json new file mode 100644 index 00000000..fcf298ce --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_branding_getBlob.json @@ -0,0 +1,37 @@ +{ + "lexicon": 1, + "id": "place.stream.branding.getBlob", + "defs": { + "main": { + "type": "query", + "description": "Get a specific branding asset blob by key.", + "parameters": { + "type": "params", + "required": [ + "key" + ], + "properties": { + "broadcaster": { + "type": "string", + "description": "DID of the broadcaster. If not provided, uses the server's default broadcaster.", + "format": "did" + }, + "key": { + "type": "string", + "description": "Branding asset key (mainLogo, favicon, siteTitle, etc.)" + } + } + }, + "output": { + "description": "Raw blob data with appropriate content-type", + "encoding": "*/*" + }, + "errors": [ + { + "description": "The requested branding asset does not exist", + "name": "BrandingNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_branding_getBranding.json b/crates/jacquard-api/lexicons/place_stream_branding_getBranding.json new file mode 100644 index 00000000..c8c5915e --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_branding_getBranding.json @@ -0,0 +1,74 @@ +{ + "lexicon": 1, + "id": "place.stream.branding.getBranding", + "defs": { + "brandingAsset": { + "type": "object", + "required": [ + "key", + "mimeType" + ], + "properties": { + "data": { + "type": "string", + "description": "Inline data for text assets" + }, + "height": { + "type": "integer", + "description": "Image height in pixels (optional, for images only)" + }, + "key": { + "type": "string", + "description": "Asset key identifier" + }, + "mimeType": { + "type": "string", + "description": "MIME type of the asset" + }, + "url": { + "type": "string", + "description": "URL to fetch the asset blob (for images)" + }, + "width": { + "type": "integer", + "description": "Image width in pixels (optional, for images only)" + } + } + }, + "main": { + "type": "query", + "description": "Get all branding configuration for the broadcaster.", + "parameters": { + "type": "params", + "required": [], + "properties": { + "broadcaster": { + "type": "string", + "description": "DID of the broadcaster. If not provided, uses the server's default broadcaster.", + "format": "did" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "assets" + ], + "properties": { + "assets": { + "type": "array", + "description": "List of available branding assets", + "items": { + "type": "ref", + "ref": "#brandingAsset" + } + } + } + } + }, + "errors": [] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_branding_updateBlob.json b/crates/jacquard-api/lexicons/place_stream_branding_updateBlob.json new file mode 100644 index 00000000..3b86d8dc --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_branding_updateBlob.json @@ -0,0 +1,72 @@ +{ + "lexicon": 1, + "id": "place.stream.branding.updateBlob", + "defs": { + "main": { + "type": "procedure", + "description": "Update or create a branding asset blob. Requires admin authorization.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "key", + "data", + "mimeType" + ], + "properties": { + "broadcaster": { + "type": "string", + "description": "DID of the broadcaster. If not provided, uses the server's default broadcaster.", + "format": "did" + }, + "data": { + "type": "string", + "description": "Base64-encoded blob data" + }, + "height": { + "type": "integer", + "description": "Image height in pixels (optional, for images only)" + }, + "key": { + "type": "string", + "description": "Branding asset key (mainLogo, favicon, siteTitle, etc.)" + }, + "mimeType": { + "type": "string", + "description": "MIME type of the blob (e.g., image/png, text/plain)" + }, + "width": { + "type": "integer", + "description": "Image width in pixels (optional, for images only)" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + } + }, + "errors": [ + { + "description": "The authenticated DID is not authorized to modify branding", + "name": "Unauthorized" + }, + { + "description": "The blob exceeds the maximum size limit", + "name": "BlobTooLarge" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_broadcast_getBroadcaster.json b/crates/jacquard-api/lexicons/place_stream_broadcast_getBroadcaster.json index a307f0ac..e5cd1e1e 100644 --- a/crates/jacquard-api/lexicons/place_stream_broadcast_getBroadcaster.json +++ b/crates/jacquard-api/lexicons/place_stream_broadcast_getBroadcaster.json @@ -7,7 +7,6 @@ "description": "Get information about a Streamplace broadcaster.", "parameters": { "type": "params", - "required": [], "properties": {} }, "output": { @@ -18,6 +17,14 @@ "broadcaster" ], "properties": { + "admins": { + "type": "array", + "description": "Array of DIDs authorized as admins", + "items": { + "type": "string", + "format": "did" + } + }, "broadcaster": { "type": "string", "description": "DID of the Streamplace broadcaster to which this server belongs", @@ -30,8 +37,7 @@ } } } - }, - "errors": [] + } } } } \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_createBlock.json b/crates/jacquard-api/lexicons/place_stream_moderation_createBlock.json new file mode 100644 index 00000000..eac11a74 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_createBlock.json @@ -0,0 +1,73 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.createBlock", + "defs": { + "main": { + "type": "procedure", + "description": "Create a block (ban) on behalf of a streamer. Requires 'ban' permission. Creates an app.bsky.graph.block record in the streamer's repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "streamer", + "subject" + ], + "properties": { + "reason": { + "type": "string", + "description": "Optional reason for the block.", + "maxLength": 300 + }, + "streamer": { + "type": "string", + "description": "The DID of the streamer whose chat this block applies to.", + "format": "did" + }, + "subject": { + "type": "string", + "description": "The DID of the user being blocked from chat.", + "format": "did" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "uri", + "cid" + ], + "properties": { + "cid": { + "type": "string", + "description": "The CID of the created block record.", + "format": "cid" + }, + "uri": { + "type": "string", + "description": "The AT-URI of the created block record.", + "format": "at-uri" + } + } + } + }, + "errors": [ + { + "description": "The request lacks valid authentication credentials.", + "name": "Unauthorized" + }, + { + "description": "The caller does not have permission to create blocks for this streamer.", + "name": "Forbidden" + }, + { + "description": "The streamer's OAuth session could not be found or is invalid.", + "name": "SessionNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_createGate.json b/crates/jacquard-api/lexicons/place_stream_moderation_createGate.json new file mode 100644 index 00000000..ad0dd971 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_createGate.json @@ -0,0 +1,68 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.createGate", + "defs": { + "main": { + "type": "procedure", + "description": "Create a gate (hide message) on behalf of a streamer. Requires 'hide' permission. Creates a place.stream.chat.gate record in the streamer's repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "streamer", + "messageUri" + ], + "properties": { + "messageUri": { + "type": "string", + "description": "The AT-URI of the chat message to hide.", + "format": "at-uri" + }, + "streamer": { + "type": "string", + "description": "The DID of the streamer.", + "format": "did" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "uri", + "cid" + ], + "properties": { + "cid": { + "type": "string", + "description": "The CID of the created gate record.", + "format": "cid" + }, + "uri": { + "type": "string", + "description": "The AT-URI of the created gate record.", + "format": "at-uri" + } + } + } + }, + "errors": [ + { + "description": "The request lacks valid authentication credentials.", + "name": "Unauthorized" + }, + { + "description": "The caller does not have permission to hide messages for this streamer.", + "name": "Forbidden" + }, + { + "description": "The streamer's OAuth session could not be found or is invalid.", + "name": "SessionNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_defs.json b/crates/jacquard-api/lexicons/place_stream_moderation_defs.json new file mode 100644 index 00000000..7f4f2f5f --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_defs.json @@ -0,0 +1,36 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.defs", + "defs": { + "permissionView": { + "type": "object", + "required": [ + "uri", + "cid", + "author", + "record" + ], + "properties": { + "author": { + "type": "ref", + "description": "The streamer who granted these permissions", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "Content identifier of the permission record", + "format": "cid" + }, + "record": { + "type": "unknown", + "description": "The permission record itself" + }, + "uri": { + "type": "string", + "description": "AT-URI of the permission record", + "format": "at-uri" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_deleteBlock.json b/crates/jacquard-api/lexicons/place_stream_moderation_deleteBlock.json new file mode 100644 index 00000000..902e082f --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_deleteBlock.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.deleteBlock", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a block (unban) on behalf of a streamer. Requires 'ban' permission. Deletes an app.bsky.graph.block record from the streamer's repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "streamer", + "blockUri" + ], + "properties": { + "blockUri": { + "type": "string", + "description": "The AT-URI of the block record to delete.", + "format": "at-uri" + }, + "streamer": { + "type": "string", + "description": "The DID of the streamer.", + "format": "did" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": {} + } + }, + "errors": [ + { + "description": "The request lacks valid authentication credentials.", + "name": "Unauthorized" + }, + { + "description": "The caller does not have permission to delete blocks for this streamer.", + "name": "Forbidden" + }, + { + "description": "The streamer's OAuth session could not be found or is invalid.", + "name": "SessionNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_deleteGate.json b/crates/jacquard-api/lexicons/place_stream_moderation_deleteGate.json new file mode 100644 index 00000000..016b3d2b --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_deleteGate.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.deleteGate", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a gate (unhide message) on behalf of a streamer. Requires 'hide' permission. Deletes a place.stream.chat.gate record from the streamer's repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "streamer", + "gateUri" + ], + "properties": { + "gateUri": { + "type": "string", + "description": "The AT-URI of the gate record to delete.", + "format": "at-uri" + }, + "streamer": { + "type": "string", + "description": "The DID of the streamer.", + "format": "did" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": {} + } + }, + "errors": [ + { + "description": "The request lacks valid authentication credentials.", + "name": "Unauthorized" + }, + { + "description": "The caller does not have permission to unhide messages for this streamer.", + "name": "Forbidden" + }, + { + "description": "The streamer's OAuth session could not be found or is invalid.", + "name": "SessionNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_permission.json b/crates/jacquard-api/lexicons/place_stream_moderation_permission.json new file mode 100644 index 00000000..4a1f5a18 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_permission.json @@ -0,0 +1,48 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.permission", + "defs": { + "main": { + "type": "record", + "description": "Record granting moderation permissions to a user for this streamer's content.", + "key": "tid", + "record": { + "type": "object", + "required": [ + "moderator", + "permissions", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "Client-declared timestamp when this moderator was added.", + "format": "datetime" + }, + "expirationTime": { + "type": "string", + "description": "Optional expiration time for this delegation. If set, the delegation is invalid after this time.", + "format": "datetime" + }, + "moderator": { + "type": "string", + "description": "The DID of the user granted moderator permissions.", + "format": "did" + }, + "permissions": { + "type": "array", + "description": "Array of permissions granted to this moderator. 'ban' covers blocks/bans (with optional expiration), 'hide' covers message gates, 'livestream.manage' allows updating livestream metadata.", + "items": { + "type": "string", + "enum": [ + "ban", + "hide", + "livestream.manage" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_moderation_updateLivestream.json b/crates/jacquard-api/lexicons/place_stream_moderation_updateLivestream.json new file mode 100644 index 00000000..00da97aa --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_moderation_updateLivestream.json @@ -0,0 +1,78 @@ +{ + "lexicon": 1, + "id": "place.stream.moderation.updateLivestream", + "defs": { + "main": { + "type": "procedure", + "description": "Update livestream metadata on behalf of a streamer. Requires 'livestream.manage' permission. Updates a place.stream.livestream record in the streamer's repository.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "streamer", + "livestreamUri" + ], + "properties": { + "livestreamUri": { + "type": "string", + "description": "The AT-URI of the livestream record to update.", + "format": "at-uri" + }, + "streamer": { + "type": "string", + "description": "The DID of the streamer.", + "format": "did" + }, + "title": { + "type": "string", + "description": "New title for the livestream.", + "maxLength": 1400, + "maxGraphemes": 140 + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "uri", + "cid" + ], + "properties": { + "cid": { + "type": "string", + "description": "The CID of the updated livestream record.", + "format": "cid" + }, + "uri": { + "type": "string", + "description": "The AT-URI of the updated livestream record.", + "format": "at-uri" + } + } + } + }, + "errors": [ + { + "description": "The request lacks valid authentication credentials.", + "name": "Unauthorized" + }, + { + "description": "The caller does not have permission to update livestream metadata for this streamer.", + "name": "Forbidden" + }, + { + "description": "The streamer's OAuth session could not be found or is invalid.", + "name": "SessionNotFound" + }, + { + "description": "The specified livestream record does not exist.", + "name": "RecordNotFound" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_createTarget.json b/crates/jacquard-api/lexicons/place_stream_multistream_createTarget.json new file mode 100644 index 00000000..57497a6a --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_createTarget.json @@ -0,0 +1,38 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.createTarget", + "defs": { + "main": { + "type": "procedure", + "description": "Create a new target for rebroadcasting a Streamplace stream.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "multistreamTarget" + ], + "properties": { + "multistreamTarget": { + "type": "ref", + "ref": "place.stream.multistream.target" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "place.stream.multistream.defs#targetView" + } + }, + "errors": [ + { + "description": "The provided target URL is invalid or unreachable.", + "name": "InvalidTargetUrl" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_defs.json b/crates/jacquard-api/lexicons/place_stream_multistream_defs.json new file mode 100644 index 00000000..e0dcee11 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_defs.json @@ -0,0 +1,57 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.defs", + "defs": { + "event": { + "type": "object", + "required": [ + "message", + "status", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "message": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "inactive", + "pending", + "active", + "error" + ] + } + } + }, + "targetView": { + "type": "object", + "required": [ + "uri", + "cid", + "record" + ], + "properties": { + "cid": { + "type": "string", + "format": "cid" + }, + "latestEvent": { + "type": "ref", + "ref": "place.stream.multistream.defs#event" + }, + "record": { + "type": "unknown" + }, + "uri": { + "type": "string", + "format": "at-uri" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_deleteTarget.json b/crates/jacquard-api/lexicons/place_stream_multistream_deleteTarget.json new file mode 100644 index 00000000..260063b9 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_deleteTarget.json @@ -0,0 +1,34 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.deleteTarget", + "defs": { + "main": { + "type": "procedure", + "description": "Delete a target for rebroadcasting a Streamplace stream.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "rkey" + ], + "properties": { + "rkey": { + "type": "string", + "description": "The Record Key of the target to delete.", + "format": "record-key" + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "properties": {} + } + }, + "errors": [] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_listTargets.json b/crates/jacquard-api/lexicons/place_stream_multistream_listTargets.json new file mode 100644 index 00000000..b04089de --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_listTargets.json @@ -0,0 +1,68 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.listTargets", + "defs": { + "main": { + "type": "query", + "description": "List a range of targets for rebroadcasting a Streamplace stream.", + "parameters": { + "type": "params", + "required": [], + "properties": { + "cursor": { + "type": "string" + }, + "limit": { + "type": "integer", + "description": "The number of targets to return.", + "default": 50, + "minimum": 1, + "maximum": 100 + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "targets" + ], + "properties": { + "cursor": { + "type": "string" + }, + "targets": { + "type": "array", + "items": { + "type": "ref", + "ref": "place.stream.multistream.defs#targetView" + } + } + } + } + } + }, + "record": { + "type": "object", + "required": [ + "uri", + "cid", + "value" + ], + "properties": { + "cid": { + "type": "string", + "format": "cid" + }, + "uri": { + "type": "string", + "format": "at-uri" + }, + "value": { + "type": "unknown" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_putTarget.json b/crates/jacquard-api/lexicons/place_stream_multistream_putTarget.json new file mode 100644 index 00000000..a4bd219d --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_putTarget.json @@ -0,0 +1,44 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.putTarget", + "defs": { + "main": { + "type": "procedure", + "description": "Update an existing target for rebroadcasting a Streamplace stream.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "multistreamTarget" + ], + "properties": { + "multistreamTarget": { + "type": "ref", + "ref": "place.stream.multistream.target" + }, + "rkey": { + "type": "string", + "description": "The Record Key.", + "format": "record-key", + "maxLength": 512 + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "place.stream.multistream.defs#targetView" + } + }, + "errors": [ + { + "description": "The provided target URL is invalid or unreachable.", + "name": "InvalidTargetUrl" + } + ] + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/place_stream_multistream_target.json b/crates/jacquard-api/lexicons/place_stream_multistream_target.json new file mode 100644 index 00000000..b9f031d4 --- /dev/null +++ b/crates/jacquard-api/lexicons/place_stream_multistream_target.json @@ -0,0 +1,40 @@ +{ + "lexicon": 1, + "id": "place.stream.multistream.target", + "defs": { + "main": { + "type": "record", + "description": "An external server for rebroadcasting a Streamplace stream", + "key": "tid", + "record": { + "type": "object", + "required": [ + "url", + "active", + "createdAt" + ], + "properties": { + "active": { + "type": "boolean", + "description": "Whether this target is currently active." + }, + "createdAt": { + "type": "string", + "description": "When this target was created.", + "format": "datetime" + }, + "name": { + "type": "string", + "description": "A user-friendly name for this target.", + "maxLength": 100 + }, + "url": { + "type": "string", + "description": "The rtmp:// or rtmps:// url of the target server.", + "format": "uri" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/pub_leaflet_blocks_text.json b/crates/jacquard-api/lexicons/pub_leaflet_blocks_text.json index 501a3985..773e00f8 100644 --- a/crates/jacquard-api/lexicons/pub_leaflet_blocks_text.json +++ b/crates/jacquard-api/lexicons/pub_leaflet_blocks_text.json @@ -17,6 +17,14 @@ }, "plaintext": { "type": "string" + }, + "textSize": { + "type": "string", + "enum": [ + "default", + "small", + "large" + ] } } } diff --git a/crates/jacquard-api/lexicons/pub_leaflet_publication.json b/crates/jacquard-api/lexicons/pub_leaflet_publication.json index de5a997f..ce2237d4 100644 --- a/crates/jacquard-api/lexicons/pub_leaflet_publication.json +++ b/crates/jacquard-api/lexicons/pub_leaflet_publication.json @@ -89,6 +89,11 @@ "pub.leaflet.theme.color#rgb" ] }, + "pageWidth": { + "type": "integer", + "minimum": 0, + "maximum": 1600 + }, "primary": { "type": "union", "refs": [ diff --git a/crates/jacquard-api/lexicons/sh_tangled_repo_pull.json b/crates/jacquard-api/lexicons/sh_tangled_repo_pull.json index ea849df1..05661c19 100644 --- a/crates/jacquard-api/lexicons/sh_tangled_repo_pull.json +++ b/crates/jacquard-api/lexicons/sh_tangled_repo_pull.json @@ -10,7 +10,7 @@ "required": [ "target", "title", - "patch", + "patchBlob", "createdAt" ], "properties": { @@ -29,7 +29,15 @@ } }, "patch": { - "type": "string" + "type": "string", + "description": "(deprecated) use patchBlob instead" + }, + "patchBlob": { + "type": "blob", + "description": "patch content", + "accept": [ + "text/x-patch" + ] }, "references": { "type": "array", diff --git a/crates/jacquard-api/lexicons/site_standard_document.json b/crates/jacquard-api/lexicons/site_standard_document.json index bbb9f881..14c25683 100644 --- a/crates/jacquard-api/lexicons/site_standard_document.json +++ b/crates/jacquard-api/lexicons/site_standard_document.json @@ -4,6 +4,7 @@ "defs": { "main": { "type": "record", + "description": "A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently.", "key": "tid", "record": { "type": "object", @@ -15,18 +16,18 @@ "properties": { "bskyPostRef": { "type": "ref", + "description": "Strong reference to a Bluesky post. Useful to keep track of comments off-platform.", "ref": "com.atproto.repo.strongRef" }, "content": { - "type": "array", - "items": { - "type": "union", - "refs": [], - "closed": false - } + "type": "union", + "description": "Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats.", + "refs": [], + "closed": false }, "coverImage": { "type": "blob", + "description": "Image to used for thumbnail or cover image. Less than 1MB is size.", "accept": [ "image/*" ], @@ -34,24 +35,27 @@ }, "description": { "type": "string", + "description": "A brief description or excerpt from the document.", "maxLength": 3000, "maxGraphemes": 300 }, "path": { "type": "string", - "description": "combine with the publication url or the document site to construct a full url to the document" + "description": "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash." }, "publishedAt": { "type": "string", + "description": "Timestamp of the documents publish time.", "format": "datetime" }, "site": { "type": "string", - "description": "URI to the site or publication this document belongs to (https or at-uri)", + "description": "Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes.", "format": "uri" }, "tags": { "type": "array", + "description": "Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags.", "items": { "type": "string", "maxLength": 100, @@ -59,15 +63,18 @@ } }, "textContent": { - "type": "string" + "type": "string", + "description": "Plaintext representation of the documents contents. Should not contain markdown or other formatting." }, "title": { "type": "string", + "description": "Title of the document.", "maxLength": 1280, "maxGraphemes": 128 }, "updatedAt": { "type": "string", + "description": "Timestamp of the documents last edit.", "format": "datetime" } } diff --git a/crates/jacquard-api/lexicons/site_standard_graph_subscription.json b/crates/jacquard-api/lexicons/site_standard_graph_subscription.json index 0aa92868..6099f156 100644 --- a/crates/jacquard-api/lexicons/site_standard_graph_subscription.json +++ b/crates/jacquard-api/lexicons/site_standard_graph_subscription.json @@ -14,6 +14,7 @@ "properties": { "publication": { "type": "string", + "description": "AT-URI reference to the publication record being subscribed to (ex: at://did:plc:abc123/site.standard.publication/xyz789).", "format": "at-uri" } } diff --git a/crates/jacquard-api/lexicons/site_standard_publication.json b/crates/jacquard-api/lexicons/site_standard_publication.json index 44880169..dbc74057 100644 --- a/crates/jacquard-api/lexicons/site_standard_publication.json +++ b/crates/jacquard-api/lexicons/site_standard_publication.json @@ -4,6 +4,7 @@ "defs": { "main": { "type": "record", + "description": "A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings.", "key": "tid", "record": { "type": "object", @@ -14,15 +15,18 @@ "properties": { "basicTheme": { "type": "ref", + "description": "Simplified publication theme for tools and apps to utilize when displaying content.", "ref": "site.standard.theme.basic" }, "description": { "type": "string", + "description": "Brief description of the publication.", "maxLength": 3000, "maxGraphemes": 300 }, "icon": { "type": "blob", + "description": "Square image to identify the publication. Should be at least 256x256.", "accept": [ "image/*" ], @@ -30,15 +34,18 @@ }, "name": { "type": "string", + "description": "Name of the publication.", "maxLength": 1280, "maxGraphemes": 128 }, "preferences": { "type": "ref", + "description": "Object containing platform specific preferences (with a few shared properties).", "ref": "#preferences" }, "url": { "type": "string", + "description": "Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path.", "format": "uri" } } @@ -46,9 +53,11 @@ }, "preferences": { "type": "object", + "description": "Platform-specific preferences for the publication, including discovery and visibility settings.", "properties": { "showInDiscover": { "type": "boolean", + "description": "Boolean which decides whether the publication should appear in discovery feeds.", "default": true } } diff --git a/crates/jacquard-api/lexicons/site_standard_theme_basic.json b/crates/jacquard-api/lexicons/site_standard_theme_basic.json index 771f1abc..5a2c3749 100644 --- a/crates/jacquard-api/lexicons/site_standard_theme_basic.json +++ b/crates/jacquard-api/lexicons/site_standard_theme_basic.json @@ -4,6 +4,7 @@ "defs": { "main": { "type": "object", + "description": "A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications.", "required": [ "background", "foreground", @@ -13,24 +14,28 @@ "properties": { "accent": { "type": "union", + "description": "Color used for links and button backgrounds.", "refs": [ "site.standard.theme.color#rgb" ] }, "accentForeground": { "type": "union", + "description": "Color used for button text.", "refs": [ "site.standard.theme.color#rgb" ] }, "background": { "type": "union", + "description": "Color used for content background.", "refs": [ "site.standard.theme.color#rgb" ] }, "foreground": { "type": "union", + "description": "Color used for content text.", "refs": [ "site.standard.theme.color#rgb" ] diff --git a/crates/jacquard-api/lexicons/social_pace_daily_ring.json b/crates/jacquard-api/lexicons/social_pace_daily_ring.json new file mode 100644 index 00000000..3a18df79 --- /dev/null +++ b/crates/jacquard-api/lexicons/social_pace_daily_ring.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "social.pace.daily.ring", + "defs": { + "main": { + "type": "record", + "description": "A record of daily activity rings (Apple Fitness), including move, exercise, and stand goals.", + "key": "any", + "record": { + "type": "object", + "required": [ + "move", + "moveGoal", + "exercise", + "exerciseGoal", + "standHours", + "standGoal", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "exercise": { + "type": "integer", + "description": "The total minutes of exercise completed." + }, + "exerciseGoal": { + "type": "integer", + "description": "The daily exercise goal in minutes." + }, + "move": { + "type": "integer", + "description": "The total active calories burned for the day." + }, + "moveGoal": { + "type": "integer", + "description": "The daily move goal in calories." + }, + "standGoal": { + "type": "integer", + "description": "The daily stand goal in hours." + }, + "standHours": { + "type": "integer", + "description": "The number of hours the user stood up and moved around." + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/social_pace_daily_step.json b/crates/jacquard-api/lexicons/social_pace_daily_step.json new file mode 100644 index 00000000..44411c29 --- /dev/null +++ b/crates/jacquard-api/lexicons/social_pace_daily_step.json @@ -0,0 +1,35 @@ +{ + "lexicon": 1, + "id": "social.pace.daily.step", + "defs": { + "main": { + "type": "record", + "description": "A daily recording of your steps for that day. This record is expected to be update throughout the day and represent's 12am-12pm in your timezone, or what you count as a \"day\". The key is also traditionally the date of your \"day\" yyy-mm-dd.", + "key": "any", + "record": { + "type": "object", + "required": [ + "steps", + "createdAt", + "updatedAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "The first time this record was created", + "format": "datetime" + }, + "steps": { + "type": "integer", + "description": "The number of steps taken during the day" + }, + "updatedAt": { + "type": "string", + "description": "The last time this record was updated", + "format": "datetime" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/social_tophhie_profile.json b/crates/jacquard-api/lexicons/social_tophhie_profile.json new file mode 100644 index 00000000..679e8044 --- /dev/null +++ b/crates/jacquard-api/lexicons/social_tophhie_profile.json @@ -0,0 +1,70 @@ +{ + "lexicon": 1, + "id": "social.tophhie.profile", + "revision": 0, + "description": "Tophhie Social: profile record containing various PDS specific settings.", + "defs": { + "communicationPreferences": { + "type": "object", + "description": "Granular communication consent flags.", + "required": [ + "marketing" + ], + "properties": { + "marketing": { + "type": "boolean", + "description": "True if the user consents to receive marketing communications." + } + } + }, + "main": { + "type": "record", + "key": "literal:self", + "record": { + "type": "object", + "description": "Tophhie profile record", + "required": [ + "createdAt", + "communicationPreferences" + ], + "properties": { + "communicationPreferences": { + "type": "ref", + "description": "User's opt-in/out preferences for communications.", + "ref": "#communicationPreferences" + }, + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when this profile record was created.", + "format": "datetime" + }, + "pdsPreferences": { + "type": "ref", + "description": "User's opt-in/out preferences for PDS features.", + "ref": "#pdsPreferences" + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp when this profile record was updated.", + "format": "datetime" + } + } + } + }, + "pdsPreferences": { + "type": "object", + "description": "Granular PDS preference consent flags.", + "required": [], + "properties": { + "accessibilityScoring": { + "type": "boolean", + "description": "True if the user participates in accessibility scoring." + }, + "showOnHomepage": { + "type": "boolean", + "description": "True if the user is shown on the Tophhie Social homepage." + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collection.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collection.json new file mode 100644 index 00000000..d8d320bc --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collection.json @@ -0,0 +1,42 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.collection", + "defs": { + "main": { + "type": "record", + "description": "A collection to organize drawings into folders", + "key": "tid", + "record": { + "type": "object", + "required": [ + "name", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "description": { + "type": "string", + "description": "Collection description", + "maxLength": 500, + "maxGraphemes": 200 + }, + "isPublic": { + "type": "boolean", + "description": "Whether the collection is publicly visible", + "default": true + }, + "name": { + "type": "string", + "description": "Collection name", + "minLength": 1, + "maxLength": 100, + "maxGraphemes": 50 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collectionItem.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collectionItem.json new file mode 100644 index 00000000..1f0ef63c --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_collectionItem.json @@ -0,0 +1,40 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.collectionItem", + "defs": { + "main": { + "type": "record", + "description": "An item in a collection linking to a post", + "key": "tid", + "record": { + "type": "object", + "required": [ + "collection", + "post", + "createdAt" + ], + "properties": { + "collection": { + "type": "ref", + "description": "Reference to the collection", + "ref": "com.atproto.repo.strongRef" + }, + "createdAt": { + "type": "string", + "format": "datetime" + }, + "order": { + "type": "integer", + "description": "Order within the collection", + "minimum": 0 + }, + "post": { + "type": "ref", + "description": "Reference to the post", + "ref": "com.atproto.repo.strongRef" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_defs.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_defs.json new file mode 100644 index 00000000..35a98a1f --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_defs.json @@ -0,0 +1,367 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.defs", + "defs": { + "aspectRatio": { + "type": "object", + "description": "Width and height representing the aspect ratio of an image", + "required": [ + "width", + "height" + ], + "properties": { + "height": { + "type": "integer", + "description": "Height component of aspect ratio", + "minimum": 1 + }, + "width": { + "type": "integer", + "description": "Width component of aspect ratio", + "minimum": 1 + } + } + }, + "collectionView": { + "type": "object", + "description": "A view of a collection with author profile and item count", + "required": [ + "uri", + "cid", + "author", + "name", + "createdAt" + ], + "properties": { + "author": { + "type": "ref", + "description": "Collection owner profile", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "CID of the collection record", + "format": "cid" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the collection was created", + "format": "datetime" + }, + "description": { + "type": "string", + "description": "Collection description", + "maxLength": 500, + "maxGraphemes": 200 + }, + "indexedAt": { + "type": "string", + "description": "Timestamp when the collection was indexed", + "format": "datetime" + }, + "isPublic": { + "type": "boolean", + "description": "Whether the collection is publicly visible", + "default": true + }, + "itemCount": { + "type": "integer", + "description": "Number of items in the collection" + }, + "name": { + "type": "string", + "description": "Collection name", + "maxLength": 100, + "maxGraphemes": 50 + }, + "uri": { + "type": "string", + "description": "AT-URI of the collection record", + "format": "at-uri" + } + } + }, + "postView": { + "type": "object", + "description": "A view of a drawing post with author profile and metadata", + "required": [ + "uri", + "cid", + "author", + "image", + "aspectRatio", + "createdAt" + ], + "properties": { + "aspectRatio": { + "type": "ref", + "description": "Aspect ratio of the image", + "ref": "#aspectRatio" + }, + "author": { + "type": "ref", + "description": "Author profile", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "CID of the post record", + "format": "cid" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the post was created", + "format": "datetime" + }, + "image": { + "type": "string", + "description": "URL of the drawing image", + "format": "uri" + }, + "indexedAt": { + "type": "string", + "description": "Timestamp when the post was indexed", + "format": "datetime" + }, + "linkedPost": { + "type": "ref", + "description": "Reference to linked Bluesky post", + "ref": "com.atproto.repo.strongRef" + }, + "reactionCounts": { + "type": "ref", + "description": "Counts of each reaction type", + "ref": "#reactionCounts" + }, + "tags": { + "type": "array", + "description": "Tags for categorization", + "items": { + "type": "string", + "maxLength": 64, + "maxGraphemes": 32 + }, + "maxLength": 8 + }, + "text": { + "type": "string", + "description": "Optional description or title", + "maxLength": 1000, + "maxGraphemes": 300 + }, + "uri": { + "type": "string", + "description": "AT-URI of the post record", + "format": "at-uri" + }, + "viewerReaction": { + "type": "ref", + "description": "Current user's reaction to this post", + "ref": "#reactionType" + } + } + }, + "reactionCounts": { + "type": "object", + "description": "Counts of each reaction type on a post", + "properties": { + "kami": { + "type": "integer", + "description": "Count of kami (godly) reactions", + "default": 0 + }, + "kawaii": { + "type": "integer", + "description": "Count of kawaii (cute) reactions", + "default": 0 + }, + "sugoi": { + "type": "integer", + "description": "Count of sugoi (amazing) reactions", + "default": 0 + }, + "suki": { + "type": "integer", + "description": "Count of suki (like) reactions", + "default": 0 + }, + "tasukaru": { + "type": "integer", + "description": "Count of tasukaru (helpful) reactions", + "default": 0 + } + } + }, + "reactionType": { + "type": "string", + "description": "Type of reaction to a post", + "knownValues": [ + "suki", + "tasukaru", + "sugoi", + "kawaii", + "kami" + ] + }, + "replyView": { + "type": "object", + "description": "A view of a Bluesky reply to a linked post", + "required": [ + "uri", + "cid", + "author", + "text", + "createdAt" + ], + "properties": { + "author": { + "type": "ref", + "description": "Reply author profile", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "CID of the Bluesky reply", + "format": "cid" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the reply was created", + "format": "datetime" + }, + "text": { + "type": "string", + "description": "Reply text content", + "maxLength": 3000, + "maxGraphemes": 300 + }, + "uri": { + "type": "string", + "description": "AT-URI of the Bluesky reply", + "format": "at-uri" + } + } + }, + "requestResponseView": { + "type": "object", + "description": "A view of a response to a drawing request", + "required": [ + "uri", + "cid", + "author", + "post", + "createdAt" + ], + "properties": { + "author": { + "type": "ref", + "description": "Response author profile", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "CID of the response record", + "format": "cid" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the response was created", + "format": "datetime" + }, + "message": { + "type": "string", + "description": "Optional message to the requester", + "maxLength": 500, + "maxGraphemes": 150 + }, + "post": { + "type": "ref", + "description": "The drawing post submitted as response", + "ref": "#postView" + }, + "uri": { + "type": "string", + "description": "AT-URI of the response record", + "format": "at-uri" + } + } + }, + "requestView": { + "type": "object", + "description": "A view of a drawing request with author profile and response count", + "required": [ + "uri", + "cid", + "author", + "text", + "isOpen", + "createdAt" + ], + "properties": { + "author": { + "type": "ref", + "description": "Request author profile", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "cid": { + "type": "string", + "description": "CID of the request record", + "format": "cid" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the request was created", + "format": "datetime" + }, + "indexedAt": { + "type": "string", + "description": "Timestamp when the request was indexed", + "format": "datetime" + }, + "isOpen": { + "type": "boolean", + "description": "Whether the request is still accepting responses" + }, + "referenceImages": { + "type": "array", + "description": "URLs of reference images for the request", + "items": { + "type": "string", + "format": "uri" + }, + "maxLength": 4 + }, + "responseCount": { + "type": "integer", + "description": "Number of responses to this request" + }, + "tags": { + "type": "array", + "description": "Tags for categorization", + "items": { + "type": "string", + "maxLength": 64, + "maxGraphemes": 32 + }, + "maxLength": 8 + }, + "targetActor": { + "type": "ref", + "description": "Specific artist the request is directed to", + "ref": "app.bsky.actor.defs#profileViewBasic" + }, + "text": { + "type": "string", + "description": "Description of what to draw", + "maxLength": 1000, + "maxGraphemes": 300 + }, + "uri": { + "type": "string", + "description": "AT-URI of the request record", + "format": "at-uri" + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_post.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_post.json new file mode 100644 index 00000000..3d001b52 --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_post.json @@ -0,0 +1,66 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.post", + "defs": { + "main": { + "type": "record", + "description": "A drawing post created with the drawing tool", + "key": "tid", + "record": { + "type": "object", + "required": [ + "image", + "aspectRatio", + "createdAt" + ], + "properties": { + "aspectRatio": { + "type": "ref", + "description": "Aspect ratio of the image", + "ref": "tech.tokimeki.kaku.defs#aspectRatio" + }, + "createdAt": { + "type": "string", + "description": "Timestamp when the post was created", + "format": "datetime" + }, + "image": { + "type": "blob", + "description": "The drawn image (max 1MB)", + "accept": [ + "image/png", + "image/jpeg" + ], + "maxSize": 1000000 + }, + "linkedPost": { + "type": "ref", + "description": "Bluesky post created for this drawing", + "ref": "com.atproto.repo.strongRef" + }, + "subject": { + "type": "ref", + "description": "Reference to a related Bluesky post", + "ref": "com.atproto.repo.strongRef" + }, + "tags": { + "type": "array", + "description": "Tags for categorization", + "items": { + "type": "string", + "maxLength": 64, + "maxGraphemes": 32 + }, + "maxLength": 8 + }, + "text": { + "type": "string", + "description": "Optional description or title", + "maxLength": 1000, + "maxGraphemes": 300 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_reaction.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_reaction.json new file mode 100644 index 00000000..90bb67f6 --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_reaction.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.reaction", + "defs": { + "main": { + "type": "record", + "description": "A reaction to a post", + "key": "any", + "record": { + "type": "object", + "required": [ + "subject", + "type", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "subject": { + "type": "ref", + "description": "Reference to the post being reacted to", + "ref": "com.atproto.repo.strongRef" + }, + "type": { + "type": "string", + "description": "Type of reaction", + "knownValues": [ + "suki", + "tasukaru", + "sugoi", + "kawaii", + "kami" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_request.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_request.json new file mode 100644 index 00000000..59262f7e --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_request.json @@ -0,0 +1,62 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.request", + "defs": { + "main": { + "type": "record", + "description": "A request for someone to draw something", + "key": "tid", + "record": { + "type": "object", + "required": [ + "text", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "isOpen": { + "type": "boolean", + "description": "Whether still accepting responses", + "default": true + }, + "referenceImages": { + "type": "array", + "description": "Reference images for the request", + "items": { + "type": "blob", + "accept": [ + "image/png", + "image/jpeg" + ], + "maxSize": 1000000 + }, + "maxLength": 4 + }, + "tags": { + "type": "array", + "description": "Tags for categorization", + "items": { + "type": "string", + "maxLength": 64 + }, + "maxLength": 8 + }, + "targetActor": { + "type": "string", + "description": "Optional: specific artist to request", + "format": "did" + }, + "text": { + "type": "string", + "description": "Description of what to draw", + "maxLength": 1000, + "maxGraphemes": 300 + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_requestResponse.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_requestResponse.json new file mode 100644 index 00000000..a3f9ad06 --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_requestResponse.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.requestResponse", + "defs": { + "main": { + "type": "record", + "description": "A post created in response to a request", + "key": "tid", + "record": { + "type": "object", + "required": [ + "request", + "post", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime" + }, + "message": { + "type": "string", + "description": "Optional message to the requester", + "maxLength": 500, + "maxGraphemes": 150 + }, + "post": { + "type": "ref", + "description": "Reference to the post created as response", + "ref": "com.atproto.repo.strongRef" + }, + "request": { + "type": "ref", + "description": "Reference to the request", + "ref": "com.atproto.repo.strongRef" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/tech_tokimeki_kaku_roomGate.json b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_roomGate.json new file mode 100644 index 00000000..cf9e6f62 --- /dev/null +++ b/crates/jacquard-api/lexicons/tech_tokimeki_kaku_roomGate.json @@ -0,0 +1,35 @@ +{ + "lexicon": 1, + "id": "tech.tokimeki.kaku.roomGate", + "defs": { + "main": { + "type": "record", + "description": "Gate settings for a ROOM post (like threadgate)", + "key": "tid", + "record": { + "type": "object", + "required": [ + "room", + "createdAt" + ], + "properties": { + "createdAt": { + "type": "string", + "description": "Timestamp when the gate was created", + "format": "datetime" + }, + "isClosed": { + "type": "boolean", + "description": "Whether the room is closed for new replies", + "default": false + }, + "room": { + "type": "ref", + "description": "Reference to the ROOM post", + "ref": "com.atproto.repo.strongRef" + } + } + } + } + } +} \ No newline at end of file diff --git a/crates/jacquard-api/lexicons/uk_skyblur_post.json b/crates/jacquard-api/lexicons/uk_skyblur_post.json index 00a09eb1..9d408e3c 100644 --- a/crates/jacquard-api/lexicons/uk_skyblur_post.json +++ b/crates/jacquard-api/lexicons/uk_skyblur_post.json @@ -42,12 +42,13 @@ }, "visibility": { "type": "string", - "description": "For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody.", + "description": "For 'login', the post requires login to view (Bluesky account required). For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody.", "maxLength": 100, "maxGraphemes": 10, "enum": [ "public", - "password" + "password", + "login" ] } } diff --git a/crates/jacquard-api/src/app_bsky/actor.rs b/crates/jacquard-api/src/app_bsky/actor.rs index 3b6aff4a..d2b3e908 100644 --- a/crates/jacquard-api/src/app_bsky/actor.rs +++ b/crates/jacquard-api/src/app_bsky/actor.rs @@ -2089,6 +2089,23 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("embed"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -2134,6 +2151,16 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< r#const: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "isDisabled", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { @@ -2159,6 +2186,23 @@ fn lexicon_doc_app_bsky_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< known_values: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); map }, }), @@ -6132,37 +6176,37 @@ pub mod profile_view_detailed_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Handle = Set<members::handle>; - type Did = S::Did; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Handle = S::Handle; type Did = Set<members::did>; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Did = S::Did; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -6616,8 +6660,8 @@ impl<'a, S: profile_view_detailed_state::State> ProfileViewDetailedBuilder<'a, S impl<'a, S> ProfileViewDetailedBuilder<'a, S> where S: profile_view_detailed_state::State, - S::Handle: profile_view_detailed_state::IsSet, S::Did: profile_view_detailed_state::IsSet, + S::Handle: profile_view_detailed_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileViewDetailed<'a> { @@ -6789,67 +6833,67 @@ pub mod saved_feed_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Id; type Value; - type Pinned; + type Id; type Type; + type Pinned; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Id = Unset; type Value = Unset; - type Pinned = Unset; + type Id = Unset; type Type = Unset; - } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { - type Id = Set<members::id>; - type Value = S::Value; - type Pinned = S::Pinned; - type Type = S::Type; + type Pinned = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Id = S::Id; type Value = Set<members::value>; - type Pinned = S::Pinned; + type Id = S::Id; type Type = S::Type; + type Pinned = S::Pinned; } - ///State transition - sets the `pinned` field to Set - pub struct SetPinned<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPinned<S> {} - impl<S: State> State for SetPinned<S> { - type Id = S::Id; + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { type Value = S::Value; - type Pinned = Set<members::pinned>; + type Id = Set<members::id>; type Type = S::Type; + type Pinned = S::Pinned; } ///State transition - sets the `type` field to Set pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetType<S> {} impl<S: State> State for SetType<S> { - type Id = S::Id; type Value = S::Value; - type Pinned = S::Pinned; + type Id = S::Id; type Type = Set<members::r#type>; + type Pinned = S::Pinned; + } + ///State transition - sets the `pinned` field to Set + pub struct SetPinned<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPinned<S> {} + impl<S: State> State for SetPinned<S> { + type Value = S::Value; + type Id = S::Id; + type Type = S::Type; + type Pinned = Set<members::pinned>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `pinned` field - pub struct pinned(()); + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `type` field pub struct r#type(()); + ///Marker type for the `pinned` field + pub struct pinned(()); } } @@ -6962,10 +7006,10 @@ where impl<'a, S> SavedFeedBuilder<'a, S> where S: saved_feed_state::State, - S::Id: saved_feed_state::IsSet, S::Value: saved_feed_state::IsSet, - S::Pinned: saved_feed_state::IsSet, + S::Id: saved_feed_state::IsSet, S::Type: saved_feed_state::IsSet, + S::Pinned: saved_feed_state::IsSet, { /// Build the final struct pub fn build(self) -> SavedFeed<'a> { @@ -7135,37 +7179,37 @@ pub mod saved_feeds_pref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Saved; type Pinned; + type Saved; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Saved = Unset; type Pinned = Unset; - } - ///State transition - sets the `saved` field to Set - pub struct SetSaved<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSaved<S> {} - impl<S: State> State for SetSaved<S> { - type Saved = Set<members::saved>; - type Pinned = S::Pinned; + type Saved = Unset; } ///State transition - sets the `pinned` field to Set pub struct SetPinned<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPinned<S> {} impl<S: State> State for SetPinned<S> { - type Saved = S::Saved; type Pinned = Set<members::pinned>; + type Saved = S::Saved; + } + ///State transition - sets the `saved` field to Set + pub struct SetSaved<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSaved<S> {} + impl<S: State> State for SetSaved<S> { + type Pinned = S::Pinned; + type Saved = Set<members::saved>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `saved` field - pub struct saved(()); ///Marker type for the `pinned` field pub struct pinned(()); + ///Marker type for the `saved` field + pub struct saved(()); } } @@ -7252,8 +7296,8 @@ impl<'a, S: saved_feeds_pref_state::State> SavedFeedsPrefBuilder<'a, S> { impl<'a, S> SavedFeedsPrefBuilder<'a, S> where S: saved_feeds_pref_state::State, - S::Saved: saved_feeds_pref_state::IsSet, S::Pinned: saved_feeds_pref_state::IsSet, + S::Saved: saved_feeds_pref_state::IsSet, { /// Build the final struct pub fn build(self) -> SavedFeedsPref<'a> { @@ -7448,6 +7492,9 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SavedFeedsPrefV2<'a> { )] #[serde(rename_all = "camelCase")] pub struct StatusView<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, /// An optional embed associated with the status. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] @@ -7458,11 +7505,17 @@ pub struct StatusView<'a> { /// True if the status is not expired, false if it is expired. Only present if expiration was set. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub is_active: std::option::Option<bool>, + /// True if the user's go-live access has been disabled by a moderator, false otherwise. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub is_disabled: std::option::Option<bool>, #[serde(borrow)] pub record: jacquard_common::types::value::Data<'a>, /// The status for the account. #[serde(borrow)] pub status: StatusViewStatus<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub uri: std::option::Option<jacquard_common::types::string::AtUri<'a>>, } pub mod status_view_state { @@ -7475,37 +7528,37 @@ pub mod status_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type Record; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type Record = Unset; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; - type Record = S::Record; + type Status = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Status = S::Status; type Record = Set<members::record>; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type Record = S::Record; + type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -7513,11 +7566,14 @@ pub mod status_view_state { pub struct StatusViewBuilder<'a, S: status_view_state::State> { _phantom_state: ::core::marker::PhantomData<fn() -> S>, __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, ::core::option::Option<crate::app_bsky::embed::external::View<'a>>, ::core::option::Option<jacquard_common::types::string::Datetime>, ::core::option::Option<bool>, + ::core::option::Option<bool>, ::core::option::Option<jacquard_common::types::value::Data<'a>>, ::core::option::Option<StatusViewStatus<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -7534,19 +7590,38 @@ impl<'a> StatusViewBuilder<'a, status_view_state::Empty> { pub fn new() -> Self { StatusViewBuilder { _phantom_state: ::core::marker::PhantomData, - __unsafe_private_named: (None, None, None, None, None), + __unsafe_private_named: (None, None, None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } +impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { + /// Set the `cid` field (optional) + pub fn cid( + mut self, + value: impl Into<Option<jacquard_common::types::string::Cid<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `cid` field to an Option value (optional) + pub fn maybe_cid( + mut self, + value: Option<jacquard_common::types::string::Cid<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { /// Set the `embed` field (optional) pub fn embed( mut self, value: impl Into<Option<crate::app_bsky::embed::external::View<'a>>>, ) -> Self { - self.__unsafe_private_named.0 = value.into(); + self.__unsafe_private_named.1 = value.into(); self } /// Set the `embed` field to an Option value (optional) @@ -7554,7 +7629,7 @@ impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { mut self, value: Option<crate::app_bsky::embed::external::View<'a>>, ) -> Self { - self.__unsafe_private_named.0 = value; + self.__unsafe_private_named.1 = value; self } } @@ -7565,7 +7640,7 @@ impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { mut self, value: impl Into<Option<jacquard_common::types::string::Datetime>>, ) -> Self { - self.__unsafe_private_named.1 = value.into(); + self.__unsafe_private_named.2 = value.into(); self } /// Set the `expiresAt` field to an Option value (optional) @@ -7573,7 +7648,7 @@ impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { mut self, value: Option<jacquard_common::types::string::Datetime>, ) -> Self { - self.__unsafe_private_named.1 = value; + self.__unsafe_private_named.2 = value; self } } @@ -7581,12 +7656,25 @@ impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { /// Set the `isActive` field (optional) pub fn is_active(mut self, value: impl Into<Option<bool>>) -> Self { - self.__unsafe_private_named.2 = value.into(); + self.__unsafe_private_named.3 = value.into(); self } /// Set the `isActive` field to an Option value (optional) pub fn maybe_is_active(mut self, value: Option<bool>) -> Self { - self.__unsafe_private_named.2 = value; + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { + /// Set the `isDisabled` field (optional) + pub fn is_disabled(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `isDisabled` field to an Option value (optional) + pub fn maybe_is_disabled(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.4 = value; self } } @@ -7601,7 +7689,7 @@ where mut self, value: impl Into<jacquard_common::types::value::Data<'a>>, ) -> StatusViewBuilder<'a, status_view_state::SetRecord<S>> { - self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); StatusViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -7620,7 +7708,7 @@ where mut self, value: impl Into<StatusViewStatus<'a>>, ) -> StatusViewBuilder<'a, status_view_state::SetStatus<S>> { - self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); StatusViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -7629,20 +7717,42 @@ where } } +impl<'a, S: status_view_state::State> StatusViewBuilder<'a, S> { + /// Set the `uri` field (optional) + pub fn uri( + mut self, + value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>, + ) -> Self { + self.__unsafe_private_named.7 = value.into(); + self + } + /// Set the `uri` field to an Option value (optional) + pub fn maybe_uri( + mut self, + value: Option<jacquard_common::types::string::AtUri<'a>>, + ) -> Self { + self.__unsafe_private_named.7 = value; + self + } +} + impl<'a, S> StatusViewBuilder<'a, S> where S: status_view_state::State, - S::Status: status_view_state::IsSet, S::Record: status_view_state::IsSet, + S::Status: status_view_state::IsSet, { /// Build the final struct pub fn build(self) -> StatusView<'a> { StatusView { - embed: self.__unsafe_private_named.0, - expires_at: self.__unsafe_private_named.1, - is_active: self.__unsafe_private_named.2, - record: self.__unsafe_private_named.3.unwrap(), - status: self.__unsafe_private_named.4.unwrap(), + cid: self.__unsafe_private_named.0, + embed: self.__unsafe_private_named.1, + expires_at: self.__unsafe_private_named.2, + is_active: self.__unsafe_private_named.3, + is_disabled: self.__unsafe_private_named.4, + record: self.__unsafe_private_named.5.unwrap(), + status: self.__unsafe_private_named.6.unwrap(), + uri: self.__unsafe_private_named.7, extra_data: Default::default(), } } @@ -7655,11 +7765,14 @@ where >, ) -> StatusView<'a> { StatusView { - embed: self.__unsafe_private_named.0, - expires_at: self.__unsafe_private_named.1, - is_active: self.__unsafe_private_named.2, - record: self.__unsafe_private_named.3.unwrap(), - status: self.__unsafe_private_named.4.unwrap(), + cid: self.__unsafe_private_named.0, + embed: self.__unsafe_private_named.1, + expires_at: self.__unsafe_private_named.2, + is_active: self.__unsafe_private_named.3, + is_disabled: self.__unsafe_private_named.4, + record: self.__unsafe_private_named.5.unwrap(), + status: self.__unsafe_private_named.6.unwrap(), + uri: self.__unsafe_private_named.7, extra_data: Some(extra_data), } } @@ -7976,51 +8089,51 @@ pub mod verification_state_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type VerifiedStatus; type TrustedVerifierStatus; type Verifications; - type VerifiedStatus; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type VerifiedStatus = Unset; type TrustedVerifierStatus = Unset; type Verifications = Unset; - type VerifiedStatus = Unset; + } + ///State transition - sets the `verified_status` field to Set + pub struct SetVerifiedStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetVerifiedStatus<S> {} + impl<S: State> State for SetVerifiedStatus<S> { + type VerifiedStatus = Set<members::verified_status>; + type TrustedVerifierStatus = S::TrustedVerifierStatus; + type Verifications = S::Verifications; } ///State transition - sets the `trusted_verifier_status` field to Set pub struct SetTrustedVerifierStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTrustedVerifierStatus<S> {} impl<S: State> State for SetTrustedVerifierStatus<S> { + type VerifiedStatus = S::VerifiedStatus; type TrustedVerifierStatus = Set<members::trusted_verifier_status>; type Verifications = S::Verifications; - type VerifiedStatus = S::VerifiedStatus; } ///State transition - sets the `verifications` field to Set pub struct SetVerifications<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVerifications<S> {} impl<S: State> State for SetVerifications<S> { - type TrustedVerifierStatus = S::TrustedVerifierStatus; - type Verifications = Set<members::verifications>; type VerifiedStatus = S::VerifiedStatus; - } - ///State transition - sets the `verified_status` field to Set - pub struct SetVerifiedStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetVerifiedStatus<S> {} - impl<S: State> State for SetVerifiedStatus<S> { type TrustedVerifierStatus = S::TrustedVerifierStatus; - type Verifications = S::Verifications; - type VerifiedStatus = Set<members::verified_status>; + type Verifications = Set<members::verifications>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `verified_status` field + pub struct verified_status(()); ///Marker type for the `trusted_verifier_status` field pub struct trusted_verifier_status(()); ///Marker type for the `verifications` field pub struct verifications(()); - ///Marker type for the `verified_status` field - pub struct verified_status(()); } } @@ -8116,9 +8229,9 @@ where impl<'a, S> VerificationStateBuilder<'a, S> where S: verification_state_state::State, + S::VerifiedStatus: verification_state_state::IsSet, S::TrustedVerifierStatus: verification_state_state::IsSet, S::Verifications: verification_state_state::IsSet, - S::VerifiedStatus: verification_state_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationState<'a> { @@ -8402,65 +8515,65 @@ pub mod verification_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Uri; type CreatedAt; type Issuer; - type Uri; type IsValid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Uri = Unset; type CreatedAt = Unset; type Issuer = Unset; - type Uri = Unset; type IsValid = Unset; } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type CreatedAt = S::CreatedAt; + type Issuer = S::Issuer; + type IsValid = S::IsValid; + } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Uri = S::Uri; type CreatedAt = Set<members::created_at>; type Issuer = S::Issuer; - type Uri = S::Uri; type IsValid = S::IsValid; } ///State transition - sets the `issuer` field to Set pub struct SetIssuer<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIssuer<S> {} impl<S: State> State for SetIssuer<S> { - type CreatedAt = S::CreatedAt; - type Issuer = Set<members::issuer>; type Uri = S::Uri; - type IsValid = S::IsValid; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { type CreatedAt = S::CreatedAt; - type Issuer = S::Issuer; - type Uri = Set<members::uri>; + type Issuer = Set<members::issuer>; type IsValid = S::IsValid; } ///State transition - sets the `is_valid` field to Set pub struct SetIsValid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIsValid<S> {} impl<S: State> State for SetIsValid<S> { + type Uri = S::Uri; type CreatedAt = S::CreatedAt; type Issuer = S::Issuer; - type Uri = S::Uri; type IsValid = Set<members::is_valid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `issuer` field pub struct issuer(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `is_valid` field pub struct is_valid(()); } @@ -8575,9 +8688,9 @@ where impl<'a, S> VerificationViewBuilder<'a, S> where S: verification_view_state::State, + S::Uri: verification_view_state::IsSet, S::CreatedAt: verification_view_state::IsSet, S::Issuer: verification_view_state::IsSet, - S::Uri: verification_view_state::IsSet, S::IsValid: verification_view_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_bsky/actor/status.rs b/crates/jacquard-api/src/app_bsky/actor/status.rs index d1cf088b..a58d3e2f 100644 --- a/crates/jacquard-api/src/app_bsky/actor/status.rs +++ b/crates/jacquard-api/src/app_bsky/actor/status.rs @@ -59,37 +59,37 @@ pub mod status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type CreatedAt; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; - type CreatedAt = S::CreatedAt; + type Status = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Status = S::Status; type CreatedAt = Set<members::created_at>; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type CreatedAt = S::CreatedAt; + type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -196,8 +196,8 @@ where impl<'a, S> StatusBuilder<'a, S> where S: status_state::State, - S::Status: status_state::IsSet, S::CreatedAt: status_state::IsSet, + S::Status: status_state::IsSet, { /// Build the final struct pub fn build(self) -> Status<'a> { diff --git a/crates/jacquard-api/src/app_bsky/ageassurance.rs b/crates/jacquard-api/src/app_bsky/ageassurance.rs index 28310b88..62f786f2 100644 --- a/crates/jacquard-api/src/app_bsky/ageassurance.rs +++ b/crates/jacquard-api/src/app_bsky/ageassurance.rs @@ -298,6 +298,7 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("countryCode"), + ::jacquard_common::smol_str::SmolStr::new_static("minAccessAge"), ::jacquard_common::smol_str::SmolStr::new_static("rules") ], ), @@ -326,6 +327,19 @@ fn lexicon_doc_app_bsky_ageassurance_defs() -> ::jacquard_lexicon::lexicon::Lexi known_values: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "minAccessAge", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "regionCode", @@ -1098,6 +1112,8 @@ pub struct ConfigRegion<'a> { /// The ISO 3166-1 alpha-2 country code this configuration applies to. #[serde(borrow)] pub country_code: jacquard_common::CowStr<'a>, + /// The minimum age (as a whole integer) required to use Bluesky in this region. + pub min_access_age: i64, /// The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] @@ -1118,6 +1134,7 @@ pub mod config_region_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CountryCode; + type MinAccessAge; type Rules; } /// Empty state - all required fields are unset @@ -1125,6 +1142,7 @@ pub mod config_region_state { impl sealed::Sealed for Empty {} impl State for Empty { type CountryCode = Unset; + type MinAccessAge = Unset; type Rules = Unset; } ///State transition - sets the `country_code` field to Set @@ -1132,6 +1150,15 @@ pub mod config_region_state { impl<S: State> sealed::Sealed for SetCountryCode<S> {} impl<S: State> State for SetCountryCode<S> { type CountryCode = Set<members::country_code>; + type MinAccessAge = S::MinAccessAge; + type Rules = S::Rules; + } + ///State transition - sets the `min_access_age` field to Set + pub struct SetMinAccessAge<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMinAccessAge<S> {} + impl<S: State> State for SetMinAccessAge<S> { + type CountryCode = S::CountryCode; + type MinAccessAge = Set<members::min_access_age>; type Rules = S::Rules; } ///State transition - sets the `rules` field to Set @@ -1139,6 +1166,7 @@ pub mod config_region_state { impl<S: State> sealed::Sealed for SetRules<S> {} impl<S: State> State for SetRules<S> { type CountryCode = S::CountryCode; + type MinAccessAge = S::MinAccessAge; type Rules = Set<members::rules>; } /// Marker types for field names @@ -1146,6 +1174,8 @@ pub mod config_region_state { pub mod members { ///Marker type for the `country_code` field pub struct country_code(()); + ///Marker type for the `min_access_age` field + pub struct min_access_age(()); ///Marker type for the `rules` field pub struct rules(()); } @@ -1156,6 +1186,7 @@ pub struct ConfigRegionBuilder<'a, S: config_region_state::State> { _phantom_state: ::core::marker::PhantomData<fn() -> S>, __unsafe_private_named: ( ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<i64>, ::core::option::Option<jacquard_common::CowStr<'a>>, ::core::option::Option<Vec<ConfigRegionRulesItem<'a>>>, ), @@ -1174,7 +1205,7 @@ impl<'a> ConfigRegionBuilder<'a, config_region_state::Empty> { pub fn new() -> Self { ConfigRegionBuilder { _phantom_state: ::core::marker::PhantomData, - __unsafe_private_named: (None, None, None), + __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } @@ -1199,13 +1230,32 @@ where } } +impl<'a, S> ConfigRegionBuilder<'a, S> +where + S: config_region_state::State, + S::MinAccessAge: config_region_state::IsUnset, +{ + /// Set the `minAccessAge` field (required) + pub fn min_access_age( + mut self, + value: impl Into<i64>, + ) -> ConfigRegionBuilder<'a, config_region_state::SetMinAccessAge<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ConfigRegionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + impl<'a, S: config_region_state::State> ConfigRegionBuilder<'a, S> { /// Set the `regionCode` field (optional) pub fn region_code( mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>, ) -> Self { - self.__unsafe_private_named.1 = value.into(); + self.__unsafe_private_named.2 = value.into(); self } /// Set the `regionCode` field to an Option value (optional) @@ -1213,7 +1263,7 @@ impl<'a, S: config_region_state::State> ConfigRegionBuilder<'a, S> { mut self, value: Option<jacquard_common::CowStr<'a>>, ) -> Self { - self.__unsafe_private_named.1 = value; + self.__unsafe_private_named.2 = value; self } } @@ -1228,7 +1278,7 @@ where mut self, value: impl Into<Vec<ConfigRegionRulesItem<'a>>>, ) -> ConfigRegionBuilder<'a, config_region_state::SetRules<S>> { - self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); ConfigRegionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -1241,14 +1291,16 @@ impl<'a, S> ConfigRegionBuilder<'a, S> where S: config_region_state::State, S::CountryCode: config_region_state::IsSet, + S::MinAccessAge: config_region_state::IsSet, S::Rules: config_region_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegion<'a> { ConfigRegion { country_code: self.__unsafe_private_named.0.unwrap(), - region_code: self.__unsafe_private_named.1, - rules: self.__unsafe_private_named.2.unwrap(), + min_access_age: self.__unsafe_private_named.1.unwrap(), + region_code: self.__unsafe_private_named.2, + rules: self.__unsafe_private_named.3.unwrap(), extra_data: Default::default(), } } @@ -1262,8 +1314,9 @@ where ) -> ConfigRegion<'a> { ConfigRegion { country_code: self.__unsafe_private_named.0.unwrap(), - region_code: self.__unsafe_private_named.1, - rules: self.__unsafe_private_named.2.unwrap(), + min_access_age: self.__unsafe_private_named.1.unwrap(), + region_code: self.__unsafe_private_named.2, + rules: self.__unsafe_private_named.3.unwrap(), extra_data: Some(extra_data), } } @@ -1506,37 +1559,37 @@ pub mod config_region_rule_if_account_newer_than_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Access; type Date; + type Access; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Access = Unset; type Date = Unset; - } - ///State transition - sets the `access` field to Set - pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAccess<S> {} - impl<S: State> State for SetAccess<S> { - type Access = Set<members::access>; - type Date = S::Date; + type Access = Unset; } ///State transition - sets the `date` field to Set pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDate<S> {} impl<S: State> State for SetDate<S> { - type Access = S::Access; type Date = Set<members::date>; + type Access = S::Access; + } + ///State transition - sets the `access` field to Set + pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAccess<S> {} + impl<S: State> State for SetAccess<S> { + type Date = S::Date; + type Access = Set<members::access>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `access` field - pub struct access(()); ///Marker type for the `date` field pub struct date(()); + ///Marker type for the `access` field + pub struct access(()); } } @@ -1626,8 +1679,8 @@ where impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S> where S: config_region_rule_if_account_newer_than_state::State, - S::Access: config_region_rule_if_account_newer_than_state::IsSet, S::Date: config_region_rule_if_account_newer_than_state::IsSet, + S::Access: config_region_rule_if_account_newer_than_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> { @@ -1700,37 +1753,37 @@ pub mod config_region_rule_if_account_older_than_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Date; type Access; + type Date; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Date = Unset; type Access = Unset; - } - ///State transition - sets the `date` field to Set - pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDate<S> {} - impl<S: State> State for SetDate<S> { - type Date = Set<members::date>; - type Access = S::Access; + type Date = Unset; } ///State transition - sets the `access` field to Set pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccess<S> {} impl<S: State> State for SetAccess<S> { - type Date = S::Date; type Access = Set<members::access>; + type Date = S::Date; + } + ///State transition - sets the `date` field to Set + pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDate<S> {} + impl<S: State> State for SetDate<S> { + type Access = S::Access; + type Date = Set<members::date>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `date` field - pub struct date(()); ///Marker type for the `access` field pub struct access(()); + ///Marker type for the `date` field + pub struct date(()); } } @@ -1820,8 +1873,8 @@ where impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S> where S: config_region_rule_if_account_older_than_state::State, - S::Date: config_region_rule_if_account_older_than_state::IsSet, S::Access: config_region_rule_if_account_older_than_state::IsSet, + S::Date: config_region_rule_if_account_older_than_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> { @@ -1894,37 +1947,37 @@ pub mod config_region_rule_if_assured_over_age_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Access; type Age; + type Access; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Access = Unset; type Age = Unset; - } - ///State transition - sets the `access` field to Set - pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAccess<S> {} - impl<S: State> State for SetAccess<S> { - type Access = Set<members::access>; - type Age = S::Age; + type Access = Unset; } ///State transition - sets the `age` field to Set pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAge<S> {} impl<S: State> State for SetAge<S> { - type Access = S::Access; type Age = Set<members::age>; + type Access = S::Access; + } + ///State transition - sets the `access` field to Set + pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAccess<S> {} + impl<S: State> State for SetAccess<S> { + type Age = S::Age; + type Access = Set<members::access>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `access` field - pub struct access(()); ///Marker type for the `age` field pub struct age(()); + ///Marker type for the `access` field + pub struct access(()); } } @@ -2014,8 +2067,8 @@ where impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S> where S: config_region_rule_if_assured_over_age_state::State, - S::Access: config_region_rule_if_assured_over_age_state::IsSet, S::Age: config_region_rule_if_assured_over_age_state::IsSet, + S::Access: config_region_rule_if_assured_over_age_state::IsSet, { /// Build the final struct pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> { @@ -2704,85 +2757,85 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Status; type Access; - type CreatedAt; - type CountryCode; type AttemptId; + type CountryCode; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Status = Unset; type Access = Unset; - type CreatedAt = Unset; - type CountryCode = Unset; type AttemptId = Unset; + type CountryCode = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Status = S::Status; + type Access = S::Access; + type AttemptId = S::AttemptId; + type CountryCode = S::CountryCode; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { + type CreatedAt = S::CreatedAt; type Status = Set<members::status>; type Access = S::Access; - type CreatedAt = S::CreatedAt; - type CountryCode = S::CountryCode; type AttemptId = S::AttemptId; + type CountryCode = S::CountryCode; } ///State transition - sets the `access` field to Set pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccess<S> {} impl<S: State> State for SetAccess<S> { + type CreatedAt = S::CreatedAt; type Status = S::Status; type Access = Set<members::access>; - type CreatedAt = S::CreatedAt; - type CountryCode = S::CountryCode; type AttemptId = S::AttemptId; + type CountryCode = S::CountryCode; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + ///State transition - sets the `attempt_id` field to Set + pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAttemptId<S> {} + impl<S: State> State for SetAttemptId<S> { + type CreatedAt = S::CreatedAt; type Status = S::Status; type Access = S::Access; - type CreatedAt = Set<members::created_at>; + type AttemptId = Set<members::attempt_id>; type CountryCode = S::CountryCode; - type AttemptId = S::AttemptId; } ///State transition - sets the `country_code` field to Set pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCountryCode<S> {} impl<S: State> State for SetCountryCode<S> { - type Status = S::Status; - type Access = S::Access; type CreatedAt = S::CreatedAt; - type CountryCode = Set<members::country_code>; - type AttemptId = S::AttemptId; - } - ///State transition - sets the `attempt_id` field to Set - pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAttemptId<S> {} - impl<S: State> State for SetAttemptId<S> { type Status = S::Status; type Access = S::Access; - type CreatedAt = S::CreatedAt; - type CountryCode = S::CountryCode; - type AttemptId = Set<members::attempt_id>; + type AttemptId = S::AttemptId; + type CountryCode = Set<members::country_code>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `status` field pub struct status(()); ///Marker type for the `access` field pub struct access(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `country_code` field - pub struct country_code(()); ///Marker type for the `attempt_id` field pub struct attempt_id(()); + ///Marker type for the `country_code` field + pub struct country_code(()); } } @@ -3038,11 +3091,11 @@ where impl<'a, S> EventBuilder<'a, S> where S: event_state::State, + S::CreatedAt: event_state::IsSet, S::Status: event_state::IsSet, S::Access: event_state::IsSet, - S::CreatedAt: event_state::IsSet, - S::CountryCode: event_state::IsSet, S::AttemptId: event_state::IsSet, + S::CountryCode: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { diff --git a/crates/jacquard-api/src/app_bsky/bookmark.rs b/crates/jacquard-api/src/app_bsky/bookmark.rs index 300946dc..ac81a969 100644 --- a/crates/jacquard-api/src/app_bsky/bookmark.rs +++ b/crates/jacquard-api/src/app_bsky/bookmark.rs @@ -281,37 +281,37 @@ pub mod bookmark_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Item; type Subject; + type Item; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Item = Unset; type Subject = Unset; - } - ///State transition - sets the `item` field to Set - pub struct SetItem<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetItem<S> {} - impl<S: State> State for SetItem<S> { - type Item = Set<members::item>; - type Subject = S::Subject; + type Item = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type Item = S::Item; type Subject = Set<members::subject>; + type Item = S::Item; + } + ///State transition - sets the `item` field to Set + pub struct SetItem<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetItem<S> {} + impl<S: State> State for SetItem<S> { + type Subject = S::Subject; + type Item = Set<members::item>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `item` field - pub struct item(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `item` field + pub struct item(()); } } @@ -404,8 +404,8 @@ where impl<'a, S> BookmarkViewBuilder<'a, S> where S: bookmark_view_state::State, - S::Item: bookmark_view_state::IsSet, S::Subject: bookmark_view_state::IsSet, + S::Item: bookmark_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BookmarkView<'a> { diff --git a/crates/jacquard-api/src/app_bsky/bookmark/create_bookmark.rs b/crates/jacquard-api/src/app_bsky/bookmark/create_bookmark.rs index 6cdf6a4b..f5921792 100644 --- a/crates/jacquard-api/src/app_bsky/bookmark/create_bookmark.rs +++ b/crates/jacquard-api/src/app_bsky/bookmark/create_bookmark.rs @@ -33,37 +33,37 @@ pub mod create_bookmark_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type Uri; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type Uri = Unset; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type Uri = S::Uri; + type Cid = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Cid = S::Cid; type Uri = Set<members::uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Uri = S::Uri; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> CreateBookmarkBuilder<'a, S> where S: create_bookmark_state::State, - S::Cid: create_bookmark_state::IsSet, S::Uri: create_bookmark_state::IsSet, + S::Cid: create_bookmark_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateBookmark<'a> { diff --git a/crates/jacquard-api/src/app_bsky/embed/external.rs b/crates/jacquard-api/src/app_bsky/embed/external.rs index 3cf7f167..76316dce 100644 --- a/crates/jacquard-api/src/app_bsky/embed/external.rs +++ b/crates/jacquard-api/src/app_bsky/embed/external.rs @@ -38,51 +38,51 @@ pub mod external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Title; type Description; type Uri; - type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Title = Unset; type Description = Unset; type Uri = Unset; - type Title = Unset; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; + type Description = S::Description; + type Uri = S::Uri; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { + type Title = S::Title; type Description = Set<members::description>; type Uri = S::Uri; - type Title = S::Title; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Description = S::Description; - type Uri = Set<members::uri>; type Title = S::Title; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { type Description = S::Description; - type Uri = S::Uri; - type Title = Set<members::title>; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `description` field pub struct description(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `title` field - pub struct title(()); } } @@ -195,9 +195,9 @@ where impl<'a, S> ExternalBuilder<'a, S> where S: external_state::State, + S::Title: external_state::IsSet, S::Description: external_state::IsSet, S::Uri: external_state::IsSet, - S::Title: external_state::IsSet, { /// Build the final struct pub fn build(self) -> External<'a> { @@ -784,51 +784,51 @@ pub mod view_external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Title; type Uri; type Description; - type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Title = Unset; type Uri = Unset; type Description = Unset; - type Title = Unset; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; + type Uri = S::Uri; + type Description = S::Description; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { + type Title = S::Title; type Uri = Set<members::uri>; type Description = S::Description; - type Title = S::Title; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Uri = S::Uri; - type Description = Set<members::description>; type Title = S::Title; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { type Uri = S::Uri; - type Description = S::Description; - type Title = Set<members::title>; + type Description = Set<members::description>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `description` field pub struct description(()); - ///Marker type for the `title` field - pub struct title(()); } } @@ -941,9 +941,9 @@ where impl<'a, S> ViewExternalBuilder<'a, S> where S: view_external_state::State, + S::Title: view_external_state::IsSet, S::Uri: view_external_state::IsSet, S::Description: view_external_state::IsSet, - S::Title: view_external_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewExternal<'a> { diff --git a/crates/jacquard-api/src/app_bsky/embed/images.rs b/crates/jacquard-api/src/app_bsky/embed/images.rs index fc4af35f..b277b40a 100644 --- a/crates/jacquard-api/src/app_bsky/embed/images.rs +++ b/crates/jacquard-api/src/app_bsky/embed/images.rs @@ -37,37 +37,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Alt; type Image; + type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Alt = Unset; type Image = Unset; - } - ///State transition - sets the `alt` field to Set - pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAlt<S> {} - impl<S: State> State for SetAlt<S> { - type Alt = Set<members::alt>; - type Image = S::Image; + type Alt = Unset; } ///State transition - sets the `image` field to Set pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetImage<S> {} impl<S: State> State for SetImage<S> { - type Alt = S::Alt; type Image = Set<members::image>; + type Alt = S::Alt; + } + ///State transition - sets the `alt` field to Set + pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAlt<S> {} + impl<S: State> State for SetAlt<S> { + type Image = S::Image; + type Alt = Set<members::alt>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `alt` field - pub struct alt(()); ///Marker type for the `image` field pub struct image(()); + ///Marker type for the `alt` field + pub struct alt(()); } } @@ -160,8 +160,8 @@ where impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Alt: image_state::IsSet, S::Image: image_state::IsSet, + S::Alt: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { @@ -760,51 +760,51 @@ pub mod view_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Thumb; type Fullsize; type Alt; + type Thumb; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Thumb = Unset; type Fullsize = Unset; type Alt = Unset; - } - ///State transition - sets the `thumb` field to Set - pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetThumb<S> {} - impl<S: State> State for SetThumb<S> { - type Thumb = Set<members::thumb>; - type Fullsize = S::Fullsize; - type Alt = S::Alt; + type Thumb = Unset; } ///State transition - sets the `fullsize` field to Set pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetFullsize<S> {} impl<S: State> State for SetFullsize<S> { - type Thumb = S::Thumb; type Fullsize = Set<members::fullsize>; type Alt = S::Alt; + type Thumb = S::Thumb; } ///State transition - sets the `alt` field to Set pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlt<S> {} impl<S: State> State for SetAlt<S> { - type Thumb = S::Thumb; type Fullsize = S::Fullsize; type Alt = Set<members::alt>; + type Thumb = S::Thumb; + } + ///State transition - sets the `thumb` field to Set + pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetThumb<S> {} + impl<S: State> State for SetThumb<S> { + type Fullsize = S::Fullsize; + type Alt = S::Alt; + type Thumb = Set<members::thumb>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `thumb` field - pub struct thumb(()); ///Marker type for the `fullsize` field pub struct fullsize(()); ///Marker type for the `alt` field pub struct alt(()); + ///Marker type for the `thumb` field + pub struct thumb(()); } } @@ -917,9 +917,9 @@ where impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, - S::Thumb: view_image_state::IsSet, S::Fullsize: view_image_state::IsSet, S::Alt: view_image_state::IsSet, + S::Thumb: view_image_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewImage<'a> { diff --git a/crates/jacquard-api/src/app_bsky/embed/record.rs b/crates/jacquard-api/src/app_bsky/embed/record.rs index 3e9d9eab..55c2a5a4 100644 --- a/crates/jacquard-api/src/app_bsky/embed/record.rs +++ b/crates/jacquard-api/src/app_bsky/embed/record.rs @@ -723,51 +723,51 @@ pub mod view_blocked_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Author; type Blocked; + type Author; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Author = Unset; type Blocked = Unset; + type Author = Unset; + type Uri = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; + ///State transition - sets the `blocked` field to Set + pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlocked<S> {} + impl<S: State> State for SetBlocked<S> { + type Blocked = Set<members::blocked>; type Author = S::Author; - type Blocked = S::Blocked; + type Uri = S::Uri; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Uri = S::Uri; - type Author = Set<members::author>; type Blocked = S::Blocked; - } - ///State transition - sets the `blocked` field to Set - pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlocked<S> {} - impl<S: State> State for SetBlocked<S> { + type Author = Set<members::author>; type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Blocked = S::Blocked; type Author = S::Author; - type Blocked = Set<members::blocked>; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `blocked` field pub struct blocked(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -860,9 +860,9 @@ where impl<'a, S> ViewBlockedBuilder<'a, S> where S: view_blocked_state::State, - S::Uri: view_blocked_state::IsSet, - S::Author: view_blocked_state::IsSet, S::Blocked: view_blocked_state::IsSet, + S::Author: view_blocked_state::IsSet, + S::Uri: view_blocked_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewBlocked<'a> { @@ -934,37 +934,37 @@ pub mod view_detached_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Detached; type Uri; + type Detached; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Detached = Unset; type Uri = Unset; - } - ///State transition - sets the `detached` field to Set - pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDetached<S> {} - impl<S: State> State for SetDetached<S> { - type Detached = Set<members::detached>; - type Uri = S::Uri; + type Detached = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Detached = S::Detached; type Uri = Set<members::uri>; + type Detached = S::Detached; + } + ///State transition - sets the `detached` field to Set + pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDetached<S> {} + impl<S: State> State for SetDetached<S> { + type Uri = S::Uri; + type Detached = Set<members::detached>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `detached` field - pub struct detached(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `detached` field + pub struct detached(()); } } @@ -1037,8 +1037,8 @@ where impl<'a, S> ViewDetachedBuilder<'a, S> where S: view_detached_state::State, - S::Detached: view_detached_state::IsSet, S::Uri: view_detached_state::IsSet, + S::Detached: view_detached_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewDetached<'a> { @@ -1303,83 +1303,83 @@ pub mod view_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type Author; type IndexedAt; + type Author; type Uri; + type Cid; type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type Author = Unset; type IndexedAt = Unset; + type Author = Unset; type Uri = Unset; + type Cid = Unset; type Value = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type IndexedAt = Set<members::indexed_at>; type Author = S::Author; - type IndexedAt = S::IndexedAt; type Uri = S::Uri; + type Cid = S::Cid; type Value = S::Value; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Cid = S::Cid; - type Author = Set<members::author>; type IndexedAt = S::IndexedAt; + type Author = Set<members::author>; type Uri = S::Uri; - type Value = S::Value; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { type Cid = S::Cid; - type Author = S::Author; - type IndexedAt = Set<members::indexed_at>; - type Uri = S::Uri; type Value = S::Value; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Cid = S::Cid; - type Author = S::Author; type IndexedAt = S::IndexedAt; + type Author = S::Author; type Uri = Set<members::uri>; + type Cid = S::Cid; + type Value = S::Value; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type IndexedAt = S::IndexedAt; + type Author = S::Author; + type Uri = S::Uri; + type Cid = Set<members::cid>; type Value = S::Value; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Cid = S::Cid; - type Author = S::Author; type IndexedAt = S::IndexedAt; + type Author = S::Author; type Uri = S::Uri; + type Cid = S::Cid; type Value = Set<members::value>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `author` field + pub struct author(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `value` field pub struct value(()); } @@ -1619,10 +1619,10 @@ where impl<'a, S> ViewRecordBuilder<'a, S> where S: view_record_state::State, - S::Cid: view_record_state::IsSet, - S::Author: view_record_state::IsSet, S::IndexedAt: view_record_state::IsSet, + S::Author: view_record_state::IsSet, S::Uri: view_record_state::IsSet, + S::Cid: view_record_state::IsSet, S::Value: view_record_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_bsky/embed/video.rs b/crates/jacquard-api/src/app_bsky/embed/video.rs index 4a3cf800..d214654a 100644 --- a/crates/jacquard-api/src/app_bsky/embed/video.rs +++ b/crates/jacquard-api/src/app_bsky/embed/video.rs @@ -32,37 +32,37 @@ pub mod caption_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type File; type Lang; + type File; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type File = Unset; type Lang = Unset; - } - ///State transition - sets the `file` field to Set - pub struct SetFile<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFile<S> {} - impl<S: State> State for SetFile<S> { - type File = Set<members::file>; - type Lang = S::Lang; + type File = Unset; } ///State transition - sets the `lang` field to Set pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLang<S> {} impl<S: State> State for SetLang<S> { - type File = S::File; type Lang = Set<members::lang>; + type File = S::File; + } + ///State transition - sets the `file` field to Set + pub struct SetFile<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFile<S> {} + impl<S: State> State for SetFile<S> { + type Lang = S::Lang; + type File = Set<members::file>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `file` field - pub struct file(()); ///Marker type for the `lang` field pub struct lang(()); + ///Marker type for the `file` field + pub struct file(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> CaptionBuilder<'a, S> where S: caption_state::State, - S::File: caption_state::IsSet, S::Lang: caption_state::IsSet, + S::File: caption_state::IsSet, { /// Build the final struct pub fn build(self) -> Caption<'a> { @@ -687,37 +687,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Playlist; type Cid; + type Playlist; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Playlist = Unset; type Cid = Unset; - } - ///State transition - sets the `playlist` field to Set - pub struct SetPlaylist<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPlaylist<S> {} - impl<S: State> State for SetPlaylist<S> { - type Playlist = Set<members::playlist>; - type Cid = S::Cid; + type Playlist = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Playlist = S::Playlist; type Cid = Set<members::cid>; + type Playlist = S::Playlist; + } + ///State transition - sets the `playlist` field to Set + pub struct SetPlaylist<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlaylist<S> {} + impl<S: State> State for SetPlaylist<S> { + type Cid = S::Cid; + type Playlist = Set<members::playlist>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `playlist` field - pub struct playlist(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `playlist` field + pub struct playlist(()); } } @@ -844,8 +844,8 @@ impl<'a, S: view_state::State> ViewBuilder<'a, S> { impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Playlist: view_state::IsSet, S::Cid: view_state::IsSet, + S::Playlist: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { diff --git a/crates/jacquard-api/src/app_bsky/feed.rs b/crates/jacquard-api/src/app_bsky/feed.rs index e87bcebf..6c612f6a 100644 --- a/crates/jacquard-api/src/app_bsky/feed.rs +++ b/crates/jacquard-api/src/app_bsky/feed.rs @@ -1609,49 +1609,49 @@ pub mod blocked_post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Author; + type Uri; type Blocked; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Author = Unset; + type Uri = Unset; type Blocked = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Author = S::Author; - type Blocked = S::Blocked; - } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Uri = S::Uri; type Author = Set<members::author>; + type Uri = S::Uri; + type Blocked = S::Blocked; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Author = S::Author; + type Uri = Set<members::uri>; type Blocked = S::Blocked; } ///State transition - sets the `blocked` field to Set pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlocked<S> {} impl<S: State> State for SetBlocked<S> { - type Uri = S::Uri; type Author = S::Author; + type Uri = S::Uri; type Blocked = Set<members::blocked>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `blocked` field pub struct blocked(()); } @@ -1746,8 +1746,8 @@ where impl<'a, S> BlockedPostBuilder<'a, S> where S: blocked_post_state::State, - S::Uri: blocked_post_state::IsSet, S::Author: blocked_post_state::IsSet, + S::Uri: blocked_post_state::IsSet, S::Blocked: blocked_post_state::IsSet, { /// Build the final struct @@ -2235,104 +2235,104 @@ pub mod generator_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; - type Cid; type DisplayName; type IndexedAt; - type Did; + type Cid; type Creator; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; - type Cid = Unset; type DisplayName = Unset; type IndexedAt = Unset; - type Did = Unset; + type Cid = Unset; type Creator = Unset; + type Did = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Uri = Set<members::uri>; - type Cid = S::Cid; type DisplayName = S::DisplayName; type IndexedAt = S::IndexedAt; - type Did = S::Did; + type Cid = S::Cid; type Creator = S::Creator; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Uri = S::Uri; - type Cid = Set<members::cid>; - type DisplayName = S::DisplayName; - type IndexedAt = S::IndexedAt; type Did = S::Did; - type Creator = S::Creator; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDisplayName<S> {} impl<S: State> State for SetDisplayName<S> { type Uri = S::Uri; - type Cid = S::Cid; type DisplayName = Set<members::display_name>; type IndexedAt = S::IndexedAt; - type Did = S::Did; + type Cid = S::Cid; type Creator = S::Creator; + type Did = S::Did; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { type Uri = S::Uri; - type Cid = S::Cid; type DisplayName = S::DisplayName; type IndexedAt = Set<members::indexed_at>; - type Did = S::Did; + type Cid = S::Cid; type Creator = S::Creator; + type Did = S::Did; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Uri = S::Uri; - type Cid = S::Cid; type DisplayName = S::DisplayName; type IndexedAt = S::IndexedAt; - type Did = Set<members::did>; + type Cid = Set<members::cid>; type Creator = S::Creator; + type Did = S::Did; } ///State transition - sets the `creator` field to Set pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreator<S> {} impl<S: State> State for SetCreator<S> { type Uri = S::Uri; - type Cid = S::Cid; type DisplayName = S::DisplayName; type IndexedAt = S::IndexedAt; - type Did = S::Did; + type Cid = S::Cid; type Creator = Set<members::creator>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Uri = S::Uri; + type DisplayName = S::DisplayName; + type IndexedAt = S::IndexedAt; + type Cid = S::Cid; + type Creator = S::Creator; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `display_name` field pub struct display_name(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `did` field - pub struct did(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `creator` field pub struct creator(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -2649,11 +2649,11 @@ impl<'a, S> GeneratorViewBuilder<'a, S> where S: generator_view_state::State, S::Uri: generator_view_state::IsSet, - S::Cid: generator_view_state::IsSet, S::DisplayName: generator_view_state::IsSet, S::IndexedAt: generator_view_state::IsSet, - S::Did: generator_view_state::IsSet, + S::Cid: generator_view_state::IsSet, S::Creator: generator_view_state::IsSet, + S::Did: generator_view_state::IsSet, { /// Build the final struct pub fn build(self) -> GeneratorView<'a> { @@ -3441,85 +3441,85 @@ pub mod post_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Uri; type Cid; type IndexedAt; - type Uri; - type Author; type Record; + type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Uri = Unset; type Cid = Unset; type IndexedAt = Unset; - type Uri = Unset; - type Author = Unset; type Record = Unset; + type Author = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type Cid = S::Cid; + type IndexedAt = S::IndexedAt; + type Record = S::Record; + type Author = S::Author; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { + type Uri = S::Uri; type Cid = Set<members::cid>; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Author = S::Author; type Record = S::Record; + type Author = S::Author; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { + type Uri = S::Uri; type Cid = S::Cid; type IndexedAt = Set<members::indexed_at>; - type Uri = S::Uri; - type Author = S::Author; type Record = S::Record; + type Author = S::Author; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Uri = S::Uri; type Cid = S::Cid; type IndexedAt = S::IndexedAt; - type Uri = Set<members::uri>; + type Record = Set<members::record>; type Author = S::Author; - type Record = S::Record; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Cid = S::Cid; - type IndexedAt = S::IndexedAt; type Uri = S::Uri; - type Author = Set<members::author>; - type Record = S::Record; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { type Cid = S::Cid; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Author = S::Author; - type Record = Set<members::record>; + type Record = S::Record; + type Author = Set<members::author>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `author` field + pub struct author(()); } } @@ -3832,11 +3832,11 @@ impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { impl<'a, S> PostViewBuilder<'a, S> where S: post_view_state::State, + S::Uri: post_view_state::IsSet, S::Cid: post_view_state::IsSet, S::IndexedAt: post_view_state::IsSet, - S::Uri: post_view_state::IsSet, - S::Author: post_view_state::IsSet, S::Record: post_view_state::IsSet, + S::Author: post_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PostView<'a> { @@ -3993,37 +3993,37 @@ pub mod reason_repost_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IndexedAt; type By; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IndexedAt = Unset; type By = Unset; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type IndexedAt = Set<members::indexed_at>; - type By = S::By; + type IndexedAt = Unset; } ///State transition - sets the `by` field to Set pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBy<S> {} impl<S: State> State for SetBy<S> { - type IndexedAt = S::IndexedAt; type By = Set<members::by>; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type By = S::By; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `by` field pub struct by(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -4136,8 +4136,8 @@ impl<'a, S: reason_repost_state::State> ReasonRepostBuilder<'a, S> { impl<'a, S> ReasonRepostBuilder<'a, S> where S: reason_repost_state::State, - S::IndexedAt: reason_repost_state::IsSet, S::By: reason_repost_state::IsSet, + S::IndexedAt: reason_repost_state::IsSet, { /// Build the final struct pub fn build(self) -> ReasonRepost<'a> { @@ -4218,37 +4218,37 @@ pub mod reply_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Parent; type Root; + type Parent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Parent = Unset; type Root = Unset; - } - ///State transition - sets the `parent` field to Set - pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetParent<S> {} - impl<S: State> State for SetParent<S> { - type Parent = Set<members::parent>; - type Root = S::Root; + type Parent = Unset; } ///State transition - sets the `root` field to Set pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRoot<S> {} impl<S: State> State for SetRoot<S> { - type Parent = S::Parent; type Root = Set<members::root>; + type Parent = S::Parent; + } + ///State transition - sets the `parent` field to Set + pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetParent<S> {} + impl<S: State> State for SetParent<S> { + type Root = S::Root; + type Parent = Set<members::parent>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `parent` field - pub struct parent(()); ///Marker type for the `root` field pub struct root(()); + ///Marker type for the `parent` field + pub struct parent(()); } } @@ -4341,8 +4341,8 @@ where impl<'a, S> ReplyRefBuilder<'a, S> where S: reply_ref_state::State, - S::Parent: reply_ref_state::IsSet, S::Root: reply_ref_state::IsSet, + S::Parent: reply_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> ReplyRef<'a> { diff --git a/crates/jacquard-api/src/app_bsky/feed/generator.rs b/crates/jacquard-api/src/app_bsky/feed/generator.rs index 568320f9..b8927e3d 100644 --- a/crates/jacquard-api/src/app_bsky/feed/generator.rs +++ b/crates/jacquard-api/src/app_bsky/feed/generator.rs @@ -56,49 +56,49 @@ pub mod generator_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type DisplayName; type Did; + type DisplayName; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type DisplayName = Unset; type Did = Unset; + type DisplayName = Unset; type CreatedAt = Unset; } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { - type DisplayName = Set<members::display_name>; - type Did = S::Did; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type DisplayName = S::DisplayName; type Did = Set<members::did>; + type DisplayName = S::DisplayName; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { + type Did = S::Did; + type DisplayName = Set<members::display_name>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type DisplayName = S::DisplayName; type Did = S::Did; + type DisplayName = S::DisplayName; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `display_name` field - pub struct display_name(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `display_name` field + pub struct display_name(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -317,8 +317,8 @@ impl<'a, S: generator_state::State> GeneratorBuilder<'a, S> { impl<'a, S> GeneratorBuilder<'a, S> where S: generator_state::State, - S::DisplayName: generator_state::IsSet, S::Did: generator_state::IsSet, + S::DisplayName: generator_state::IsSet, S::CreatedAt: generator_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_bsky/feed/get_likes.rs b/crates/jacquard-api/src/app_bsky/feed/get_likes.rs index eaa643f8..09c3235c 100644 --- a/crates/jacquard-api/src/app_bsky/feed/get_likes.rs +++ b/crates/jacquard-api/src/app_bsky/feed/get_likes.rs @@ -33,49 +33,49 @@ pub mod like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Actor; + type CreatedAt; type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Actor = Unset; + type CreatedAt = Unset; type IndexedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Actor = S::Actor; - type IndexedAt = S::IndexedAt; - } ///State transition - sets the `actor` field to Set pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActor<S> {} impl<S: State> State for SetActor<S> { - type CreatedAt = S::CreatedAt; type Actor = Set<members::actor>; + type CreatedAt = S::CreatedAt; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Actor = S::Actor; + type CreatedAt = Set<members::created_at>; type IndexedAt = S::IndexedAt; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type CreatedAt = S::CreatedAt; type Actor = S::Actor; + type CreatedAt = S::CreatedAt; type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `actor` field pub struct actor(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); } @@ -170,8 +170,8 @@ where impl<'a, S> LikeBuilder<'a, S> where S: like_state::State, - S::CreatedAt: like_state::IsSet, S::Actor: like_state::IsSet, + S::CreatedAt: like_state::IsSet, S::IndexedAt: like_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_bsky/feed/post.rs b/crates/jacquard-api/src/app_bsky/feed/post.rs index 34fcc26b..ed55c647 100644 --- a/crates/jacquard-api/src/app_bsky/feed/post.rs +++ b/crates/jacquard-api/src/app_bsky/feed/post.rs @@ -37,51 +37,51 @@ pub mod entity_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Type; - type Value; type Index; + type Value; + type Type; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Type = Unset; - type Value = Unset; type Index = Unset; + type Value = Unset; + type Type = Unset; } - ///State transition - sets the `type` field to Set - pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetType<S> {} - impl<S: State> State for SetType<S> { - type Type = Set<members::r#type>; + ///State transition - sets the `index` field to Set + pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndex<S> {} + impl<S: State> State for SetIndex<S> { + type Index = Set<members::index>; type Value = S::Value; - type Index = S::Index; + type Type = S::Type; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Type = S::Type; - type Value = Set<members::value>; type Index = S::Index; - } - ///State transition - sets the `index` field to Set - pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndex<S> {} - impl<S: State> State for SetIndex<S> { + type Value = Set<members::value>; type Type = S::Type; + } + ///State transition - sets the `type` field to Set + pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetType<S> {} + impl<S: State> State for SetType<S> { + type Index = S::Index; type Value = S::Value; - type Index = Set<members::index>; + type Type = Set<members::r#type>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `type` field - pub struct r#type(()); - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `index` field pub struct index(()); + ///Marker type for the `value` field + pub struct value(()); + ///Marker type for the `type` field + pub struct r#type(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> EntityBuilder<'a, S> where S: entity_state::State, - S::Type: entity_state::IsSet, - S::Value: entity_state::IsSet, S::Index: entity_state::IsSet, + S::Value: entity_state::IsSet, + S::Type: entity_state::IsSet, { /// Build the final struct pub fn build(self) -> Entity<'a> { @@ -1097,37 +1097,37 @@ pub mod reply_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Parent; type Root; + type Parent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Parent = Unset; type Root = Unset; - } - ///State transition - sets the `parent` field to Set - pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetParent<S> {} - impl<S: State> State for SetParent<S> { - type Parent = Set<members::parent>; - type Root = S::Root; + type Parent = Unset; } ///State transition - sets the `root` field to Set pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRoot<S> {} impl<S: State> State for SetRoot<S> { - type Parent = S::Parent; type Root = Set<members::root>; + type Parent = S::Parent; + } + ///State transition - sets the `parent` field to Set + pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetParent<S> {} + impl<S: State> State for SetParent<S> { + type Root = S::Root; + type Parent = Set<members::parent>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `parent` field - pub struct parent(()); ///Marker type for the `root` field pub struct root(()); + ///Marker type for the `parent` field + pub struct parent(()); } } @@ -1200,8 +1200,8 @@ where impl<'a, S> ReplyRefBuilder<'a, S> where S: reply_ref_state::State, - S::Parent: reply_ref_state::IsSet, S::Root: reply_ref_state::IsSet, + S::Parent: reply_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> ReplyRef<'a> { diff --git a/crates/jacquard-api/src/app_bsky/feed/repost.rs b/crates/jacquard-api/src/app_bsky/feed/repost.rs index 56e8e0d6..2325253e 100644 --- a/crates/jacquard-api/src/app_bsky/feed/repost.rs +++ b/crates/jacquard-api/src/app_bsky/feed/repost.rs @@ -36,37 +36,37 @@ pub mod repost_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -159,8 +159,8 @@ impl<'a, S: repost_state::State> RepostBuilder<'a, S> { impl<'a, S> RepostBuilder<'a, S> where S: repost_state::State, - S::CreatedAt: repost_state::IsSet, S::Subject: repost_state::IsSet, + S::CreatedAt: repost_state::IsSet, { /// Build the final struct pub fn build(self) -> Repost<'a> { diff --git a/crates/jacquard-api/src/app_bsky/feed/threadgate.rs b/crates/jacquard-api/src/app_bsky/feed/threadgate.rs index 2bdeef9f..1282b43a 100644 --- a/crates/jacquard-api/src/app_bsky/feed/threadgate.rs +++ b/crates/jacquard-api/src/app_bsky/feed/threadgate.rs @@ -463,37 +463,37 @@ pub mod threadgate_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Post; type CreatedAt; + type Post; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Post = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `post` field to Set - pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPost<S> {} - impl<S: State> State for SetPost<S> { - type Post = Set<members::post>; - type CreatedAt = S::CreatedAt; + type Post = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Post = S::Post; type CreatedAt = Set<members::created_at>; + type Post = S::Post; + } + ///State transition - sets the `post` field to Set + pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPost<S> {} + impl<S: State> State for SetPost<S> { + type CreatedAt = S::CreatedAt; + type Post = Set<members::post>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `post` field - pub struct post(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `post` field + pub struct post(()); } } @@ -603,8 +603,8 @@ where impl<'a, S> ThreadgateBuilder<'a, S> where S: threadgate_state::State, - S::Post: threadgate_state::IsSet, S::CreatedAt: threadgate_state::IsSet, + S::Post: threadgate_state::IsSet, { /// Build the final struct pub fn build(self) -> Threadgate<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph.rs b/crates/jacquard-api/src/app_bsky/graph.rs index 08e0e2d1..d3dadc52 100644 --- a/crates/jacquard-api/src/app_bsky/graph.rs +++ b/crates/jacquard-api/src/app_bsky/graph.rs @@ -1376,9 +1376,9 @@ pub mod list_view_state { type IndexedAt; type Uri; type Creator; + type Purpose; type Cid; type Name; - type Purpose; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -1387,9 +1387,9 @@ pub mod list_view_state { type IndexedAt = Unset; type Uri = Unset; type Creator = Unset; + type Purpose = Unset; type Cid = Unset; type Name = Unset; - type Purpose = Unset; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); @@ -1398,9 +1398,9 @@ pub mod list_view_state { type IndexedAt = Set<members::indexed_at>; type Uri = S::Uri; type Creator = S::Creator; + type Purpose = S::Purpose; type Cid = S::Cid; type Name = S::Name; - type Purpose = S::Purpose; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); @@ -1409,9 +1409,9 @@ pub mod list_view_state { type IndexedAt = S::IndexedAt; type Uri = Set<members::uri>; type Creator = S::Creator; + type Purpose = S::Purpose; type Cid = S::Cid; type Name = S::Name; - type Purpose = S::Purpose; } ///State transition - sets the `creator` field to Set pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); @@ -1420,9 +1420,20 @@ pub mod list_view_state { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Creator = Set<members::creator>; + type Purpose = S::Purpose; + type Cid = S::Cid; + type Name = S::Name; + } + ///State transition - sets the `purpose` field to Set + pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPurpose<S> {} + impl<S: State> State for SetPurpose<S> { + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Creator = S::Creator; + type Purpose = Set<members::purpose>; type Cid = S::Cid; type Name = S::Name; - type Purpose = S::Purpose; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); @@ -1431,9 +1442,9 @@ pub mod list_view_state { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Creator = S::Creator; + type Purpose = S::Purpose; type Cid = Set<members::cid>; type Name = S::Name; - type Purpose = S::Purpose; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); @@ -1442,20 +1453,9 @@ pub mod list_view_state { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Creator = S::Creator; - type Cid = S::Cid; - type Name = Set<members::name>; type Purpose = S::Purpose; - } - ///State transition - sets the `purpose` field to Set - pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPurpose<S> {} - impl<S: State> State for SetPurpose<S> { - type IndexedAt = S::IndexedAt; - type Uri = S::Uri; - type Creator = S::Creator; type Cid = S::Cid; - type Name = S::Name; - type Purpose = Set<members::purpose>; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -1466,12 +1466,12 @@ pub mod list_view_state { pub struct uri(()); ///Marker type for the `creator` field pub struct creator(()); + ///Marker type for the `purpose` field + pub struct purpose(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `purpose` field - pub struct purpose(()); } } @@ -1754,9 +1754,9 @@ where S::IndexedAt: list_view_state::IsSet, S::Uri: list_view_state::IsSet, S::Creator: list_view_state::IsSet, + S::Purpose: list_view_state::IsSet, S::Cid: list_view_state::IsSet, S::Name: list_view_state::IsSet, - S::Purpose: list_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListView<'a> { @@ -1931,67 +1931,67 @@ pub mod list_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Cid; type Name; + type Uri; type Purpose; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Cid = Unset; type Name = Unset; + type Uri = Unset; type Purpose = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; - type Name = S::Name; - type Purpose = S::Purpose; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Uri = S::Uri; - type Cid = Set<members::cid>; - type Name = S::Name; - type Purpose = S::Purpose; + type Cid = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type Name = Set<members::name>; type Uri = S::Uri; + type Purpose = S::Purpose; type Cid = S::Cid; - type Name = Set<members::name>; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Name = S::Name; + type Uri = Set<members::uri>; type Purpose = S::Purpose; + type Cid = S::Cid; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPurpose<S> {} impl<S: State> State for SetPurpose<S> { + type Name = S::Name; type Uri = S::Uri; + type Purpose = Set<members::purpose>; type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Name = S::Name; - type Purpose = Set<members::purpose>; + type Uri = S::Uri; + type Purpose = S::Purpose; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `purpose` field pub struct purpose(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -2208,10 +2208,10 @@ impl<'a, S: list_view_basic_state::State> ListViewBasicBuilder<'a, S> { impl<'a, S> ListViewBasicBuilder<'a, S> where S: list_view_basic_state::State, - S::Uri: list_view_basic_state::IsSet, - S::Cid: list_view_basic_state::IsSet, S::Name: list_view_basic_state::IsSet, + S::Uri: list_view_basic_state::IsSet, S::Purpose: list_view_basic_state::IsSet, + S::Cid: list_view_basic_state::IsSet, { /// Build the final struct pub fn build(self) -> ListViewBasic<'a> { @@ -2388,37 +2388,37 @@ pub mod not_found_actor_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NotFound; type Actor; + type NotFound; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NotFound = Unset; type Actor = Unset; - } - ///State transition - sets the `not_found` field to Set - pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotFound<S> {} - impl<S: State> State for SetNotFound<S> { - type NotFound = Set<members::not_found>; - type Actor = S::Actor; + type NotFound = Unset; } ///State transition - sets the `actor` field to Set pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActor<S> {} impl<S: State> State for SetActor<S> { - type NotFound = S::NotFound; type Actor = Set<members::actor>; + type NotFound = S::NotFound; + } + ///State transition - sets the `not_found` field to Set + pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotFound<S> {} + impl<S: State> State for SetNotFound<S> { + type Actor = S::Actor; + type NotFound = Set<members::not_found>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `not_found` field - pub struct not_found(()); ///Marker type for the `actor` field pub struct actor(()); + ///Marker type for the `not_found` field + pub struct not_found(()); } } @@ -2491,8 +2491,8 @@ where impl<'a, S> NotFoundActorBuilder<'a, S> where S: not_found_actor_state::State, - S::NotFound: not_found_actor_state::IsSet, S::Actor: not_found_actor_state::IsSet, + S::NotFound: not_found_actor_state::IsSet, { /// Build the final struct pub fn build(self) -> NotFoundActor<'a> { @@ -2899,85 +2899,85 @@ pub mod starter_pack_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type IndexedAt; - type Record; type Uri; + type Record; + type IndexedAt; type Creator; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type IndexedAt = Unset; - type Record = Unset; type Uri = Unset; + type Record = Unset; + type IndexedAt = Unset; type Creator = Unset; + type Cid = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type IndexedAt = S::IndexedAt; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; type Record = S::Record; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Creator = S::Creator; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { type Cid = S::Cid; - type IndexedAt = Set<members::indexed_at>; - type Record = S::Record; - type Uri = S::Uri; - type Creator = S::Creator; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Cid = S::Cid; - type IndexedAt = S::IndexedAt; - type Record = Set<members::record>; type Uri = S::Uri; + type Record = Set<members::record>; + type IndexedAt = S::IndexedAt; type Creator = S::Creator; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { type Cid = S::Cid; - type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Uri = S::Uri; type Record = S::Record; - type Uri = Set<members::uri>; + type IndexedAt = Set<members::indexed_at>; type Creator = S::Creator; + type Cid = S::Cid; } ///State transition - sets the `creator` field to Set pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreator<S> {} impl<S: State> State for SetCreator<S> { - type Cid = S::Cid; - type IndexedAt = S::IndexedAt; - type Record = S::Record; type Uri = S::Uri; + type Record = S::Record; + type IndexedAt = S::IndexedAt; type Creator = Set<members::creator>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Uri = S::Uri; + type Record = S::Record; + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `record` field - pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `creator` field pub struct creator(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -3230,11 +3230,11 @@ where impl<'a, S> StarterPackViewBuilder<'a, S> where S: starter_pack_view_state::State, - S::Cid: starter_pack_view_state::IsSet, - S::IndexedAt: starter_pack_view_state::IsSet, - S::Record: starter_pack_view_state::IsSet, S::Uri: starter_pack_view_state::IsSet, + S::Record: starter_pack_view_state::IsSet, + S::IndexedAt: starter_pack_view_state::IsSet, S::Creator: starter_pack_view_state::IsSet, + S::Cid: starter_pack_view_state::IsSet, { /// Build the final struct pub fn build(self) -> StarterPackView<'a> { @@ -3383,85 +3383,85 @@ pub mod starter_pack_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Record; - type Cid; - type Uri; type Creator; type IndexedAt; + type Cid; + type Record; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Record = Unset; - type Cid = Unset; - type Uri = Unset; type Creator = Unset; type IndexedAt = Unset; + type Cid = Unset; + type Record = Unset; + type Uri = Unset; } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { - type Record = Set<members::record>; + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type Creator = Set<members::creator>; + type IndexedAt = S::IndexedAt; type Cid = S::Cid; + type Record = S::Record; type Uri = S::Uri; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { type Creator = S::Creator; - type IndexedAt = S::IndexedAt; + type IndexedAt = Set<members::indexed_at>; + type Cid = S::Cid; + type Record = S::Record; + type Uri = S::Uri; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Record = S::Record; + type Creator = S::Creator; + type IndexedAt = S::IndexedAt; type Cid = Set<members::cid>; + type Record = S::Record; type Uri = S::Uri; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { type Creator = S::Creator; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; + type Record = Set<members::record>; + type Uri = S::Uri; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Record = S::Record; - type Cid = S::Cid; - type Uri = Set<members::uri>; type Creator = S::Creator; type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { - type Record = S::Record; type Cid = S::Cid; - type Uri = S::Uri; - type Creator = Set<members::creator>; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { type Record = S::Record; - type Cid = S::Cid; - type Uri = S::Uri; - type Creator = S::Creator; - type IndexedAt = Set<members::indexed_at>; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `record` field - pub struct record(()); - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `creator` field pub struct creator(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -3672,11 +3672,11 @@ where impl<'a, S> StarterPackViewBasicBuilder<'a, S> where S: starter_pack_view_basic_state::State, - S::Record: starter_pack_view_basic_state::IsSet, - S::Cid: starter_pack_view_basic_state::IsSet, - S::Uri: starter_pack_view_basic_state::IsSet, S::Creator: starter_pack_view_basic_state::IsSet, S::IndexedAt: starter_pack_view_basic_state::IsSet, + S::Cid: starter_pack_view_basic_state::IsSet, + S::Record: starter_pack_view_basic_state::IsSet, + S::Uri: starter_pack_view_basic_state::IsSet, { /// Build the final struct pub fn build(self) -> StarterPackViewBasic<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/follow.rs b/crates/jacquard-api/src/app_bsky/graph/follow.rs index 648570c2..c145facf 100644 --- a/crates/jacquard-api/src/app_bsky/graph/follow.rs +++ b/crates/jacquard-api/src/app_bsky/graph/follow.rs @@ -36,37 +36,37 @@ pub mod follow_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type Subject = Set<members::subject>; - type CreatedAt = S::CreatedAt; + type Subject = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Subject = S::Subject; type CreatedAt = Set<members::created_at>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type CreatedAt = S::CreatedAt; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -159,8 +159,8 @@ impl<'a, S: follow_state::State> FollowBuilder<'a, S> { impl<'a, S> FollowBuilder<'a, S> where S: follow_state::State, - S::Subject: follow_state::IsSet, S::CreatedAt: follow_state::IsSet, + S::Subject: follow_state::IsSet, { /// Build the final struct pub fn build(self) -> Follow<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/list.rs b/crates/jacquard-api/src/app_bsky/graph/list.rs index 1928e925..fbcade5a 100644 --- a/crates/jacquard-api/src/app_bsky/graph/list.rs +++ b/crates/jacquard-api/src/app_bsky/graph/list.rs @@ -51,51 +51,51 @@ pub mod list_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Purpose; type Name; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Purpose = Unset; type Name = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Purpose = S::Purpose; + type Name = S::Name; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPurpose<S> {} impl<S: State> State for SetPurpose<S> { + type CreatedAt = S::CreatedAt; type Purpose = Set<members::purpose>; type Name = S::Name; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Purpose = S::Purpose; - type Name = Set<members::name>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type Purpose = S::Purpose; - type Name = S::Name; - type CreatedAt = Set<members::created_at>; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `purpose` field pub struct purpose(()); ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -268,9 +268,9 @@ where impl<'a, S> ListBuilder<'a, S> where S: list_state::State, + S::CreatedAt: list_state::IsSet, S::Purpose: list_state::IsSet, S::Name: list_state::IsSet, - S::CreatedAt: list_state::IsSet, { /// Build the final struct pub fn build(self) -> List<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/listblock.rs b/crates/jacquard-api/src/app_bsky/graph/listblock.rs index 84dfe126..1faa4478 100644 --- a/crates/jacquard-api/src/app_bsky/graph/listblock.rs +++ b/crates/jacquard-api/src/app_bsky/graph/listblock.rs @@ -34,37 +34,37 @@ pub mod listblock_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type Subject = Set<members::subject>; - type CreatedAt = S::CreatedAt; + type Subject = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Subject = S::Subject; type CreatedAt = Set<members::created_at>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type CreatedAt = S::CreatedAt; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> ListblockBuilder<'a, S> where S: listblock_state::State, - S::Subject: listblock_state::IsSet, S::CreatedAt: listblock_state::IsSet, + S::Subject: listblock_state::IsSet, { /// Build the final struct pub fn build(self) -> Listblock<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/listitem.rs b/crates/jacquard-api/src/app_bsky/graph/listitem.rs index 8dac7be8..351a75bb 100644 --- a/crates/jacquard-api/src/app_bsky/graph/listitem.rs +++ b/crates/jacquard-api/src/app_bsky/graph/listitem.rs @@ -38,50 +38,50 @@ pub mod listitem_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type List; - type Subject; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type List = Unset; - type Subject = Unset; type CreatedAt = Unset; + type Subject = Unset; } ///State transition - sets the `list` field to Set pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetList<S> {} impl<S: State> State for SetList<S> { type List = Set<members::list>; - type Subject = S::Subject; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type List = S::List; - type Subject = Set<members::subject>; type CreatedAt = S::CreatedAt; + type Subject = S::Subject; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type List = S::List; - type Subject = S::Subject; type CreatedAt = Set<members::created_at>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type List = S::List; + type CreatedAt = S::CreatedAt; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `list` field pub struct list(()); - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -175,8 +175,8 @@ impl<'a, S> ListitemBuilder<'a, S> where S: listitem_state::State, S::List: listitem_state::IsSet, - S::Subject: listitem_state::IsSet, S::CreatedAt: listitem_state::IsSet, + S::Subject: listitem_state::IsSet, { /// Build the final struct pub fn build(self) -> Listitem<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/starterpack.rs b/crates/jacquard-api/src/app_bsky/graph/starterpack.rs index c05964cc..508139f6 100644 --- a/crates/jacquard-api/src/app_bsky/graph/starterpack.rs +++ b/crates/jacquard-api/src/app_bsky/graph/starterpack.rs @@ -366,51 +366,51 @@ pub mod starterpack_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Name; type List; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Name = Unset; type List = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Name = S::Name; + type List = S::List; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type CreatedAt = S::CreatedAt; type Name = Set<members::name>; type List = S::List; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `list` field to Set pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetList<S> {} impl<S: State> State for SetList<S> { - type Name = S::Name; - type List = Set<members::list>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type Name = S::Name; - type List = S::List; - type CreatedAt = Set<members::created_at>; + type List = Set<members::list>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `list` field pub struct list(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -563,9 +563,9 @@ where impl<'a, S> StarterpackBuilder<'a, S> where S: starterpack_state::State, + S::CreatedAt: starterpack_state::IsSet, S::Name: starterpack_state::IsSet, S::List: starterpack_state::IsSet, - S::CreatedAt: starterpack_state::IsSet, { /// Build the final struct pub fn build(self) -> Starterpack<'a> { diff --git a/crates/jacquard-api/src/app_bsky/graph/verification.rs b/crates/jacquard-api/src/app_bsky/graph/verification.rs index 48d7ef7e..9926e442 100644 --- a/crates/jacquard-api/src/app_bsky/graph/verification.rs +++ b/crates/jacquard-api/src/app_bsky/graph/verification.rs @@ -41,67 +41,67 @@ pub mod verification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type DisplayName; type CreatedAt; type Subject; type Handle; - type DisplayName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type DisplayName = Unset; type CreatedAt = Unset; type Subject = Unset; type Handle = Unset; - type DisplayName = Unset; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { + type DisplayName = Set<members::display_name>; + type CreatedAt = S::CreatedAt; + type Subject = S::Subject; + type Handle = S::Handle; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type DisplayName = S::DisplayName; type CreatedAt = Set<members::created_at>; type Subject = S::Subject; type Handle = S::Handle; - type DisplayName = S::DisplayName; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { + type DisplayName = S::DisplayName; type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; type Handle = S::Handle; - type DisplayName = S::DisplayName; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type Handle = Set<members::handle>; type DisplayName = S::DisplayName; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { type CreatedAt = S::CreatedAt; type Subject = S::Subject; - type Handle = S::Handle; - type DisplayName = Set<members::display_name>; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `display_name` field + pub struct display_name(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `handle` field pub struct handle(()); - ///Marker type for the `display_name` field - pub struct display_name(()); } } @@ -214,10 +214,10 @@ where impl<'a, S> VerificationBuilder<'a, S> where S: verification_state::State, + S::DisplayName: verification_state::IsSet, S::CreatedAt: verification_state::IsSet, S::Subject: verification_state::IsSet, S::Handle: verification_state::IsSet, - S::DisplayName: verification_state::IsSet, { /// Build the final struct pub fn build(self) -> Verification<'a> { diff --git a/crates/jacquard-api/src/app_bsky/labeler.rs b/crates/jacquard-api/src/app_bsky/labeler.rs index 201e1da2..a9ab87b9 100644 --- a/crates/jacquard-api/src/app_bsky/labeler.rs +++ b/crates/jacquard-api/src/app_bsky/labeler.rs @@ -632,67 +632,67 @@ pub mod labeler_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IndexedAt; - type Creator; - type Uri; type Cid; + type Uri; + type Creator; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IndexedAt = Unset; - type Creator = Unset; - type Uri = Unset; type Cid = Unset; + type Uri = Unset; + type Creator = Unset; + type IndexedAt = Unset; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type IndexedAt = Set<members::indexed_at>; - type Creator = S::Creator; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; type Uri = S::Uri; - type Cid = S::Cid; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { + type Creator = S::Creator; type IndexedAt = S::IndexedAt; - type Creator = Set<members::creator>; - type Uri = S::Uri; - type Cid = S::Cid; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type IndexedAt = S::IndexedAt; - type Creator = S::Creator; - type Uri = Set<members::uri>; type Cid = S::Cid; + type Uri = Set<members::uri>; + type Creator = S::Creator; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type Cid = S::Cid; + type Uri = S::Uri; + type Creator = Set<members::creator>; type IndexedAt = S::IndexedAt; - type Creator = S::Creator; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Cid = S::Cid; type Uri = S::Uri; - type Cid = Set<members::cid>; + type Creator = S::Creator; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `creator` field - pub struct creator(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `creator` field + pub struct creator(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -859,10 +859,10 @@ impl<'a, S: labeler_view_state::State> LabelerViewBuilder<'a, S> { impl<'a, S> LabelerViewBuilder<'a, S> where S: labeler_view_state::State, - S::IndexedAt: labeler_view_state::IsSet, - S::Creator: labeler_view_state::IsSet, - S::Uri: labeler_view_state::IsSet, S::Cid: labeler_view_state::IsSet, + S::Uri: labeler_view_state::IsSet, + S::Creator: labeler_view_state::IsSet, + S::IndexedAt: labeler_view_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelerView<'a> { @@ -985,85 +985,85 @@ pub mod labeler_view_detailed_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Policies; - type Creator; - type Cid; type IndexedAt; + type Cid; + type Creator; type Uri; + type Policies; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Policies = Unset; - type Creator = Unset; - type Cid = Unset; type IndexedAt = Unset; + type Cid = Unset; + type Creator = Unset; type Uri = Unset; + type Policies = Unset; } - ///State transition - sets the `policies` field to Set - pub struct SetPolicies<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPolicies<S> {} - impl<S: State> State for SetPolicies<S> { - type Policies = Set<members::policies>; - type Creator = S::Creator; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type IndexedAt = Set<members::indexed_at>; type Cid = S::Cid; - type IndexedAt = S::IndexedAt; + type Creator = S::Creator; type Uri = S::Uri; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { type Policies = S::Policies; - type Creator = Set<members::creator>; - type Cid = S::Cid; - type IndexedAt = S::IndexedAt; - type Uri = S::Uri; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Policies = S::Policies; - type Creator = S::Creator; - type Cid = Set<members::cid>; type IndexedAt = S::IndexedAt; + type Cid = Set<members::cid>; + type Creator = S::Creator; type Uri = S::Uri; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { type Policies = S::Policies; - type Creator = S::Creator; + } + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type IndexedAt = Set<members::indexed_at>; + type Creator = Set<members::creator>; type Uri = S::Uri; + type Policies = S::Policies; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Policies = S::Policies; - type Creator = S::Creator; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; + type Creator = S::Creator; type Uri = Set<members::uri>; + type Policies = S::Policies; + } + ///State transition - sets the `policies` field to Set + pub struct SetPolicies<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPolicies<S> {} + impl<S: State> State for SetPolicies<S> { + type IndexedAt = S::IndexedAt; + type Cid = S::Cid; + type Creator = S::Creator; + type Uri = S::Uri; + type Policies = Set<members::policies>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `policies` field - pub struct policies(()); - ///Marker type for the `creator` field - pub struct creator(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `creator` field + pub struct creator(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `policies` field + pub struct policies(()); } } @@ -1322,11 +1322,11 @@ impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S impl<'a, S> LabelerViewDetailedBuilder<'a, S> where S: labeler_view_detailed_state::State, - S::Policies: labeler_view_detailed_state::IsSet, - S::Creator: labeler_view_detailed_state::IsSet, - S::Cid: labeler_view_detailed_state::IsSet, S::IndexedAt: labeler_view_detailed_state::IsSet, + S::Cid: labeler_view_detailed_state::IsSet, + S::Creator: labeler_view_detailed_state::IsSet, S::Uri: labeler_view_detailed_state::IsSet, + S::Policies: labeler_view_detailed_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelerViewDetailed<'a> { diff --git a/crates/jacquard-api/src/app_bsky/notification.rs b/crates/jacquard-api/src/app_bsky/notification.rs index 891d7234..3ebb708a 100644 --- a/crates/jacquard-api/src/app_bsky/notification.rs +++ b/crates/jacquard-api/src/app_bsky/notification.rs @@ -1360,301 +1360,301 @@ pub mod preferences_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type RepostViaRepost; + type Chat; type Like; - type SubscribedPost; type Follow; - type Unverified; + type LikeViaRepost; + type StarterpackJoined; type Repost; + type RepostViaRepost; + type Unverified; type Verified; - type Chat; - type StarterpackJoined; - type LikeViaRepost; - type Reply; type Mention; + type Reply; type Quote; + type SubscribedPost; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type RepostViaRepost = Unset; + type Chat = Unset; type Like = Unset; - type SubscribedPost = Unset; type Follow = Unset; - type Unverified = Unset; + type LikeViaRepost = Unset; + type StarterpackJoined = Unset; type Repost = Unset; + type RepostViaRepost = Unset; + type Unverified = Unset; type Verified = Unset; - type Chat = Unset; - type StarterpackJoined = Unset; - type LikeViaRepost = Unset; - type Reply = Unset; type Mention = Unset; + type Reply = Unset; type Quote = Unset; + type SubscribedPost = Unset; } - ///State transition - sets the `repost_via_repost` field to Set - pub struct SetRepostViaRepost<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepostViaRepost<S> {} - impl<S: State> State for SetRepostViaRepost<S> { - type RepostViaRepost = Set<members::repost_via_repost>; + ///State transition - sets the `chat` field to Set + pub struct SetChat<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetChat<S> {} + impl<S: State> State for SetChat<S> { + type Chat = Set<members::chat>; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } ///State transition - sets the `like` field to Set pub struct SetLike<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLike<S> {} impl<S: State> State for SetLike<S> { - type RepostViaRepost = S::RepostViaRepost; + type Chat = S::Chat; type Like = Set<members::like>; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; - type Repost = S::Repost; - type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; - type Mention = S::Mention; - type Quote = S::Quote; - } - ///State transition - sets the `subscribed_post` field to Set - pub struct SetSubscribedPost<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubscribedPost<S> {} - impl<S: State> State for SetSubscribedPost<S> { + type StarterpackJoined = S::StarterpackJoined; + type Repost = S::Repost; type RepostViaRepost = S::RepostViaRepost; - type Like = S::Like; - type SubscribedPost = Set<members::subscribed_post>; - type Follow = S::Follow; type Unverified = S::Unverified; - type Repost = S::Repost; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } ///State transition - sets the `follow` field to Set pub struct SetFollow<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetFollow<S> {} impl<S: State> State for SetFollow<S> { - type RepostViaRepost = S::RepostViaRepost; + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = Set<members::follow>; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } - ///State transition - sets the `unverified` field to Set - pub struct SetUnverified<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUnverified<S> {} - impl<S: State> State for SetUnverified<S> { - type RepostViaRepost = S::RepostViaRepost; + ///State transition - sets the `like_via_repost` field to Set + pub struct SetLikeViaRepost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLikeViaRepost<S> {} + impl<S: State> State for SetLikeViaRepost<S> { + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = Set<members::unverified>; + type LikeViaRepost = Set<members::like_via_repost>; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; + type Mention = S::Mention; + type Reply = S::Reply; + type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; + } + ///State transition - sets the `starterpack_joined` field to Set + pub struct SetStarterpackJoined<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStarterpackJoined<S> {} + impl<S: State> State for SetStarterpackJoined<S> { type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; + type Like = S::Like; + type Follow = S::Follow; type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; + type StarterpackJoined = Set<members::starterpack_joined>; + type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type Verified = S::Verified; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } ///State transition - sets the `repost` field to Set pub struct SetRepost<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepost<S> {} impl<S: State> State for SetRepost<S> { - type RepostViaRepost = S::RepostViaRepost; + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = Set<members::repost>; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } - ///State transition - sets the `verified` field to Set - pub struct SetVerified<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetVerified<S> {} - impl<S: State> State for SetVerified<S> { - type RepostViaRepost = S::RepostViaRepost; + ///State transition - sets the `repost_via_repost` field to Set + pub struct SetRepostViaRepost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepostViaRepost<S> {} + impl<S: State> State for SetRepostViaRepost<S> { + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; - type Repost = S::Repost; - type Verified = Set<members::verified>; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; + type StarterpackJoined = S::StarterpackJoined; + type Repost = S::Repost; + type RepostViaRepost = Set<members::repost_via_repost>; + type Unverified = S::Unverified; + type Verified = S::Verified; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } - ///State transition - sets the `chat` field to Set - pub struct SetChat<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetChat<S> {} - impl<S: State> State for SetChat<S> { - type RepostViaRepost = S::RepostViaRepost; + ///State transition - sets the `unverified` field to Set + pub struct SetUnverified<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUnverified<S> {} + impl<S: State> State for SetUnverified<S> { + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = Set<members::unverified>; type Verified = S::Verified; - type Chat = Set<members::chat>; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } - ///State transition - sets the `starterpack_joined` field to Set - pub struct SetStarterpackJoined<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStarterpackJoined<S> {} - impl<S: State> State for SetStarterpackJoined<S> { - type RepostViaRepost = S::RepostViaRepost; + ///State transition - sets the `verified` field to Set + pub struct SetVerified<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetVerified<S> {} + impl<S: State> State for SetVerified<S> { + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; - type Repost = S::Repost; - type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = Set<members::starterpack_joined>; type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; + type StarterpackJoined = S::StarterpackJoined; + type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type Verified = Set<members::verified>; type Mention = S::Mention; + type Reply = S::Reply; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } - ///State transition - sets the `like_via_repost` field to Set - pub struct SetLikeViaRepost<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLikeViaRepost<S> {} - impl<S: State> State for SetLikeViaRepost<S> { - type RepostViaRepost = S::RepostViaRepost; + ///State transition - sets the `mention` field to Set + pub struct SetMention<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMention<S> {} + impl<S: State> State for SetMention<S> { + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = Set<members::like_via_repost>; + type Mention = Set<members::mention>; type Reply = S::Reply; - type Mention = S::Mention; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } ///State transition - sets the `reply` field to Set pub struct SetReply<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReply<S> {} impl<S: State> State for SetReply<S> { - type RepostViaRepost = S::RepostViaRepost; + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; - type Repost = S::Repost; - type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; type LikeViaRepost = S::LikeViaRepost; - type Reply = Set<members::reply>; - type Mention = S::Mention; - type Quote = S::Quote; - } - ///State transition - sets the `mention` field to Set - pub struct SetMention<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMention<S> {} - impl<S: State> State for SetMention<S> { + type StarterpackJoined = S::StarterpackJoined; + type Repost = S::Repost; type RepostViaRepost = S::RepostViaRepost; - type Like = S::Like; - type SubscribedPost = S::SubscribedPost; - type Follow = S::Follow; type Unverified = S::Unverified; - type Repost = S::Repost; type Verified = S::Verified; - type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; - type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; - type Mention = Set<members::mention>; + type Mention = S::Mention; + type Reply = Set<members::reply>; type Quote = S::Quote; + type SubscribedPost = S::SubscribedPost; } ///State transition - sets the `quote` field to Set pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetQuote<S> {} impl<S: State> State for SetQuote<S> { - type RepostViaRepost = S::RepostViaRepost; + type Chat = S::Chat; type Like = S::Like; - type SubscribedPost = S::SubscribedPost; type Follow = S::Follow; - type Unverified = S::Unverified; + type LikeViaRepost = S::LikeViaRepost; + type StarterpackJoined = S::StarterpackJoined; type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; type Verified = S::Verified; + type Mention = S::Mention; + type Reply = S::Reply; + type Quote = Set<members::quote>; + type SubscribedPost = S::SubscribedPost; + } + ///State transition - sets the `subscribed_post` field to Set + pub struct SetSubscribedPost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubscribedPost<S> {} + impl<S: State> State for SetSubscribedPost<S> { type Chat = S::Chat; - type StarterpackJoined = S::StarterpackJoined; + type Like = S::Like; + type Follow = S::Follow; type LikeViaRepost = S::LikeViaRepost; - type Reply = S::Reply; + type StarterpackJoined = S::StarterpackJoined; + type Repost = S::Repost; + type RepostViaRepost = S::RepostViaRepost; + type Unverified = S::Unverified; + type Verified = S::Verified; type Mention = S::Mention; - type Quote = Set<members::quote>; + type Reply = S::Reply; + type Quote = S::Quote; + type SubscribedPost = Set<members::subscribed_post>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repost_via_repost` field - pub struct repost_via_repost(()); + ///Marker type for the `chat` field + pub struct chat(()); ///Marker type for the `like` field pub struct like(()); - ///Marker type for the `subscribed_post` field - pub struct subscribed_post(()); ///Marker type for the `follow` field pub struct follow(()); - ///Marker type for the `unverified` field - pub struct unverified(()); + ///Marker type for the `like_via_repost` field + pub struct like_via_repost(()); + ///Marker type for the `starterpack_joined` field + pub struct starterpack_joined(()); ///Marker type for the `repost` field pub struct repost(()); + ///Marker type for the `repost_via_repost` field + pub struct repost_via_repost(()); + ///Marker type for the `unverified` field + pub struct unverified(()); ///Marker type for the `verified` field pub struct verified(()); - ///Marker type for the `chat` field - pub struct chat(()); - ///Marker type for the `starterpack_joined` field - pub struct starterpack_joined(()); - ///Marker type for the `like_via_repost` field - pub struct like_via_repost(()); - ///Marker type for the `reply` field - pub struct reply(()); ///Marker type for the `mention` field pub struct mention(()); + ///Marker type for the `reply` field + pub struct reply(()); ///Marker type for the `quote` field pub struct quote(()); + ///Marker type for the `subscribed_post` field + pub struct subscribed_post(()); } } @@ -1961,19 +1961,19 @@ where impl<'a, S> PreferencesBuilder<'a, S> where S: preferences_state::State, - S::RepostViaRepost: preferences_state::IsSet, + S::Chat: preferences_state::IsSet, S::Like: preferences_state::IsSet, - S::SubscribedPost: preferences_state::IsSet, S::Follow: preferences_state::IsSet, - S::Unverified: preferences_state::IsSet, + S::LikeViaRepost: preferences_state::IsSet, + S::StarterpackJoined: preferences_state::IsSet, S::Repost: preferences_state::IsSet, + S::RepostViaRepost: preferences_state::IsSet, + S::Unverified: preferences_state::IsSet, S::Verified: preferences_state::IsSet, - S::Chat: preferences_state::IsSet, - S::StarterpackJoined: preferences_state::IsSet, - S::LikeViaRepost: preferences_state::IsSet, - S::Reply: preferences_state::IsSet, S::Mention: preferences_state::IsSet, + S::Reply: preferences_state::IsSet, S::Quote: preferences_state::IsSet, + S::SubscribedPost: preferences_state::IsSet, { /// Build the final struct pub fn build(self) -> Preferences<'a> { diff --git a/crates/jacquard-api/src/app_bsky/notification/list_notifications.rs b/crates/jacquard-api/src/app_bsky/notification/list_notifications.rs index 895ba2e1..2e1ffec7 100644 --- a/crates/jacquard-api/src/app_bsky/notification/list_notifications.rs +++ b/crates/jacquard-api/src/app_bsky/notification/list_notifications.rs @@ -271,127 +271,127 @@ pub mod notification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Record; type IsRead; - type Uri; - type Cid; type IndexedAt; + type Cid; type Reason; type Author; - type Record; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Record = Unset; type IsRead = Unset; - type Uri = Unset; - type Cid = Unset; type IndexedAt = Unset; + type Cid = Unset; type Reason = Unset; type Author = Unset; - type Record = Unset; + type Uri = Unset; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Record = Set<members::record>; + type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; + type Cid = S::Cid; + type Reason = S::Reason; + type Author = S::Author; + type Uri = S::Uri; } ///State transition - sets the `is_read` field to Set pub struct SetIsRead<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIsRead<S> {} impl<S: State> State for SetIsRead<S> { + type Record = S::Record; type IsRead = Set<members::is_read>; - type Uri = S::Uri; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Reason = S::Reason; type Author = S::Author; - type Record = S::Record; + type Uri = S::Uri; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Record = S::Record; type IsRead = S::IsRead; - type Uri = Set<members::uri>; + type IndexedAt = Set<members::indexed_at>; type Cid = S::Cid; - type IndexedAt = S::IndexedAt; type Reason = S::Reason; type Author = S::Author; - type Record = S::Record; + type Uri = S::Uri; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { + type Record = S::Record; type IsRead = S::IsRead; - type Uri = S::Uri; - type Cid = Set<members::cid>; type IndexedAt = S::IndexedAt; + type Cid = Set<members::cid>; type Reason = S::Reason; type Author = S::Author; - type Record = S::Record; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type IsRead = S::IsRead; type Uri = S::Uri; - type Cid = S::Cid; - type IndexedAt = Set<members::indexed_at>; - type Reason = S::Reason; - type Author = S::Author; - type Record = S::Record; } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { + type Record = S::Record; type IsRead = S::IsRead; - type Uri = S::Uri; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Reason = Set<members::reason>; type Author = S::Author; - type Record = S::Record; + type Uri = S::Uri; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { + type Record = S::Record; type IsRead = S::IsRead; - type Uri = S::Uri; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Reason = S::Reason; type Author = Set<members::author>; - type Record = S::Record; + type Uri = S::Uri; } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Record = S::Record; type IsRead = S::IsRead; - type Uri = S::Uri; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Reason = S::Reason; type Author = S::Author; - type Record = Set<members::record>; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `record` field + pub struct record(()); ///Marker type for the `is_read` field pub struct is_read(()); - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `reason` field pub struct reason(()); ///Marker type for the `author` field pub struct author(()); - ///Marker type for the `record` field - pub struct record(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -614,13 +614,13 @@ where impl<'a, S> NotificationBuilder<'a, S> where S: notification_state::State, + S::Record: notification_state::IsSet, S::IsRead: notification_state::IsSet, - S::Uri: notification_state::IsSet, - S::Cid: notification_state::IsSet, S::IndexedAt: notification_state::IsSet, + S::Cid: notification_state::IsSet, S::Reason: notification_state::IsSet, S::Author: notification_state::IsSet, - S::Record: notification_state::IsSet, + S::Uri: notification_state::IsSet, { /// Build the final struct pub fn build(self) -> Notification<'a> { diff --git a/crates/jacquard-api/src/app_bsky/notification/register_push.rs b/crates/jacquard-api/src/app_bsky/notification/register_push.rs index 5c4181ec..a3ba27bb 100644 --- a/crates/jacquard-api/src/app_bsky/notification/register_push.rs +++ b/crates/jacquard-api/src/app_bsky/notification/register_push.rs @@ -40,67 +40,67 @@ pub mod register_push_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AppId; type ServiceDid; - type Token; type Platform; + type AppId; + type Token; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AppId = Unset; type ServiceDid = Unset; - type Token = Unset; type Platform = Unset; - } - ///State transition - sets the `app_id` field to Set - pub struct SetAppId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAppId<S> {} - impl<S: State> State for SetAppId<S> { - type AppId = Set<members::app_id>; - type ServiceDid = S::ServiceDid; - type Token = S::Token; - type Platform = S::Platform; + type AppId = Unset; + type Token = Unset; } ///State transition - sets the `service_did` field to Set pub struct SetServiceDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetServiceDid<S> {} impl<S: State> State for SetServiceDid<S> { - type AppId = S::AppId; type ServiceDid = Set<members::service_did>; - type Token = S::Token; type Platform = S::Platform; - } - ///State transition - sets the `token` field to Set - pub struct SetToken<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetToken<S> {} - impl<S: State> State for SetToken<S> { type AppId = S::AppId; - type ServiceDid = S::ServiceDid; - type Token = Set<members::token>; - type Platform = S::Platform; + type Token = S::Token; } ///State transition - sets the `platform` field to Set pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPlatform<S> {} impl<S: State> State for SetPlatform<S> { + type ServiceDid = S::ServiceDid; + type Platform = Set<members::platform>; type AppId = S::AppId; + type Token = S::Token; + } + ///State transition - sets the `app_id` field to Set + pub struct SetAppId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAppId<S> {} + impl<S: State> State for SetAppId<S> { type ServiceDid = S::ServiceDid; + type Platform = S::Platform; + type AppId = Set<members::app_id>; type Token = S::Token; - type Platform = Set<members::platform>; + } + ///State transition - sets the `token` field to Set + pub struct SetToken<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetToken<S> {} + impl<S: State> State for SetToken<S> { + type ServiceDid = S::ServiceDid; + type Platform = S::Platform; + type AppId = S::AppId; + type Token = Set<members::token>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `app_id` field - pub struct app_id(()); ///Marker type for the `service_did` field pub struct service_did(()); - ///Marker type for the `token` field - pub struct token(()); ///Marker type for the `platform` field pub struct platform(()); + ///Marker type for the `app_id` field + pub struct app_id(()); + ///Marker type for the `token` field + pub struct token(()); } } @@ -227,10 +227,10 @@ where impl<'a, S> RegisterPushBuilder<'a, S> where S: register_push_state::State, - S::AppId: register_push_state::IsSet, S::ServiceDid: register_push_state::IsSet, - S::Token: register_push_state::IsSet, S::Platform: register_push_state::IsSet, + S::AppId: register_push_state::IsSet, + S::Token: register_push_state::IsSet, { /// Build the final struct pub fn build(self) -> RegisterPush<'a> { diff --git a/crates/jacquard-api/src/app_bsky/notification/unregister_push.rs b/crates/jacquard-api/src/app_bsky/notification/unregister_push.rs index 2d62c416..4b9b9042 100644 --- a/crates/jacquard-api/src/app_bsky/notification/unregister_push.rs +++ b/crates/jacquard-api/src/app_bsky/notification/unregister_push.rs @@ -37,67 +37,67 @@ pub mod unregister_push_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ServiceDid; - type Token; type Platform; + type Token; type AppId; + type ServiceDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ServiceDid = Unset; - type Token = Unset; type Platform = Unset; + type Token = Unset; type AppId = Unset; + type ServiceDid = Unset; } - ///State transition - sets the `service_did` field to Set - pub struct SetServiceDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetServiceDid<S> {} - impl<S: State> State for SetServiceDid<S> { - type ServiceDid = Set<members::service_did>; + ///State transition - sets the `platform` field to Set + pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlatform<S> {} + impl<S: State> State for SetPlatform<S> { + type Platform = Set<members::platform>; type Token = S::Token; - type Platform = S::Platform; type AppId = S::AppId; + type ServiceDid = S::ServiceDid; } ///State transition - sets the `token` field to Set pub struct SetToken<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetToken<S> {} impl<S: State> State for SetToken<S> { - type ServiceDid = S::ServiceDid; - type Token = Set<members::token>; type Platform = S::Platform; + type Token = Set<members::token>; type AppId = S::AppId; - } - ///State transition - sets the `platform` field to Set - pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPlatform<S> {} - impl<S: State> State for SetPlatform<S> { type ServiceDid = S::ServiceDid; - type Token = S::Token; - type Platform = Set<members::platform>; - type AppId = S::AppId; } ///State transition - sets the `app_id` field to Set pub struct SetAppId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAppId<S> {} impl<S: State> State for SetAppId<S> { - type ServiceDid = S::ServiceDid; - type Token = S::Token; type Platform = S::Platform; + type Token = S::Token; type AppId = Set<members::app_id>; + type ServiceDid = S::ServiceDid; + } + ///State transition - sets the `service_did` field to Set + pub struct SetServiceDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetServiceDid<S> {} + impl<S: State> State for SetServiceDid<S> { + type Platform = S::Platform; + type Token = S::Token; + type AppId = S::AppId; + type ServiceDid = Set<members::service_did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `service_did` field - pub struct service_did(()); - ///Marker type for the `token` field - pub struct token(()); ///Marker type for the `platform` field pub struct platform(()); + ///Marker type for the `token` field + pub struct token(()); ///Marker type for the `app_id` field pub struct app_id(()); + ///Marker type for the `service_did` field + pub struct service_did(()); } } @@ -210,10 +210,10 @@ where impl<'a, S> UnregisterPushBuilder<'a, S> where S: unregister_push_state::State, - S::ServiceDid: unregister_push_state::IsSet, - S::Token: unregister_push_state::IsSet, S::Platform: unregister_push_state::IsSet, + S::Token: unregister_push_state::IsSet, S::AppId: unregister_push_state::IsSet, + S::ServiceDid: unregister_push_state::IsSet, { /// Build the final struct pub fn build(self) -> UnregisterPush<'a> { diff --git a/crates/jacquard-api/src/app_bsky/unspecced.rs b/crates/jacquard-api/src/app_bsky/unspecced.rs index 3e9e50e3..0cad8816 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced.rs @@ -81,49 +81,49 @@ pub mod age_assurance_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type AttemptId; + type CreatedAt; type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type AttemptId = Unset; + type CreatedAt = Unset; type Status = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type AttemptId = S::AttemptId; - type Status = S::Status; - } ///State transition - sets the `attempt_id` field to Set pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAttemptId<S> {} impl<S: State> State for SetAttemptId<S> { - type CreatedAt = S::CreatedAt; type AttemptId = Set<members::attempt_id>; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type AttemptId = S::AttemptId; + type CreatedAt = Set<members::created_at>; type Status = S::Status; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { - type CreatedAt = S::CreatedAt; type AttemptId = S::AttemptId; + type CreatedAt = S::CreatedAt; type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `attempt_id` field pub struct attempt_id(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `status` field pub struct status(()); } @@ -309,8 +309,8 @@ where impl<'a, S> AgeAssuranceEventBuilder<'a, S> where S: age_assurance_event_state::State, - S::CreatedAt: age_assurance_event_state::IsSet, S::AttemptId: age_assurance_event_state::IsSet, + S::CreatedAt: age_assurance_event_state::IsSet, S::Status: age_assurance_event_state::IsSet, { /// Build the final struct @@ -1941,104 +1941,104 @@ pub mod skeleton_trend_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Topic; - type DisplayName; type Dids; type StartedAt; - type Link; + type DisplayName; type PostCount; + type Link; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Topic = Unset; - type DisplayName = Unset; type Dids = Unset; type StartedAt = Unset; - type Link = Unset; + type DisplayName = Unset; type PostCount = Unset; + type Link = Unset; } ///State transition - sets the `topic` field to Set pub struct SetTopic<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTopic<S> {} impl<S: State> State for SetTopic<S> { type Topic = Set<members::topic>; - type DisplayName = S::DisplayName; type Dids = S::Dids; type StartedAt = S::StartedAt; - type Link = S::Link; + type DisplayName = S::DisplayName; type PostCount = S::PostCount; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { - type Topic = S::Topic; - type DisplayName = Set<members::display_name>; - type Dids = S::Dids; - type StartedAt = S::StartedAt; type Link = S::Link; - type PostCount = S::PostCount; } ///State transition - sets the `dids` field to Set pub struct SetDids<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDids<S> {} impl<S: State> State for SetDids<S> { type Topic = S::Topic; - type DisplayName = S::DisplayName; type Dids = Set<members::dids>; type StartedAt = S::StartedAt; - type Link = S::Link; + type DisplayName = S::DisplayName; type PostCount = S::PostCount; + type Link = S::Link; } ///State transition - sets the `started_at` field to Set pub struct SetStartedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStartedAt<S> {} impl<S: State> State for SetStartedAt<S> { type Topic = S::Topic; - type DisplayName = S::DisplayName; type Dids = S::Dids; type StartedAt = Set<members::started_at>; - type Link = S::Link; + type DisplayName = S::DisplayName; type PostCount = S::PostCount; + type Link = S::Link; } - ///State transition - sets the `link` field to Set - pub struct SetLink<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLink<S> {} - impl<S: State> State for SetLink<S> { + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { type Topic = S::Topic; - type DisplayName = S::DisplayName; type Dids = S::Dids; type StartedAt = S::StartedAt; - type Link = Set<members::link>; + type DisplayName = Set<members::display_name>; type PostCount = S::PostCount; + type Link = S::Link; } ///State transition - sets the `post_count` field to Set pub struct SetPostCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPostCount<S> {} impl<S: State> State for SetPostCount<S> { type Topic = S::Topic; - type DisplayName = S::DisplayName; type Dids = S::Dids; type StartedAt = S::StartedAt; - type Link = S::Link; + type DisplayName = S::DisplayName; type PostCount = Set<members::post_count>; + type Link = S::Link; + } + ///State transition - sets the `link` field to Set + pub struct SetLink<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLink<S> {} + impl<S: State> State for SetLink<S> { + type Topic = S::Topic; + type Dids = S::Dids; + type StartedAt = S::StartedAt; + type DisplayName = S::DisplayName; + type PostCount = S::PostCount; + type Link = Set<members::link>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `topic` field pub struct topic(()); - ///Marker type for the `display_name` field - pub struct display_name(()); ///Marker type for the `dids` field pub struct dids(()); ///Marker type for the `started_at` field pub struct started_at(()); - ///Marker type for the `link` field - pub struct link(()); + ///Marker type for the `display_name` field + pub struct display_name(()); ///Marker type for the `post_count` field pub struct post_count(()); + ///Marker type for the `link` field + pub struct link(()); } } @@ -2223,11 +2223,11 @@ impl<'a, S> SkeletonTrendBuilder<'a, S> where S: skeleton_trend_state::State, S::Topic: skeleton_trend_state::IsSet, - S::DisplayName: skeleton_trend_state::IsSet, S::Dids: skeleton_trend_state::IsSet, S::StartedAt: skeleton_trend_state::IsSet, - S::Link: skeleton_trend_state::IsSet, + S::DisplayName: skeleton_trend_state::IsSet, S::PostCount: skeleton_trend_state::IsSet, + S::Link: skeleton_trend_state::IsSet, { /// Build the final struct pub fn build(self) -> SkeletonTrend<'a> { @@ -2600,104 +2600,104 @@ pub mod thread_item_post_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Post; - type MoreReplies; - type HiddenByThreadgate; - type MutedByViewer; type MoreParents; type OpThread; + type MutedByViewer; + type HiddenByThreadgate; + type MoreReplies; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Post = Unset; - type MoreReplies = Unset; - type HiddenByThreadgate = Unset; - type MutedByViewer = Unset; type MoreParents = Unset; type OpThread = Unset; + type MutedByViewer = Unset; + type HiddenByThreadgate = Unset; + type MoreReplies = Unset; } ///State transition - sets the `post` field to Set pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPost<S> {} impl<S: State> State for SetPost<S> { type Post = Set<members::post>; - type MoreReplies = S::MoreReplies; - type HiddenByThreadgate = S::HiddenByThreadgate; - type MutedByViewer = S::MutedByViewer; type MoreParents = S::MoreParents; type OpThread = S::OpThread; - } - ///State transition - sets the `more_replies` field to Set - pub struct SetMoreReplies<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMoreReplies<S> {} - impl<S: State> State for SetMoreReplies<S> { - type Post = S::Post; - type MoreReplies = Set<members::more_replies>; - type HiddenByThreadgate = S::HiddenByThreadgate; - type MutedByViewer = S::MutedByViewer; - type MoreParents = S::MoreParents; - type OpThread = S::OpThread; - } - ///State transition - sets the `hidden_by_threadgate` field to Set - pub struct SetHiddenByThreadgate<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHiddenByThreadgate<S> {} - impl<S: State> State for SetHiddenByThreadgate<S> { - type Post = S::Post; - type MoreReplies = S::MoreReplies; - type HiddenByThreadgate = Set<members::hidden_by_threadgate>; type MutedByViewer = S::MutedByViewer; - type MoreParents = S::MoreParents; - type OpThread = S::OpThread; - } - ///State transition - sets the `muted_by_viewer` field to Set - pub struct SetMutedByViewer<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMutedByViewer<S> {} - impl<S: State> State for SetMutedByViewer<S> { - type Post = S::Post; - type MoreReplies = S::MoreReplies; type HiddenByThreadgate = S::HiddenByThreadgate; - type MutedByViewer = Set<members::muted_by_viewer>; - type MoreParents = S::MoreParents; - type OpThread = S::OpThread; + type MoreReplies = S::MoreReplies; } ///State transition - sets the `more_parents` field to Set pub struct SetMoreParents<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMoreParents<S> {} impl<S: State> State for SetMoreParents<S> { type Post = S::Post; - type MoreReplies = S::MoreReplies; - type HiddenByThreadgate = S::HiddenByThreadgate; - type MutedByViewer = S::MutedByViewer; type MoreParents = Set<members::more_parents>; type OpThread = S::OpThread; + type MutedByViewer = S::MutedByViewer; + type HiddenByThreadgate = S::HiddenByThreadgate; + type MoreReplies = S::MoreReplies; } ///State transition - sets the `op_thread` field to Set pub struct SetOpThread<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetOpThread<S> {} impl<S: State> State for SetOpThread<S> { type Post = S::Post; + type MoreParents = S::MoreParents; + type OpThread = Set<members::op_thread>; + type MutedByViewer = S::MutedByViewer; + type HiddenByThreadgate = S::HiddenByThreadgate; type MoreReplies = S::MoreReplies; + } + ///State transition - sets the `muted_by_viewer` field to Set + pub struct SetMutedByViewer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMutedByViewer<S> {} + impl<S: State> State for SetMutedByViewer<S> { + type Post = S::Post; + type MoreParents = S::MoreParents; + type OpThread = S::OpThread; + type MutedByViewer = Set<members::muted_by_viewer>; type HiddenByThreadgate = S::HiddenByThreadgate; + type MoreReplies = S::MoreReplies; + } + ///State transition - sets the `hidden_by_threadgate` field to Set + pub struct SetHiddenByThreadgate<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHiddenByThreadgate<S> {} + impl<S: State> State for SetHiddenByThreadgate<S> { + type Post = S::Post; + type MoreParents = S::MoreParents; + type OpThread = S::OpThread; type MutedByViewer = S::MutedByViewer; + type HiddenByThreadgate = Set<members::hidden_by_threadgate>; + type MoreReplies = S::MoreReplies; + } + ///State transition - sets the `more_replies` field to Set + pub struct SetMoreReplies<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMoreReplies<S> {} + impl<S: State> State for SetMoreReplies<S> { + type Post = S::Post; type MoreParents = S::MoreParents; - type OpThread = Set<members::op_thread>; + type OpThread = S::OpThread; + type MutedByViewer = S::MutedByViewer; + type HiddenByThreadgate = S::HiddenByThreadgate; + type MoreReplies = Set<members::more_replies>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `post` field pub struct post(()); - ///Marker type for the `more_replies` field - pub struct more_replies(()); - ///Marker type for the `hidden_by_threadgate` field - pub struct hidden_by_threadgate(()); - ///Marker type for the `muted_by_viewer` field - pub struct muted_by_viewer(()); ///Marker type for the `more_parents` field pub struct more_parents(()); ///Marker type for the `op_thread` field pub struct op_thread(()); + ///Marker type for the `muted_by_viewer` field + pub struct muted_by_viewer(()); + ///Marker type for the `hidden_by_threadgate` field + pub struct hidden_by_threadgate(()); + ///Marker type for the `more_replies` field + pub struct more_replies(()); } } @@ -2851,11 +2851,11 @@ impl<'a, S> ThreadItemPostBuilder<'a, S> where S: thread_item_post_state::State, S::Post: thread_item_post_state::IsSet, - S::MoreReplies: thread_item_post_state::IsSet, - S::HiddenByThreadgate: thread_item_post_state::IsSet, - S::MutedByViewer: thread_item_post_state::IsSet, S::MoreParents: thread_item_post_state::IsSet, S::OpThread: thread_item_post_state::IsSet, + S::MutedByViewer: thread_item_post_state::IsSet, + S::HiddenByThreadgate: thread_item_post_state::IsSet, + S::MoreReplies: thread_item_post_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItemPost<'a> { @@ -2946,105 +2946,105 @@ pub mod trend_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type StartedAt; - type Topic; - type PostCount; type DisplayName; + type PostCount; type Actors; type Link; + type StartedAt; + type Topic; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type StartedAt = Unset; - type Topic = Unset; - type PostCount = Unset; type DisplayName = Unset; + type PostCount = Unset; type Actors = Unset; type Link = Unset; + type StartedAt = Unset; + type Topic = Unset; } - ///State transition - sets the `started_at` field to Set - pub struct SetStartedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStartedAt<S> {} - impl<S: State> State for SetStartedAt<S> { - type StartedAt = Set<members::started_at>; - type Topic = S::Topic; + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { + type DisplayName = Set<members::display_name>; type PostCount = S::PostCount; - type DisplayName = S::DisplayName; type Actors = S::Actors; type Link = S::Link; - } - ///State transition - sets the `topic` field to Set - pub struct SetTopic<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTopic<S> {} - impl<S: State> State for SetTopic<S> { type StartedAt = S::StartedAt; - type Topic = Set<members::topic>; - type PostCount = S::PostCount; - type DisplayName = S::DisplayName; - type Actors = S::Actors; - type Link = S::Link; + type Topic = S::Topic; } ///State transition - sets the `post_count` field to Set pub struct SetPostCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPostCount<S> {} impl<S: State> State for SetPostCount<S> { - type StartedAt = S::StartedAt; - type Topic = S::Topic; - type PostCount = Set<members::post_count>; type DisplayName = S::DisplayName; + type PostCount = Set<members::post_count>; type Actors = S::Actors; type Link = S::Link; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { type StartedAt = S::StartedAt; type Topic = S::Topic; - type PostCount = S::PostCount; - type DisplayName = Set<members::display_name>; - type Actors = S::Actors; - type Link = S::Link; } ///State transition - sets the `actors` field to Set pub struct SetActors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActors<S> {} impl<S: State> State for SetActors<S> { - type StartedAt = S::StartedAt; - type Topic = S::Topic; - type PostCount = S::PostCount; type DisplayName = S::DisplayName; + type PostCount = S::PostCount; type Actors = Set<members::actors>; type Link = S::Link; + type StartedAt = S::StartedAt; + type Topic = S::Topic; } ///State transition - sets the `link` field to Set pub struct SetLink<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLink<S> {} impl<S: State> State for SetLink<S> { + type DisplayName = S::DisplayName; + type PostCount = S::PostCount; + type Actors = S::Actors; + type Link = Set<members::link>; type StartedAt = S::StartedAt; type Topic = S::Topic; + } + ///State transition - sets the `started_at` field to Set + pub struct SetStartedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStartedAt<S> {} + impl<S: State> State for SetStartedAt<S> { + type DisplayName = S::DisplayName; type PostCount = S::PostCount; + type Actors = S::Actors; + type Link = S::Link; + type StartedAt = Set<members::started_at>; + type Topic = S::Topic; + } + ///State transition - sets the `topic` field to Set + pub struct SetTopic<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTopic<S> {} + impl<S: State> State for SetTopic<S> { type DisplayName = S::DisplayName; + type PostCount = S::PostCount; type Actors = S::Actors; - type Link = Set<members::link>; + type Link = S::Link; + type StartedAt = S::StartedAt; + type Topic = Set<members::topic>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `started_at` field - pub struct started_at(()); - ///Marker type for the `topic` field - pub struct topic(()); - ///Marker type for the `post_count` field - pub struct post_count(()); ///Marker type for the `display_name` field pub struct display_name(()); + ///Marker type for the `post_count` field + pub struct post_count(()); ///Marker type for the `actors` field pub struct actors(()); ///Marker type for the `link` field pub struct link(()); + ///Marker type for the `started_at` field + pub struct started_at(()); + ///Marker type for the `topic` field + pub struct topic(()); } } @@ -3228,12 +3228,12 @@ where impl<'a, S> TrendViewBuilder<'a, S> where S: trend_view_state::State, - S::StartedAt: trend_view_state::IsSet, - S::Topic: trend_view_state::IsSet, - S::PostCount: trend_view_state::IsSet, S::DisplayName: trend_view_state::IsSet, + S::PostCount: trend_view_state::IsSet, S::Actors: trend_view_state::IsSet, S::Link: trend_view_state::IsSet, + S::StartedAt: trend_view_state::IsSet, + S::Topic: trend_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TrendView<'a> { diff --git a/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs b/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs index e5863be6..6fec900f 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_other_v2.rs @@ -189,51 +189,51 @@ pub mod thread_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Value; type Depth; type Uri; - type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Value = Unset; type Depth = Unset; type Uri = Unset; - type Value = Unset; + } + ///State transition - sets the `value` field to Set + pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValue<S> {} + impl<S: State> State for SetValue<S> { + type Value = Set<members::value>; + type Depth = S::Depth; + type Uri = S::Uri; } ///State transition - sets the `depth` field to Set pub struct SetDepth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDepth<S> {} impl<S: State> State for SetDepth<S> { + type Value = S::Value; type Depth = Set<members::depth>; type Uri = S::Uri; - type Value = S::Value; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Depth = S::Depth; - type Uri = Set<members::uri>; type Value = S::Value; - } - ///State transition - sets the `value` field to Set - pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetValue<S> {} - impl<S: State> State for SetValue<S> { type Depth = S::Depth; - type Uri = S::Uri; - type Value = Set<members::value>; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `value` field + pub struct value(()); ///Marker type for the `depth` field pub struct depth(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `value` field - pub struct value(()); } } @@ -326,9 +326,9 @@ where impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, + S::Value: thread_item_state::IsSet, S::Depth: thread_item_state::IsSet, S::Uri: thread_item_state::IsSet, - S::Value: thread_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItem<'a> { diff --git a/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_v2.rs b/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_v2.rs index 331d35da..d5988767 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_v2.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced/get_post_thread_v2.rs @@ -265,51 +265,51 @@ pub mod thread_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Uri; type Depth; type Value; - type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Uri = Unset; type Depth = Unset; type Value = Unset; - type Uri = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type Depth = S::Depth; + type Value = S::Value; } ///State transition - sets the `depth` field to Set pub struct SetDepth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDepth<S> {} impl<S: State> State for SetDepth<S> { + type Uri = S::Uri; type Depth = Set<members::depth>; type Value = S::Value; - type Uri = S::Uri; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Depth = S::Depth; - type Value = Set<members::value>; type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { type Depth = S::Depth; - type Value = S::Value; - type Uri = Set<members::uri>; + type Value = Set<members::value>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `depth` field pub struct depth(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `uri` field - pub struct uri(()); } } @@ -402,9 +402,9 @@ where impl<'a, S> ThreadItemBuilder<'a, S> where S: thread_item_state::State, + S::Uri: thread_item_state::IsSet, S::Depth: thread_item_state::IsSet, S::Value: thread_item_state::IsSet, - S::Uri: thread_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ThreadItem<'a> { diff --git a/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users.rs b/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users.rs index 15dcc7e5..77aa19c7 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users.rs @@ -127,6 +127,9 @@ where pub struct GetSuggestedUsersOutput<'a> { #[serde(borrow)] pub actors: Vec<crate::app_bsky::actor::ProfileView<'a>>, + /// Snowflake for this recommendation, use when submitting recommendation events. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub rec_id: std::option::Option<i64>, } /// Response type for diff --git a/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users_skeleton.rs b/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users_skeleton.rs index 294eacca..a7c9b79a 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users_skeleton.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced/get_suggested_users_skeleton.rs @@ -168,6 +168,9 @@ where pub struct GetSuggestedUsersSkeletonOutput<'a> { #[serde(borrow)] pub dids: Vec<jacquard_common::types::string::Did<'a>>, + /// Snowflake for this recommendation, use when submitting recommendation events. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub rec_id: std::option::Option<i64>, } /// Response type for diff --git a/crates/jacquard-api/src/app_bsky/unspecced/get_tagged_suggestions.rs b/crates/jacquard-api/src/app_bsky/unspecced/get_tagged_suggestions.rs index 3092de28..4f6a7f74 100644 --- a/crates/jacquard-api/src/app_bsky/unspecced/get_tagged_suggestions.rs +++ b/crates/jacquard-api/src/app_bsky/unspecced/get_tagged_suggestions.rs @@ -90,49 +90,49 @@ pub mod suggestion_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SubjectType; type Tag; + type SubjectType; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SubjectType = Unset; type Tag = Unset; + type SubjectType = Unset; type Subject = Unset; } - ///State transition - sets the `subject_type` field to Set - pub struct SetSubjectType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubjectType<S> {} - impl<S: State> State for SetSubjectType<S> { - type SubjectType = Set<members::subject_type>; - type Tag = S::Tag; - type Subject = S::Subject; - } ///State transition - sets the `tag` field to Set pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTag<S> {} impl<S: State> State for SetTag<S> { - type SubjectType = S::SubjectType; type Tag = Set<members::tag>; + type SubjectType = S::SubjectType; + type Subject = S::Subject; + } + ///State transition - sets the `subject_type` field to Set + pub struct SetSubjectType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubjectType<S> {} + impl<S: State> State for SetSubjectType<S> { + type Tag = S::Tag; + type SubjectType = Set<members::subject_type>; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type SubjectType = S::SubjectType; type Tag = S::Tag; + type SubjectType = S::SubjectType; type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject_type` field - pub struct subject_type(()); ///Marker type for the `tag` field pub struct tag(()); + ///Marker type for the `subject_type` field + pub struct subject_type(()); ///Marker type for the `subject` field pub struct subject(()); } @@ -227,8 +227,8 @@ where impl<'a, S> SuggestionBuilder<'a, S> where S: suggestion_state::State, - S::SubjectType: suggestion_state::IsSet, S::Tag: suggestion_state::IsSet, + S::SubjectType: suggestion_state::IsSet, S::Subject: suggestion_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_bsky/video.rs b/crates/jacquard-api/src/app_bsky/video.rs index 6fe37df9..ff1ac052 100644 --- a/crates/jacquard-api/src/app_bsky/video.rs +++ b/crates/jacquard-api/src/app_bsky/video.rs @@ -52,51 +52,51 @@ pub mod job_status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type State; type Did; type JobId; + type State; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type State = Unset; type Did = Unset; type JobId = Unset; - } - ///State transition - sets the `state` field to Set - pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetState<S> {} - impl<S: State> State for SetState<S> { - type State = Set<members::state>; - type Did = S::Did; - type JobId = S::JobId; + type State = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type State = S::State; type Did = Set<members::did>; type JobId = S::JobId; + type State = S::State; } ///State transition - sets the `job_id` field to Set pub struct SetJobId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetJobId<S> {} impl<S: State> State for SetJobId<S> { - type State = S::State; type Did = S::Did; type JobId = Set<members::job_id>; + type State = S::State; + } + ///State transition - sets the `state` field to Set + pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetState<S> {} + impl<S: State> State for SetState<S> { + type Did = S::Did; + type JobId = S::JobId; + type State = Set<members::state>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `state` field - pub struct state(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `job_id` field pub struct job_id(()); + ///Marker type for the `state` field + pub struct state(()); } } @@ -257,9 +257,9 @@ where impl<'a, S> JobStatusBuilder<'a, S> where S: job_status_state::State, - S::State: job_status_state::IsSet, S::Did: job_status_state::IsSet, S::JobId: job_status_state::IsSet, + S::State: job_status_state::IsSet, { /// Build the final struct pub fn build(self) -> JobStatus<'a> { diff --git a/crates/jacquard-api/src/app_dropanchor/checkin.rs b/crates/jacquard-api/src/app_dropanchor/checkin.rs index 68ab4718..628a97d2 100644 --- a/crates/jacquard-api/src/app_dropanchor/checkin.rs +++ b/crates/jacquard-api/src/app_dropanchor/checkin.rs @@ -747,37 +747,37 @@ pub mod checkin_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Fullsize; type Thumb; + type Fullsize; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Fullsize = Unset; type Thumb = Unset; - } - ///State transition - sets the `fullsize` field to Set - pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFullsize<S> {} - impl<S: State> State for SetFullsize<S> { - type Fullsize = Set<members::fullsize>; - type Thumb = S::Thumb; + type Fullsize = Unset; } ///State transition - sets the `thumb` field to Set pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetThumb<S> {} impl<S: State> State for SetThumb<S> { - type Fullsize = S::Fullsize; type Thumb = Set<members::thumb>; + type Fullsize = S::Fullsize; + } + ///State transition - sets the `fullsize` field to Set + pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFullsize<S> {} + impl<S: State> State for SetFullsize<S> { + type Thumb = S::Thumb; + type Fullsize = Set<members::fullsize>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `fullsize` field - pub struct fullsize(()); ///Marker type for the `thumb` field pub struct thumb(()); + ///Marker type for the `fullsize` field + pub struct fullsize(()); } } @@ -864,8 +864,8 @@ where impl<'a, S> CheckinImageBuilder<'a, S> where S: checkin_image_state::State, - S::Fullsize: checkin_image_state::IsSet, S::Thumb: checkin_image_state::IsSet, + S::Fullsize: checkin_image_state::IsSet, { /// Build the final struct pub fn build(self) -> CheckinImage<'a> { @@ -1172,67 +1172,67 @@ pub mod checkin_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Address; type Text; type Geo; + type CreatedAt; + type Address; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Address = Unset; type Text = Unset; type Geo = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Address = S::Address; - type Text = S::Text; - type Geo = S::Geo; - } - ///State transition - sets the `address` field to Set - pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAddress<S> {} - impl<S: State> State for SetAddress<S> { - type CreatedAt = S::CreatedAt; - type Address = Set<members::address>; - type Text = S::Text; - type Geo = S::Geo; + type CreatedAt = Unset; + type Address = Unset; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { - type CreatedAt = S::CreatedAt; - type Address = S::Address; type Text = Set<members::text>; type Geo = S::Geo; + type CreatedAt = S::CreatedAt; + type Address = S::Address; } ///State transition - sets the `geo` field to Set pub struct SetGeo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGeo<S> {} impl<S: State> State for SetGeo<S> { + type Text = S::Text; + type Geo = Set<members::geo>; type CreatedAt = S::CreatedAt; type Address = S::Address; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Text = S::Text; - type Geo = Set<members::geo>; + type Geo = S::Geo; + type CreatedAt = Set<members::created_at>; + type Address = S::Address; + } + ///State transition - sets the `address` field to Set + pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAddress<S> {} + impl<S: State> State for SetAddress<S> { + type Text = S::Text; + type Geo = S::Geo; + type CreatedAt = S::CreatedAt; + type Address = Set<members::address>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `address` field - pub struct address(()); ///Marker type for the `text` field pub struct text(()); ///Marker type for the `geo` field pub struct geo(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `address` field + pub struct address(()); } } @@ -1452,10 +1452,10 @@ where impl<'a, S> CheckinBuilder<'a, S> where S: checkin_state::State, - S::CreatedAt: checkin_state::IsSet, - S::Address: checkin_state::IsSet, S::Text: checkin_state::IsSet, S::Geo: checkin_state::IsSet, + S::CreatedAt: checkin_state::IsSet, + S::Address: checkin_state::IsSet, { /// Build the final struct pub fn build(self) -> Checkin<'a> { diff --git a/crates/jacquard-api/src/app_dropanchor/comment.rs b/crates/jacquard-api/src/app_dropanchor/comment.rs index 37624639..43d99035 100644 --- a/crates/jacquard-api/src/app_dropanchor/comment.rs +++ b/crates/jacquard-api/src/app_dropanchor/comment.rs @@ -38,51 +38,51 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CheckinRef; - type CreatedAt; type Text; + type CreatedAt; + type CheckinRef; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CheckinRef = Unset; - type CreatedAt = Unset; type Text = Unset; + type CreatedAt = Unset; + type CheckinRef = Unset; } - ///State transition - sets the `checkin_ref` field to Set - pub struct SetCheckinRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCheckinRef<S> {} - impl<S: State> State for SetCheckinRef<S> { - type CheckinRef = Set<members::checkin_ref>; + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type Text = Set<members::text>; type CreatedAt = S::CreatedAt; - type Text = S::Text; + type CheckinRef = S::CheckinRef; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type CheckinRef = S::CheckinRef; - type CreatedAt = Set<members::created_at>; type Text = S::Text; - } - ///State transition - sets the `text` field to Set - pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetText<S> {} - impl<S: State> State for SetText<S> { + type CreatedAt = Set<members::created_at>; type CheckinRef = S::CheckinRef; + } + ///State transition - sets the `checkin_ref` field to Set + pub struct SetCheckinRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCheckinRef<S> {} + impl<S: State> State for SetCheckinRef<S> { + type Text = S::Text; type CreatedAt = S::CreatedAt; - type Text = Set<members::text>; + type CheckinRef = Set<members::checkin_ref>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `checkin_ref` field - pub struct checkin_ref(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `text` field pub struct text(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `checkin_ref` field + pub struct checkin_ref(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::CheckinRef: comment_state::IsSet, - S::CreatedAt: comment_state::IsSet, S::Text: comment_state::IsSet, + S::CreatedAt: comment_state::IsSet, + S::CheckinRef: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { diff --git a/crates/jacquard-api/src/app_dropanchor/like.rs b/crates/jacquard-api/src/app_dropanchor/like.rs index a21e003f..e056bdcd 100644 --- a/crates/jacquard-api/src/app_dropanchor/like.rs +++ b/crates/jacquard-api/src/app_dropanchor/like.rs @@ -35,37 +35,37 @@ pub mod like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CheckinRef; type CreatedAt; + type CheckinRef; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CheckinRef = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `checkin_ref` field to Set - pub struct SetCheckinRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCheckinRef<S> {} - impl<S: State> State for SetCheckinRef<S> { - type CheckinRef = Set<members::checkin_ref>; - type CreatedAt = S::CreatedAt; + type CheckinRef = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type CheckinRef = S::CheckinRef; type CreatedAt = Set<members::created_at>; + type CheckinRef = S::CheckinRef; + } + ///State transition - sets the `checkin_ref` field to Set + pub struct SetCheckinRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCheckinRef<S> {} + impl<S: State> State for SetCheckinRef<S> { + type CreatedAt = S::CreatedAt; + type CheckinRef = Set<members::checkin_ref>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `checkin_ref` field - pub struct checkin_ref(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `checkin_ref` field + pub struct checkin_ref(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> LikeBuilder<'a, S> where S: like_state::State, - S::CheckinRef: like_state::IsSet, S::CreatedAt: like_state::IsSet, + S::CheckinRef: like_state::IsSet, { /// Build the final struct pub fn build(self) -> Like<'a> { diff --git a/crates/jacquard-api/src/app_juttu.rs b/crates/jacquard-api/src/app_juttu.rs new file mode 100644 index 00000000..8d7bfdd5 --- /dev/null +++ b/crates/jacquard-api/src/app_juttu.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod article_link; \ No newline at end of file diff --git a/crates/jacquard-api/src/app_juttu/article_link.rs b/crates/jacquard-api/src/app_juttu/article_link.rs new file mode 100644 index 00000000..5f072a39 --- /dev/null +++ b/crates/jacquard-api/src/app_juttu/article_link.rs @@ -0,0 +1,443 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: app.juttu.articleLink +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Maps a unique article ID to its Bluesky comments thread, preserving original creation time. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ArticleLink<'a> { + /// The site-specific unique identifier for the article (e.g., slug). + #[serde(borrow)] + pub article_id: jacquard_common::CowStr<'a>, + /// The URL of the article. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub article_url: std::option::Option<jacquard_common::types::string::Uri<'a>>, + /// A strong reference to the root post (e.g., app.bsky.feed.post) of the comments thread. + #[serde(borrow)] + pub comments_thread: crate::com_atproto::repo::strong_ref::StrongRef<'a>, + /// The original publication timestamp of the article. + pub created_at: jacquard_common::types::string::Datetime, +} + +pub mod article_link_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CommentsThread; + type CreatedAt; + type ArticleId; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CommentsThread = Unset; + type CreatedAt = Unset; + type ArticleId = Unset; + } + ///State transition - sets the `comments_thread` field to Set + pub struct SetCommentsThread<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCommentsThread<S> {} + impl<S: State> State for SetCommentsThread<S> { + type CommentsThread = Set<members::comments_thread>; + type CreatedAt = S::CreatedAt; + type ArticleId = S::ArticleId; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CommentsThread = S::CommentsThread; + type CreatedAt = Set<members::created_at>; + type ArticleId = S::ArticleId; + } + ///State transition - sets the `article_id` field to Set + pub struct SetArticleId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetArticleId<S> {} + impl<S: State> State for SetArticleId<S> { + type CommentsThread = S::CommentsThread; + type CreatedAt = S::CreatedAt; + type ArticleId = Set<members::article_id>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `comments_thread` field + pub struct comments_thread(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `article_id` field + pub struct article_id(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ArticleLinkBuilder<'a, S: article_link_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> ArticleLink<'a> { + /// Create a new builder for this type + pub fn new() -> ArticleLinkBuilder<'a, article_link_state::Empty> { + ArticleLinkBuilder::new() + } +} + +impl<'a> ArticleLinkBuilder<'a, article_link_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ArticleLinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ArticleLinkBuilder<'a, S> +where + S: article_link_state::State, + S::ArticleId: article_link_state::IsUnset, +{ + /// Set the `articleId` field (required) + pub fn article_id( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ArticleLinkBuilder<'a, article_link_state::SetArticleId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ArticleLinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: article_link_state::State> ArticleLinkBuilder<'a, S> { + /// Set the `articleUrl` field (optional) + pub fn article_url( + mut self, + value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `articleUrl` field to an Option value (optional) + pub fn maybe_article_url( + mut self, + value: Option<jacquard_common::types::string::Uri<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> ArticleLinkBuilder<'a, S> +where + S: article_link_state::State, + S::CommentsThread: article_link_state::IsUnset, +{ + /// Set the `commentsThread` field (required) + pub fn comments_thread( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> ArticleLinkBuilder<'a, article_link_state::SetCommentsThread<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + ArticleLinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ArticleLinkBuilder<'a, S> +where + S: article_link_state::State, + S::CreatedAt: article_link_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ArticleLinkBuilder<'a, article_link_state::SetCreatedAt<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + ArticleLinkBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ArticleLinkBuilder<'a, S> +where + S: article_link_state::State, + S::CommentsThread: article_link_state::IsSet, + S::CreatedAt: article_link_state::IsSet, + S::ArticleId: article_link_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> ArticleLink<'a> { + ArticleLink { + article_id: self.__unsafe_private_named.0.unwrap(), + article_url: self.__unsafe_private_named.1, + comments_thread: self.__unsafe_private_named.2.unwrap(), + created_at: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> ArticleLink<'a> { + ArticleLink { + article_id: self.__unsafe_private_named.0.unwrap(), + article_url: self.__unsafe_private_named.1, + comments_thread: self.__unsafe_private_named.2.unwrap(), + created_at: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ArticleLink<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ArticleLinkRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ArticleLinkGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: ArticleLink<'a>, +} + +impl From<ArticleLinkGetRecordOutput<'_>> for ArticleLink<'_> { + fn from(output: ArticleLinkGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for ArticleLink<'_> { + const NSID: &'static str = "app.juttu.articleLink"; + type Record = ArticleLinkRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ArticleLinkRecord; +impl jacquard_common::xrpc::XrpcResp for ArticleLinkRecord { + const NSID: &'static str = "app.juttu.articleLink"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ArticleLinkGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ArticleLinkRecord { + const NSID: &'static str = "app.juttu.articleLink"; + type Record = ArticleLinkRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ArticleLink<'a> { + fn nsid() -> &'static str { + "app.juttu.articleLink" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_juttu_articleLink() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.article_id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "article_id", + ), + max: 300usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_app_juttu_articleLink() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("app.juttu.articleLink"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Maps a unique article ID to its Bluesky comments thread, preserving original creation time.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("articleId"), + ::jacquard_common::smol_str::SmolStr::new_static("commentsThread"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "articleId", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The site-specific unique identifier for the article (e.g., slug).", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(300usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "articleUrl", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The URL of the article.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "commentsThread", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The original publication timestamp of the article.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/app_ocho/auth.rs b/crates/jacquard-api/src/app_ocho/auth.rs index 01826f95..be1af8a4 100644 --- a/crates/jacquard-api/src/app_ocho/auth.rs +++ b/crates/jacquard-api/src/app_ocho/auth.rs @@ -46,67 +46,67 @@ pub mod auth_callback_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; - type RefreshJwt; type AccessJwt; + type RefreshJwt; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; - type RefreshJwt = Unset; type AccessJwt = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Handle = Set<members::handle>; - type Did = S::Did; - type RefreshJwt = S::RefreshJwt; - type AccessJwt = S::AccessJwt; + type RefreshJwt = Unset; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Handle = S::Handle; type Did = Set<members::did>; - type RefreshJwt = S::RefreshJwt; type AccessJwt = S::AccessJwt; + type RefreshJwt = S::RefreshJwt; + type Handle = S::Handle; + } + ///State transition - sets the `access_jwt` field to Set + pub struct SetAccessJwt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAccessJwt<S> {} + impl<S: State> State for SetAccessJwt<S> { + type Did = S::Did; + type AccessJwt = Set<members::access_jwt>; + type RefreshJwt = S::RefreshJwt; + type Handle = S::Handle; } ///State transition - sets the `refresh_jwt` field to Set pub struct SetRefreshJwt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRefreshJwt<S> {} impl<S: State> State for SetRefreshJwt<S> { - type Handle = S::Handle; type Did = S::Did; - type RefreshJwt = Set<members::refresh_jwt>; type AccessJwt = S::AccessJwt; - } - ///State transition - sets the `access_jwt` field to Set - pub struct SetAccessJwt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAccessJwt<S> {} - impl<S: State> State for SetAccessJwt<S> { + type RefreshJwt = Set<members::refresh_jwt>; type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { type Did = S::Did; + type AccessJwt = S::AccessJwt; type RefreshJwt = S::RefreshJwt; - type AccessJwt = Set<members::access_jwt>; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `refresh_jwt` field - pub struct refresh_jwt(()); ///Marker type for the `access_jwt` field pub struct access_jwt(()); + ///Marker type for the `refresh_jwt` field + pub struct refresh_jwt(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -219,10 +219,10 @@ where impl<'a, S> AuthCallbackBuilder<'a, S> where S: auth_callback_state::State, - S::Handle: auth_callback_state::IsSet, S::Did: auth_callback_state::IsSet, - S::RefreshJwt: auth_callback_state::IsSet, S::AccessJwt: auth_callback_state::IsSet, + S::RefreshJwt: auth_callback_state::IsSet, + S::Handle: auth_callback_state::IsSet, { /// Build the final struct pub fn build(self) -> AuthCallback<'a> { diff --git a/crates/jacquard-api/src/app_ocho/auth/at_proto_callback.rs b/crates/jacquard-api/src/app_ocho/auth/at_proto_callback.rs index 9766e10c..7036e838 100644 --- a/crates/jacquard-api/src/app_ocho/auth/at_proto_callback.rs +++ b/crates/jacquard-api/src/app_ocho/auth/at_proto_callback.rs @@ -34,51 +34,51 @@ pub mod at_proto_callback_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Iss; - type Code; type State; + type Code; + type Iss; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Iss = Unset; - type Code = Unset; type State = Unset; + type Code = Unset; + type Iss = Unset; } - ///State transition - sets the `iss` field to Set - pub struct SetIss<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIss<S> {} - impl<S: State> State for SetIss<S> { - type Iss = Set<members::iss>; + ///State transition - sets the `state` field to Set + pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetState<S> {} + impl<S: State> State for SetState<S> { + type State = Set<members::state>; type Code = S::Code; - type State = S::State; + type Iss = S::Iss; } ///State transition - sets the `code` field to Set pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCode<S> {} impl<S: State> State for SetCode<S> { - type Iss = S::Iss; - type Code = Set<members::code>; type State = S::State; - } - ///State transition - sets the `state` field to Set - pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetState<S> {} - impl<S: State> State for SetState<S> { + type Code = Set<members::code>; type Iss = S::Iss; + } + ///State transition - sets the `iss` field to Set + pub struct SetIss<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIss<S> {} + impl<S: State> State for SetIss<S> { + type State = S::State; type Code = S::Code; - type State = Set<members::state>; + type Iss = Set<members::iss>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `iss` field - pub struct iss(()); - ///Marker type for the `code` field - pub struct code(()); ///Marker type for the `state` field pub struct state(()); + ///Marker type for the `code` field + pub struct code(()); + ///Marker type for the `iss` field + pub struct iss(()); } } @@ -171,9 +171,9 @@ where impl<'a, S> AtProtoCallbackBuilder<'a, S> where S: at_proto_callback_state::State, - S::Iss: at_proto_callback_state::IsSet, - S::Code: at_proto_callback_state::IsSet, S::State: at_proto_callback_state::IsSet, + S::Code: at_proto_callback_state::IsSet, + S::Iss: at_proto_callback_state::IsSet, { /// Build the final struct pub fn build(self) -> AtProtoCallback<'a> { diff --git a/crates/jacquard-api/src/app_ocho/auth/authorize.rs b/crates/jacquard-api/src/app_ocho/auth/authorize.rs index 0126b322..d9af17cd 100644 --- a/crates/jacquard-api/src/app_ocho/auth/authorize.rs +++ b/crates/jacquard-api/src/app_ocho/auth/authorize.rs @@ -33,37 +33,37 @@ pub mod authorize_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AuthorizeOptions; type Input; + type AuthorizeOptions; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AuthorizeOptions = Unset; type Input = Unset; - } - ///State transition - sets the `authorize_options` field to Set - pub struct SetAuthorizeOptions<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthorizeOptions<S> {} - impl<S: State> State for SetAuthorizeOptions<S> { - type AuthorizeOptions = Set<members::authorize_options>; - type Input = S::Input; + type AuthorizeOptions = Unset; } ///State transition - sets the `input` field to Set pub struct SetInput<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetInput<S> {} impl<S: State> State for SetInput<S> { - type AuthorizeOptions = S::AuthorizeOptions; type Input = Set<members::input>; + type AuthorizeOptions = S::AuthorizeOptions; + } + ///State transition - sets the `authorize_options` field to Set + pub struct SetAuthorizeOptions<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthorizeOptions<S> {} + impl<S: State> State for SetAuthorizeOptions<S> { + type Input = S::Input; + type AuthorizeOptions = Set<members::authorize_options>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `authorize_options` field - pub struct authorize_options(()); ///Marker type for the `input` field pub struct input(()); + ///Marker type for the `authorize_options` field + pub struct authorize_options(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> AuthorizeBuilder<'a, S> where S: authorize_state::State, - S::AuthorizeOptions: authorize_state::IsSet, S::Input: authorize_state::IsSet, + S::AuthorizeOptions: authorize_state::IsSet, { /// Build the final struct pub fn build(self) -> Authorize<'a> { diff --git a/crates/jacquard-api/src/app_ocho/auth/github_callback.rs b/crates/jacquard-api/src/app_ocho/auth/github_callback.rs index e6a09165..920da361 100644 --- a/crates/jacquard-api/src/app_ocho/auth/github_callback.rs +++ b/crates/jacquard-api/src/app_ocho/auth/github_callback.rs @@ -32,37 +32,37 @@ pub mod github_callback_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type State; type Code; + type State; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type State = Unset; type Code = Unset; - } - ///State transition - sets the `state` field to Set - pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetState<S> {} - impl<S: State> State for SetState<S> { - type State = Set<members::state>; - type Code = S::Code; + type State = Unset; } ///State transition - sets the `code` field to Set pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCode<S> {} impl<S: State> State for SetCode<S> { - type State = S::State; type Code = Set<members::code>; + type State = S::State; + } + ///State transition - sets the `state` field to Set + pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetState<S> {} + impl<S: State> State for SetState<S> { + type Code = S::Code; + type State = Set<members::state>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `state` field - pub struct state(()); ///Marker type for the `code` field pub struct code(()); + ///Marker type for the `state` field + pub struct state(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GithubCallbackBuilder<'a, S> where S: github_callback_state::State, - S::State: github_callback_state::IsSet, S::Code: github_callback_state::IsSet, + S::State: github_callback_state::IsSet, { /// Build the final struct pub fn build(self) -> GithubCallback<'a> { diff --git a/crates/jacquard-api/src/app_ocho/auth/google_callback.rs b/crates/jacquard-api/src/app_ocho/auth/google_callback.rs index fa7165b7..91fcd464 100644 --- a/crates/jacquard-api/src/app_ocho/auth/google_callback.rs +++ b/crates/jacquard-api/src/app_ocho/auth/google_callback.rs @@ -32,37 +32,37 @@ pub mod google_callback_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type State; type Code; + type State; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type State = Unset; type Code = Unset; - } - ///State transition - sets the `state` field to Set - pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetState<S> {} - impl<S: State> State for SetState<S> { - type State = Set<members::state>; - type Code = S::Code; + type State = Unset; } ///State transition - sets the `code` field to Set pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCode<S> {} impl<S: State> State for SetCode<S> { - type State = S::State; type Code = Set<members::code>; + type State = S::State; + } + ///State transition - sets the `state` field to Set + pub struct SetState<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetState<S> {} + impl<S: State> State for SetState<S> { + type Code = S::Code; + type State = Set<members::state>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `state` field - pub struct state(()); ///Marker type for the `code` field pub struct code(()); + ///Marker type for the `state` field + pub struct state(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GoogleCallbackBuilder<'a, S> where S: google_callback_state::State, - S::State: google_callback_state::IsSet, S::Code: google_callback_state::IsSet, + S::State: google_callback_state::IsSet, { /// Build the final struct pub fn build(self) -> GoogleCallback<'a> { diff --git a/crates/jacquard-api/src/app_ocho/edu/verification.rs b/crates/jacquard-api/src/app_ocho/edu/verification.rs index fd920f66..082e0a3a 100644 --- a/crates/jacquard-api/src/app_ocho/edu/verification.rs +++ b/crates/jacquard-api/src/app_ocho/edu/verification.rs @@ -38,51 +38,51 @@ pub mod verification_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type Domain; type CreatedAt; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type Domain = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type Subject = Set<members::subject>; - type Domain = S::Domain; - type CreatedAt = S::CreatedAt; + type Subject = Unset; } ///State transition - sets the `domain` field to Set pub struct SetDomain<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDomain<S> {} impl<S: State> State for SetDomain<S> { - type Subject = S::Subject; type Domain = Set<members::domain>; type CreatedAt = S::CreatedAt; + type Subject = S::Subject; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Subject = S::Subject; type Domain = S::Domain; type CreatedAt = Set<members::created_at>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Domain = S::Domain; + type CreatedAt = S::CreatedAt; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `domain` field pub struct domain(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> VerificationBuilder<'a, S> where S: verification_state::State, - S::Subject: verification_state::IsSet, S::Domain: verification_state::IsSet, S::CreatedAt: verification_state::IsSet, + S::Subject: verification_state::IsSet, { /// Build the final struct pub fn build(self) -> Verification<'a> { diff --git a/crates/jacquard-api/src/app_ocho/plugin.rs b/crates/jacquard-api/src/app_ocho/plugin.rs index 64ec787f..2a438b52 100644 --- a/crates/jacquard-api/src/app_ocho/plugin.rs +++ b/crates/jacquard-api/src/app_ocho/plugin.rs @@ -1140,51 +1140,51 @@ pub mod asset_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Blob; type Type; type Hash; + type Blob; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Blob = Unset; type Type = Unset; type Hash = Unset; - } - ///State transition - sets the `blob` field to Set - pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlob<S> {} - impl<S: State> State for SetBlob<S> { - type Blob = Set<members::blob>; - type Type = S::Type; - type Hash = S::Hash; + type Blob = Unset; } ///State transition - sets the `type` field to Set pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetType<S> {} impl<S: State> State for SetType<S> { - type Blob = S::Blob; type Type = Set<members::r#type>; type Hash = S::Hash; + type Blob = S::Blob; } ///State transition - sets the `hash` field to Set pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHash<S> {} impl<S: State> State for SetHash<S> { - type Blob = S::Blob; type Type = S::Type; type Hash = Set<members::hash>; + type Blob = S::Blob; + } + ///State transition - sets the `blob` field to Set + pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlob<S> {} + impl<S: State> State for SetBlob<S> { + type Type = S::Type; + type Hash = S::Hash; + type Blob = Set<members::blob>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `blob` field - pub struct blob(()); ///Marker type for the `type` field pub struct r#type(()); ///Marker type for the `hash` field pub struct hash(()); + ///Marker type for the `blob` field + pub struct blob(()); } } @@ -1297,9 +1297,9 @@ impl<'a, S: asset_state::State> AssetBuilder<'a, S> { impl<'a, S> AssetBuilder<'a, S> where S: asset_state::State, - S::Blob: asset_state::IsSet, S::Type: asset_state::IsSet, S::Hash: asset_state::IsSet, + S::Blob: asset_state::IsSet, { /// Build the final struct pub fn build(self) -> Asset<'a> { @@ -1726,51 +1726,51 @@ pub mod launch_asset_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; - type Key; type ContentType; + type Key; + type Url; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; - type Key = Unset; type ContentType = Unset; + type Key = Unset; + type Url = Unset; } - ///State transition - sets the `url` field to Set - pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUrl<S> {} - impl<S: State> State for SetUrl<S> { - type Url = Set<members::url>; + ///State transition - sets the `content_type` field to Set + pub struct SetContentType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContentType<S> {} + impl<S: State> State for SetContentType<S> { + type ContentType = Set<members::content_type>; type Key = S::Key; - type ContentType = S::ContentType; + type Url = S::Url; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { - type Url = S::Url; - type Key = Set<members::key>; type ContentType = S::ContentType; - } - ///State transition - sets the `content_type` field to Set - pub struct SetContentType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContentType<S> {} - impl<S: State> State for SetContentType<S> { + type Key = Set<members::key>; type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type ContentType = S::ContentType; type Key = S::Key; - type ContentType = Set<members::content_type>; + type Url = Set<members::url>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); - ///Marker type for the `key` field - pub struct key(()); ///Marker type for the `content_type` field pub struct content_type(()); + ///Marker type for the `key` field + pub struct key(()); + ///Marker type for the `url` field + pub struct url(()); } } @@ -1863,9 +1863,9 @@ where impl<'a, S> LaunchAssetBuilder<'a, S> where S: launch_asset_state::State, - S::Url: launch_asset_state::IsSet, - S::Key: launch_asset_state::IsSet, S::ContentType: launch_asset_state::IsSet, + S::Key: launch_asset_state::IsSet, + S::Url: launch_asset_state::IsSet, { /// Build the final struct pub fn build(self) -> LaunchAsset<'a> { @@ -1950,105 +1950,105 @@ pub mod manifest_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Id; type LaunchAsset; type Metadata; type Extra; - type RuntimeVersion; + type Id; type CreatedAt; + type RuntimeVersion; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Id = Unset; type LaunchAsset = Unset; type Metadata = Unset; type Extra = Unset; - type RuntimeVersion = Unset; + type Id = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { - type Id = Set<members::id>; - type LaunchAsset = S::LaunchAsset; - type Metadata = S::Metadata; - type Extra = S::Extra; - type RuntimeVersion = S::RuntimeVersion; - type CreatedAt = S::CreatedAt; + type RuntimeVersion = Unset; } ///State transition - sets the `launch_asset` field to Set pub struct SetLaunchAsset<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLaunchAsset<S> {} impl<S: State> State for SetLaunchAsset<S> { - type Id = S::Id; type LaunchAsset = Set<members::launch_asset>; type Metadata = S::Metadata; type Extra = S::Extra; - type RuntimeVersion = S::RuntimeVersion; + type Id = S::Id; type CreatedAt = S::CreatedAt; + type RuntimeVersion = S::RuntimeVersion; } ///State transition - sets the `metadata` field to Set pub struct SetMetadata<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMetadata<S> {} impl<S: State> State for SetMetadata<S> { - type Id = S::Id; type LaunchAsset = S::LaunchAsset; type Metadata = Set<members::metadata>; type Extra = S::Extra; - type RuntimeVersion = S::RuntimeVersion; + type Id = S::Id; type CreatedAt = S::CreatedAt; + type RuntimeVersion = S::RuntimeVersion; } ///State transition - sets the `extra` field to Set pub struct SetExtra<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetExtra<S> {} impl<S: State> State for SetExtra<S> { - type Id = S::Id; type LaunchAsset = S::LaunchAsset; type Metadata = S::Metadata; type Extra = Set<members::extra>; - type RuntimeVersion = S::RuntimeVersion; + type Id = S::Id; type CreatedAt = S::CreatedAt; + type RuntimeVersion = S::RuntimeVersion; } - ///State transition - sets the `runtime_version` field to Set - pub struct SetRuntimeVersion<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRuntimeVersion<S> {} - impl<S: State> State for SetRuntimeVersion<S> { - type Id = S::Id; + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { type LaunchAsset = S::LaunchAsset; type Metadata = S::Metadata; type Extra = S::Extra; - type RuntimeVersion = Set<members::runtime_version>; + type Id = Set<members::id>; type CreatedAt = S::CreatedAt; + type RuntimeVersion = S::RuntimeVersion; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Id = S::Id; type LaunchAsset = S::LaunchAsset; type Metadata = S::Metadata; type Extra = S::Extra; - type RuntimeVersion = S::RuntimeVersion; + type Id = S::Id; type CreatedAt = Set<members::created_at>; + type RuntimeVersion = S::RuntimeVersion; + } + ///State transition - sets the `runtime_version` field to Set + pub struct SetRuntimeVersion<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRuntimeVersion<S> {} + impl<S: State> State for SetRuntimeVersion<S> { + type LaunchAsset = S::LaunchAsset; + type Metadata = S::Metadata; + type Extra = S::Extra; + type Id = S::Id; + type CreatedAt = S::CreatedAt; + type RuntimeVersion = Set<members::runtime_version>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `launch_asset` field pub struct launch_asset(()); ///Marker type for the `metadata` field pub struct metadata(()); ///Marker type for the `extra` field pub struct extra(()); - ///Marker type for the `runtime_version` field - pub struct runtime_version(()); + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `runtime_version` field + pub struct runtime_version(()); } } @@ -2201,12 +2201,12 @@ where impl<'a, S> ManifestBuilder<'a, S> where S: manifest_state::State, - S::Id: manifest_state::IsSet, S::LaunchAsset: manifest_state::IsSet, S::Metadata: manifest_state::IsSet, S::Extra: manifest_state::IsSet, - S::RuntimeVersion: manifest_state::IsSet, + S::Id: manifest_state::IsSet, S::CreatedAt: manifest_state::IsSet, + S::RuntimeVersion: manifest_state::IsSet, { /// Build the final struct pub fn build(self) -> Manifest<'a> { @@ -2285,37 +2285,37 @@ pub mod manifest_extra_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ExpoGo; type ExpoClient; + type ExpoGo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ExpoGo = Unset; type ExpoClient = Unset; - } - ///State transition - sets the `expo_go` field to Set - pub struct SetExpoGo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetExpoGo<S> {} - impl<S: State> State for SetExpoGo<S> { - type ExpoGo = Set<members::expo_go>; - type ExpoClient = S::ExpoClient; + type ExpoGo = Unset; } ///State transition - sets the `expo_client` field to Set pub struct SetExpoClient<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetExpoClient<S> {} impl<S: State> State for SetExpoClient<S> { - type ExpoGo = S::ExpoGo; type ExpoClient = Set<members::expo_client>; + type ExpoGo = S::ExpoGo; + } + ///State transition - sets the `expo_go` field to Set + pub struct SetExpoGo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetExpoGo<S> {} + impl<S: State> State for SetExpoGo<S> { + type ExpoClient = S::ExpoClient; + type ExpoGo = Set<members::expo_go>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `expo_go` field - pub struct expo_go(()); ///Marker type for the `expo_client` field pub struct expo_client(()); + ///Marker type for the `expo_go` field + pub struct expo_go(()); } } @@ -2388,8 +2388,8 @@ where impl<'a, S> ManifestExtraBuilder<'a, S> where S: manifest_extra_state::State, - S::ExpoGo: manifest_extra_state::IsSet, S::ExpoClient: manifest_extra_state::IsSet, + S::ExpoGo: manifest_extra_state::IsSet, { /// Build the final struct pub fn build(self) -> ManifestExtra<'a> { diff --git a/crates/jacquard-api/src/app_ocho/plugin/get_launch_asset.rs b/crates/jacquard-api/src/app_ocho/plugin/get_launch_asset.rs index f152ea53..a49c0515 100644 --- a/crates/jacquard-api/src/app_ocho/plugin/get_launch_asset.rs +++ b/crates/jacquard-api/src/app_ocho/plugin/get_launch_asset.rs @@ -32,37 +32,37 @@ pub mod get_launch_asset_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Platform; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Platform = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Platform = S::Platform; + type Did = Unset; } ///State transition - sets the `platform` field to Set pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPlatform<S> {} impl<S: State> State for SetPlatform<S> { - type Did = S::Did; type Platform = Set<members::platform>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Platform = S::Platform; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `platform` field pub struct platform(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetLaunchAssetBuilder<'a, S> where S: get_launch_asset_state::State, - S::Did: get_launch_asset_state::IsSet, S::Platform: get_launch_asset_state::IsSet, + S::Did: get_launch_asset_state::IsSet, { /// Build the final struct pub fn build(self) -> GetLaunchAsset<'a> { diff --git a/crates/jacquard-api/src/app_offprint.rs b/crates/jacquard-api/src/app_offprint.rs new file mode 100644 index 00000000..ba2d9cbd --- /dev/null +++ b/crates/jacquard-api/src/app_offprint.rs @@ -0,0 +1,8 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod content; +pub mod document; +pub mod publication; \ No newline at end of file diff --git a/crates/jacquard-api/src/app_offprint/content.rs b/crates/jacquard-api/src/app_offprint/content.rs new file mode 100644 index 00000000..cbcb9cd2 --- /dev/null +++ b/crates/jacquard-api/src/app_offprint/content.rs @@ -0,0 +1,219 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: app.offprint.content +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Content<'a> { + /// Required array of `app.offprint.block.*` unions. + #[serde(borrow)] + pub items: Vec<ContentItemsItem<'a>>, +} + +pub mod content_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Items; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Items = Unset; + } + ///State transition - sets the `items` field to Set + pub struct SetItems<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetItems<S> {} + impl<S: State> State for SetItems<S> { + type Items = Set<members::items>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `items` field + pub struct items(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ContentBuilder<'a, S: content_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: (::core::option::Option<Vec<ContentItemsItem<'a>>>,), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Content<'a> { + /// Create a new builder for this type + pub fn new() -> ContentBuilder<'a, content_state::Empty> { + ContentBuilder::new() + } +} + +impl<'a> ContentBuilder<'a, content_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ContentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ContentBuilder<'a, S> +where + S: content_state::State, + S::Items: content_state::IsUnset, +{ + /// Set the `items` field (required) + pub fn items( + mut self, + value: impl Into<Vec<ContentItemsItem<'a>>>, + ) -> ContentBuilder<'a, content_state::SetItems<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ContentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ContentBuilder<'a, S> +where + S: content_state::State, + S::Items: content_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Content<'a> { + Content { + items: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Content<'a> { + Content { + items: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(tag = "$type")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum ContentItemsItem<'a> {} +fn lexicon_doc_app_offprint_content() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("app.offprint.content"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("items")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("items"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Required array of `app.offprint.block.*` unions.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: None, + refs: vec![ + ::jacquard_common::CowStr::new_static("app.offprint.block.text"), + ::jacquard_common::CowStr::new_static("app.offprint.block.heading"), + ::jacquard_common::CowStr::new_static("app.offprint.block.blockquote"), + ::jacquard_common::CowStr::new_static("app.offprint.block.callout"), + ::jacquard_common::CowStr::new_static("app.offprint.block.unorderedList"), + ::jacquard_common::CowStr::new_static("app.offprint.block.orderedList"), + ::jacquard_common::CowStr::new_static("app.offprint.block.todoList"), + ::jacquard_common::CowStr::new_static("app.offprint.block.image"), + ::jacquard_common::CowStr::new_static("app.offprint.block.imageGrid"), + ::jacquard_common::CowStr::new_static("app.offprint.block.button"), + ::jacquard_common::CowStr::new_static("app.offprint.block.codeBlock"), + ::jacquard_common::CowStr::new_static("app.offprint.block.horizontalRule"), + ::jacquard_common::CowStr::new_static("app.offprint.block.bskyPost"), + ::jacquard_common::CowStr::new_static("app.offprint.block.iframeEmbed"), + ::jacquard_common::CowStr::new_static("app.offprint.block.linkEmbed") + ], + closed: None, + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Content<'a> { + fn nsid() -> &'static str { + "app.offprint.content" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_offprint_content() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/app_offprint/document.rs b/crates/jacquard-api/src/app_offprint/document.rs new file mode 100644 index 00000000..a395bf4c --- /dev/null +++ b/crates/jacquard-api/src/app_offprint/document.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod article; \ No newline at end of file diff --git a/crates/jacquard-api/src/app_offprint/document/article.rs b/crates/jacquard-api/src/app_offprint/document/article.rs new file mode 100644 index 00000000..ab189c4e --- /dev/null +++ b/crates/jacquard-api/src/app_offprint/document/article.rs @@ -0,0 +1,265 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: app.offprint.document.article +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Article<'a> { + /// Required AT-URI to a `site.standard.document` compatible record. Used to display articles with-in a publication. + #[serde(borrow)] + pub document: jacquard_common::types::string::AtUri<'a>, +} + +pub mod article_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Document; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Document = Unset; + } + ///State transition - sets the `document` field to Set + pub struct SetDocument<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDocument<S> {} + impl<S: State> State for SetDocument<S> { + type Document = Set<members::document>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `document` field + pub struct document(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ArticleBuilder<'a, S: article_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Article<'a> { + /// Create a new builder for this type + pub fn new() -> ArticleBuilder<'a, article_state::Empty> { + ArticleBuilder::new() + } +} + +impl<'a> ArticleBuilder<'a, article_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ArticleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ArticleBuilder<'a, S> +where + S: article_state::State, + S::Document: article_state::IsUnset, +{ + /// Set the `document` field (required) + pub fn document( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> ArticleBuilder<'a, article_state::SetDocument<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ArticleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ArticleBuilder<'a, S> +where + S: article_state::State, + S::Document: article_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Article<'a> { + Article { + document: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Article<'a> { + Article { + document: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Article<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ArticleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ArticleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Article<'a>, +} + +impl From<ArticleGetRecordOutput<'_>> for Article<'_> { + fn from(output: ArticleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Article<'_> { + const NSID: &'static str = "app.offprint.document.article"; + type Record = ArticleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ArticleRecord; +impl jacquard_common::xrpc::XrpcResp for ArticleRecord { + const NSID: &'static str = "app.offprint.document.article"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ArticleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ArticleRecord { + const NSID: &'static str = "app.offprint.document.article"; + type Record = ArticleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Article<'a> { + fn nsid() -> &'static str { + "app.offprint.document.article" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_offprint_document_article() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_app_offprint_document_article() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("app.offprint.document.article"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("document") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "document", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Required AT-URI to a `site.standard.document` compatible record. Used to display articles with-in a publication.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/app_offprint/publication.rs b/crates/jacquard-api/src/app_offprint/publication.rs new file mode 100644 index 00000000..743b1d74 --- /dev/null +++ b/crates/jacquard-api/src/app_offprint/publication.rs @@ -0,0 +1,265 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: app.offprint.publication +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Publication<'a> { + /// Required AT-URI to a `site.standard.publication` compatible record. + #[serde(borrow)] + pub publication: jacquard_common::types::string::AtUri<'a>, +} + +pub mod publication_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Publication; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Publication = Unset; + } + ///State transition - sets the `publication` field to Set + pub struct SetPublication<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPublication<S> {} + impl<S: State> State for SetPublication<S> { + type Publication = Set<members::publication>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `publication` field + pub struct publication(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PublicationBuilder<'a, S: publication_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Publication<'a> { + /// Create a new builder for this type + pub fn new() -> PublicationBuilder<'a, publication_state::Empty> { + PublicationBuilder::new() + } +} + +impl<'a> PublicationBuilder<'a, publication_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PublicationBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PublicationBuilder<'a, S> +where + S: publication_state::State, + S::Publication: publication_state::IsUnset, +{ + /// Set the `publication` field (required) + pub fn publication( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> PublicationBuilder<'a, publication_state::SetPublication<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PublicationBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PublicationBuilder<'a, S> +where + S: publication_state::State, + S::Publication: publication_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Publication<'a> { + Publication { + publication: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Publication<'a> { + Publication { + publication: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Publication<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, PublicationRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PublicationGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Publication<'a>, +} + +impl From<PublicationGetRecordOutput<'_>> for Publication<'_> { + fn from(output: PublicationGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Publication<'_> { + const NSID: &'static str = "app.offprint.publication"; + type Record = PublicationRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct PublicationRecord; +impl jacquard_common::xrpc::XrpcResp for PublicationRecord { + const NSID: &'static str = "app.offprint.publication"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = PublicationGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for PublicationRecord { + const NSID: &'static str = "app.offprint.publication"; + type Record = PublicationRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Publication<'a> { + fn nsid() -> &'static str { + "app.offprint.publication" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_app_offprint_publication() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_app_offprint_publication() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("app.offprint.publication"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("publication") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "publication", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Required AT-URI to a `site.standard.publication` compatible record.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/app_rocksky/album.rs b/crates/jacquard-api/src/app_rocksky/album.rs index 50534461..81d950ef 100644 --- a/crates/jacquard-api/src/app_rocksky/album.rs +++ b/crates/jacquard-api/src/app_rocksky/album.rs @@ -79,49 +79,49 @@ pub mod album_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Title; type Artist; + type Title; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Title = Unset; type Artist = Unset; + type Title = Unset; type CreatedAt = Unset; } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Title = Set<members::title>; - type Artist = S::Artist; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `artist` field to Set pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetArtist<S> {} impl<S: State> State for SetArtist<S> { - type Title = S::Title; type Artist = Set<members::artist>; + type Title = S::Title; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Artist = S::Artist; + type Title = Set<members::title>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Title = S::Title; type Artist = S::Artist; + type Title = S::Title; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `artist` field pub struct artist(()); + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -415,8 +415,8 @@ impl<'a, S: album_state::State> AlbumBuilder<'a, S> { impl<'a, S> AlbumBuilder<'a, S> where S: album_state::State, - S::Title: album_state::IsSet, S::Artist: album_state::IsSet, + S::Title: album_state::IsSet, S::CreatedAt: album_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_rocksky/artist.rs b/crates/jacquard-api/src/app_rocksky/artist.rs index f00bc57e..d3b2e6f7 100644 --- a/crates/jacquard-api/src/app_rocksky/artist.rs +++ b/crates/jacquard-api/src/app_rocksky/artist.rs @@ -62,37 +62,37 @@ pub mod artist_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Name; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Name = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Name = S::Name; + type CreatedAt = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Name = S::Name; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -276,8 +276,8 @@ impl<'a, S: artist_state::State> ArtistBuilder<'a, S> { impl<'a, S> ArtistBuilder<'a, S> where S: artist_state::State, - S::CreatedAt: artist_state::IsSet, S::Name: artist_state::IsSet, + S::CreatedAt: artist_state::IsSet, { /// Build the final struct pub fn build(self) -> Artist<'a> { diff --git a/crates/jacquard-api/src/app_rocksky/playlist.rs b/crates/jacquard-api/src/app_rocksky/playlist.rs index 3b541450..2e3f083d 100644 --- a/crates/jacquard-api/src/app_rocksky/playlist.rs +++ b/crates/jacquard-api/src/app_rocksky/playlist.rs @@ -66,37 +66,37 @@ pub mod playlist_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Name; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Name = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Name = S::Name; + type CreatedAt = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Name = S::Name; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -319,8 +319,8 @@ impl<'a, S: playlist_state::State> PlaylistBuilder<'a, S> { impl<'a, S> PlaylistBuilder<'a, S> where S: playlist_state::State, - S::CreatedAt: playlist_state::IsSet, S::Name: playlist_state::IsSet, + S::CreatedAt: playlist_state::IsSet, { /// Build the final struct pub fn build(self) -> Playlist<'a> { diff --git a/crates/jacquard-api/src/app_rocksky/radio.rs b/crates/jacquard-api/src/app_rocksky/radio.rs index e795649c..139bdaf3 100644 --- a/crates/jacquard-api/src/app_rocksky/radio.rs +++ b/crates/jacquard-api/src/app_rocksky/radio.rs @@ -54,49 +54,49 @@ pub mod radio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; type Name; + type Url; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; type Name = Unset; + type Url = Unset; type CreatedAt = Unset; } - ///State transition - sets the `url` field to Set - pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUrl<S> {} - impl<S: State> State for SetUrl<S> { - type Url = Set<members::url>; - type Name = S::Name; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Url = S::Url; type Name = Set<members::name>; + type Url = S::Url; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Name = S::Name; + type Url = Set<members::url>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Url = S::Url; type Name = S::Name; + type Url = S::Url; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `url` field + pub struct url(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -268,8 +268,8 @@ impl<'a, S: radio_state::State> RadioBuilder<'a, S> { impl<'a, S> RadioBuilder<'a, S> where S: radio_state::State, - S::Url: radio_state::IsSet, S::Name: radio_state::IsSet, + S::Url: radio_state::IsSet, S::CreatedAt: radio_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_rocksky/scrobble.rs b/crates/jacquard-api/src/app_rocksky/scrobble.rs index 3cee9d68..e02c00a2 100644 --- a/crates/jacquard-api/src/app_rocksky/scrobble.rs +++ b/crates/jacquard-api/src/app_rocksky/scrobble.rs @@ -114,105 +114,105 @@ pub mod scrobble_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Title; type Album; - type Artist; type AlbumArtist; type Duration; + type Artist; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Title = Unset; type Album = Unset; - type Artist = Unset; type AlbumArtist = Unset; type Duration = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Title = S::Title; - type Album = S::Album; - type Artist = S::Artist; - type AlbumArtist = S::AlbumArtist; - type Duration = S::Duration; + type Artist = Unset; + type CreatedAt = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type CreatedAt = S::CreatedAt; type Title = Set<members::title>; type Album = S::Album; - type Artist = S::Artist; type AlbumArtist = S::AlbumArtist; type Duration = S::Duration; + type Artist = S::Artist; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `album` field to Set pub struct SetAlbum<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlbum<S> {} impl<S: State> State for SetAlbum<S> { - type CreatedAt = S::CreatedAt; type Title = S::Title; type Album = Set<members::album>; - type Artist = S::Artist; type AlbumArtist = S::AlbumArtist; type Duration = S::Duration; - } - ///State transition - sets the `artist` field to Set - pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetArtist<S> {} - impl<S: State> State for SetArtist<S> { + type Artist = S::Artist; type CreatedAt = S::CreatedAt; - type Title = S::Title; - type Album = S::Album; - type Artist = Set<members::artist>; - type AlbumArtist = S::AlbumArtist; - type Duration = S::Duration; } ///State transition - sets the `album_artist` field to Set pub struct SetAlbumArtist<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlbumArtist<S> {} impl<S: State> State for SetAlbumArtist<S> { - type CreatedAt = S::CreatedAt; type Title = S::Title; type Album = S::Album; - type Artist = S::Artist; type AlbumArtist = Set<members::album_artist>; type Duration = S::Duration; + type Artist = S::Artist; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `duration` field to Set pub struct SetDuration<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDuration<S> {} impl<S: State> State for SetDuration<S> { - type CreatedAt = S::CreatedAt; type Title = S::Title; type Album = S::Album; - type Artist = S::Artist; type AlbumArtist = S::AlbumArtist; type Duration = Set<members::duration>; + type Artist = S::Artist; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `artist` field to Set + pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetArtist<S> {} + impl<S: State> State for SetArtist<S> { + type Title = S::Title; + type Album = S::Album; + type AlbumArtist = S::AlbumArtist; + type Duration = S::Duration; + type Artist = Set<members::artist>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Title = S::Title; + type Album = S::Album; + type AlbumArtist = S::AlbumArtist; + type Duration = S::Duration; + type Artist = S::Artist; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `album` field pub struct album(()); - ///Marker type for the `artist` field - pub struct artist(()); ///Marker type for the `album_artist` field pub struct album_artist(()); ///Marker type for the `duration` field pub struct duration(()); + ///Marker type for the `artist` field + pub struct artist(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -693,12 +693,12 @@ impl<'a, S: scrobble_state::State> ScrobbleBuilder<'a, S> { impl<'a, S> ScrobbleBuilder<'a, S> where S: scrobble_state::State, - S::CreatedAt: scrobble_state::IsSet, S::Title: scrobble_state::IsSet, S::Album: scrobble_state::IsSet, - S::Artist: scrobble_state::IsSet, S::AlbumArtist: scrobble_state::IsSet, S::Duration: scrobble_state::IsSet, + S::Artist: scrobble_state::IsSet, + S::CreatedAt: scrobble_state::IsSet, { /// Build the final struct pub fn build(self) -> Scrobble<'a> { diff --git a/crates/jacquard-api/src/app_rocksky/shout.rs b/crates/jacquard-api/src/app_rocksky/shout.rs index 3d4ad47d..160341c9 100644 --- a/crates/jacquard-api/src/app_rocksky/shout.rs +++ b/crates/jacquard-api/src/app_rocksky/shout.rs @@ -50,49 +50,49 @@ pub mod shout_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; + type CreatedAt = Unset; type Message = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; - type Message = S::Message; - } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + type Message = S::Message; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; type Message = S::Message; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type CreatedAt = S::CreatedAt; type Subject = S::Subject; + type CreatedAt = S::CreatedAt; type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `message` field pub struct message(()); } @@ -207,8 +207,8 @@ where impl<'a, S> ShoutBuilder<'a, S> where S: shout_state::State, - S::CreatedAt: shout_state::IsSet, S::Subject: shout_state::IsSet, + S::CreatedAt: shout_state::IsSet, S::Message: shout_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/app_rocksky/song.rs b/crates/jacquard-api/src/app_rocksky/song.rs index 5a30d28d..3254a9e1 100644 --- a/crates/jacquard-api/src/app_rocksky/song.rs +++ b/crates/jacquard-api/src/app_rocksky/song.rs @@ -114,103 +114,103 @@ pub mod song_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Artist; type AlbumArtist; + type Duration; type CreatedAt; type Title; - type Duration; - type Artist; type Album; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Artist = Unset; type AlbumArtist = Unset; + type Duration = Unset; type CreatedAt = Unset; type Title = Unset; - type Duration = Unset; - type Artist = Unset; type Album = Unset; } + ///State transition - sets the `artist` field to Set + pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetArtist<S> {} + impl<S: State> State for SetArtist<S> { + type Artist = Set<members::artist>; + type AlbumArtist = S::AlbumArtist; + type Duration = S::Duration; + type CreatedAt = S::CreatedAt; + type Title = S::Title; + type Album = S::Album; + } ///State transition - sets the `album_artist` field to Set pub struct SetAlbumArtist<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlbumArtist<S> {} impl<S: State> State for SetAlbumArtist<S> { + type Artist = S::Artist; type AlbumArtist = Set<members::album_artist>; + type Duration = S::Duration; type CreatedAt = S::CreatedAt; type Title = S::Title; - type Duration = S::Duration; + type Album = S::Album; + } + ///State transition - sets the `duration` field to Set + pub struct SetDuration<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDuration<S> {} + impl<S: State> State for SetDuration<S> { type Artist = S::Artist; + type AlbumArtist = S::AlbumArtist; + type Duration = Set<members::duration>; + type CreatedAt = S::CreatedAt; + type Title = S::Title; type Album = S::Album; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Artist = S::Artist; type AlbumArtist = S::AlbumArtist; + type Duration = S::Duration; type CreatedAt = Set<members::created_at>; type Title = S::Title; - type Duration = S::Duration; - type Artist = S::Artist; type Album = S::Album; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type AlbumArtist = S::AlbumArtist; - type CreatedAt = S::CreatedAt; - type Title = Set<members::title>; - type Duration = S::Duration; - type Artist = S::Artist; - type Album = S::Album; - } - ///State transition - sets the `duration` field to Set - pub struct SetDuration<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDuration<S> {} - impl<S: State> State for SetDuration<S> { - type AlbumArtist = S::AlbumArtist; - type CreatedAt = S::CreatedAt; - type Title = S::Title; - type Duration = Set<members::duration>; type Artist = S::Artist; - type Album = S::Album; - } - ///State transition - sets the `artist` field to Set - pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetArtist<S> {} - impl<S: State> State for SetArtist<S> { type AlbumArtist = S::AlbumArtist; - type CreatedAt = S::CreatedAt; - type Title = S::Title; type Duration = S::Duration; - type Artist = Set<members::artist>; + type CreatedAt = S::CreatedAt; + type Title = Set<members::title>; type Album = S::Album; } ///State transition - sets the `album` field to Set pub struct SetAlbum<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlbum<S> {} impl<S: State> State for SetAlbum<S> { + type Artist = S::Artist; type AlbumArtist = S::AlbumArtist; + type Duration = S::Duration; type CreatedAt = S::CreatedAt; type Title = S::Title; - type Duration = S::Duration; - type Artist = S::Artist; type Album = Set<members::album>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `artist` field + pub struct artist(()); ///Marker type for the `album_artist` field pub struct album_artist(()); + ///Marker type for the `duration` field + pub struct duration(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `title` field pub struct title(()); - ///Marker type for the `duration` field - pub struct duration(()); - ///Marker type for the `artist` field - pub struct artist(()); ///Marker type for the `album` field pub struct album(()); } @@ -693,11 +693,11 @@ impl<'a, S: song_state::State> SongBuilder<'a, S> { impl<'a, S> SongBuilder<'a, S> where S: song_state::State, + S::Artist: song_state::IsSet, S::AlbumArtist: song_state::IsSet, + S::Duration: song_state::IsSet, S::CreatedAt: song_state::IsSet, S::Title: song_state::IsSet, - S::Duration: song_state::IsSet, - S::Artist: song_state::IsSet, S::Album: song_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/art_cllctv/embed/external.rs b/crates/jacquard-api/src/art_cllctv/embed/external.rs index 19244499..6a2f20e2 100644 --- a/crates/jacquard-api/src/art_cllctv/embed/external.rs +++ b/crates/jacquard-api/src/art_cllctv/embed/external.rs @@ -41,51 +41,51 @@ pub mod external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Description; type Uri; type Title; + type Description; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Description = Unset; type Uri = Unset; type Title = Unset; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { - type Description = Set<members::description>; - type Uri = S::Uri; - type Title = S::Title; + type Description = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Description = S::Description; type Uri = Set<members::uri>; type Title = S::Title; + type Description = S::Description; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Description = S::Description; type Uri = S::Uri; type Title = Set<members::title>; + type Description = S::Description; + } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type Uri = S::Uri; + type Title = S::Title; + type Description = Set<members::description>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `description` field + pub struct description(()); } } @@ -218,9 +218,9 @@ where impl<'a, S> ExternalBuilder<'a, S> where S: external_state::State, - S::Description: external_state::IsSet, S::Uri: external_state::IsSet, S::Title: external_state::IsSet, + S::Description: external_state::IsSet, { /// Build the final struct pub fn build(self) -> External<'a> { @@ -525,51 +525,51 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Title; - type Description; type Uri; + type Description; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Title = Unset; - type Description = Unset; type Uri = Unset; + type Description = Unset; + type Title = Unset; } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Title = Set<members::title>; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; type Description = S::Description; - type Uri = S::Uri; + type Title = S::Title; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Title = S::Title; - type Description = Set<members::description>; type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { + type Description = Set<members::description>; type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Uri = S::Uri; type Description = S::Description; - type Uri = Set<members::uri>; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `title` field - pub struct title(()); - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -682,9 +682,9 @@ where impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Title: view_state::IsSet, - S::Description: view_state::IsSet, S::Uri: view_state::IsSet, + S::Description: view_state::IsSet, + S::Title: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { diff --git a/crates/jacquard-api/src/art_cllctv/embed/images.rs b/crates/jacquard-api/src/art_cllctv/embed/images.rs index a943e6de..9f023e70 100644 --- a/crates/jacquard-api/src/art_cllctv/embed/images.rs +++ b/crates/jacquard-api/src/art_cllctv/embed/images.rs @@ -43,37 +43,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Alt; type Image; + type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Alt = Unset; type Image = Unset; - } - ///State transition - sets the `alt` field to Set - pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAlt<S> {} - impl<S: State> State for SetAlt<S> { - type Alt = Set<members::alt>; - type Image = S::Image; + type Alt = Unset; } ///State transition - sets the `image` field to Set pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetImage<S> {} impl<S: State> State for SetImage<S> { - type Alt = S::Alt; type Image = Set<members::image>; + type Alt = S::Alt; + } + ///State transition - sets the `alt` field to Set + pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAlt<S> {} + impl<S: State> State for SetAlt<S> { + type Image = S::Image; + type Alt = Set<members::alt>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `alt` field - pub struct alt(()); ///Marker type for the `image` field pub struct image(()); + ///Marker type for the `alt` field + pub struct alt(()); } } @@ -206,8 +206,8 @@ impl<'a, S: image_state::State> ImageBuilder<'a, S> { impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Alt: image_state::IsSet, S::Image: image_state::IsSet, + S::Alt: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { @@ -882,49 +882,49 @@ pub mod view_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Thumb; type Fullsize; + type Thumb; type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Thumb = Unset; type Fullsize = Unset; + type Thumb = Unset; type Alt = Unset; } - ///State transition - sets the `thumb` field to Set - pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetThumb<S> {} - impl<S: State> State for SetThumb<S> { - type Thumb = Set<members::thumb>; - type Fullsize = S::Fullsize; - type Alt = S::Alt; - } ///State transition - sets the `fullsize` field to Set pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetFullsize<S> {} impl<S: State> State for SetFullsize<S> { - type Thumb = S::Thumb; type Fullsize = Set<members::fullsize>; + type Thumb = S::Thumb; + type Alt = S::Alt; + } + ///State transition - sets the `thumb` field to Set + pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetThumb<S> {} + impl<S: State> State for SetThumb<S> { + type Fullsize = S::Fullsize; + type Thumb = Set<members::thumb>; type Alt = S::Alt; } ///State transition - sets the `alt` field to Set pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlt<S> {} impl<S: State> State for SetAlt<S> { - type Thumb = S::Thumb; type Fullsize = S::Fullsize; + type Thumb = S::Thumb; type Alt = Set<members::alt>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `thumb` field - pub struct thumb(()); ///Marker type for the `fullsize` field pub struct fullsize(()); + ///Marker type for the `thumb` field + pub struct thumb(()); ///Marker type for the `alt` field pub struct alt(()); } @@ -1059,8 +1059,8 @@ impl<'a, S: view_image_state::State> ViewImageBuilder<'a, S> { impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, - S::Thumb: view_image_state::IsSet, S::Fullsize: view_image_state::IsSet, + S::Thumb: view_image_state::IsSet, S::Alt: view_image_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/beauty_cybernetic/trustcow/transaction.rs b/crates/jacquard-api/src/beauty_cybernetic/trustcow/transaction.rs index 0e86bbd8..69a40438 100644 --- a/crates/jacquard-api/src/beauty_cybernetic/trustcow/transaction.rs +++ b/crates/jacquard-api/src/beauty_cybernetic/trustcow/transaction.rs @@ -53,67 +53,67 @@ pub mod transaction_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type ServiceConsumer; + type CreatedAt; type TransactionId; type ServiceProvider; - type CreatedAt; - type ServiceConsumer; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type ServiceConsumer = Unset; + type CreatedAt = Unset; type TransactionId = Unset; type ServiceProvider = Unset; - type CreatedAt = Unset; - type ServiceConsumer = Unset; + } + ///State transition - sets the `service_consumer` field to Set + pub struct SetServiceConsumer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetServiceConsumer<S> {} + impl<S: State> State for SetServiceConsumer<S> { + type ServiceConsumer = Set<members::service_consumer>; + type CreatedAt = S::CreatedAt; + type TransactionId = S::TransactionId; + type ServiceProvider = S::ServiceProvider; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type ServiceConsumer = S::ServiceConsumer; + type CreatedAt = Set<members::created_at>; + type TransactionId = S::TransactionId; + type ServiceProvider = S::ServiceProvider; } ///State transition - sets the `transaction_id` field to Set pub struct SetTransactionId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTransactionId<S> {} impl<S: State> State for SetTransactionId<S> { + type ServiceConsumer = S::ServiceConsumer; + type CreatedAt = S::CreatedAt; type TransactionId = Set<members::transaction_id>; type ServiceProvider = S::ServiceProvider; - type CreatedAt = S::CreatedAt; - type ServiceConsumer = S::ServiceConsumer; } ///State transition - sets the `service_provider` field to Set pub struct SetServiceProvider<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetServiceProvider<S> {} impl<S: State> State for SetServiceProvider<S> { - type TransactionId = S::TransactionId; - type ServiceProvider = Set<members::service_provider>; - type CreatedAt = S::CreatedAt; - type ServiceConsumer = S::ServiceConsumer; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type TransactionId = S::TransactionId; - type ServiceProvider = S::ServiceProvider; - type CreatedAt = Set<members::created_at>; type ServiceConsumer = S::ServiceConsumer; - } - ///State transition - sets the `service_consumer` field to Set - pub struct SetServiceConsumer<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetServiceConsumer<S> {} - impl<S: State> State for SetServiceConsumer<S> { - type TransactionId = S::TransactionId; - type ServiceProvider = S::ServiceProvider; type CreatedAt = S::CreatedAt; - type ServiceConsumer = Set<members::service_consumer>; + type TransactionId = S::TransactionId; + type ServiceProvider = Set<members::service_provider>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `service_consumer` field + pub struct service_consumer(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `transaction_id` field pub struct transaction_id(()); ///Marker type for the `service_provider` field pub struct service_provider(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `service_consumer` field - pub struct service_consumer(()); } } @@ -280,10 +280,10 @@ where impl<'a, S> TransactionBuilder<'a, S> where S: transaction_state::State, + S::ServiceConsumer: transaction_state::IsSet, + S::CreatedAt: transaction_state::IsSet, S::TransactionId: transaction_state::IsSet, S::ServiceProvider: transaction_state::IsSet, - S::CreatedAt: transaction_state::IsSet, - S::ServiceConsumer: transaction_state::IsSet, { /// Build the final struct pub fn build(self) -> Transaction<'a> { diff --git a/crates/jacquard-api/src/blog_pckt.rs b/crates/jacquard-api/src/blog_pckt.rs index 5eeca3ad..04638570 100644 --- a/crates/jacquard-api/src/blog_pckt.rs +++ b/crates/jacquard-api/src/blog_pckt.rs @@ -5,6 +5,7 @@ pub mod block; pub mod blog; +pub mod content; pub mod document; pub mod mark; pub mod post; diff --git a/crates/jacquard-api/src/blog_pckt/block/image.rs b/crates/jacquard-api/src/blog_pckt/block/image.rs index 7b11ce69..315dd545 100644 --- a/crates/jacquard-api/src/blog_pckt/block/image.rs +++ b/crates/jacquard-api/src/blog_pckt/block/image.rs @@ -34,37 +34,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Height; type Width; + type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Height = Unset; type Width = Unset; - } - ///State transition - sets the `height` field to Set - pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHeight<S> {} - impl<S: State> State for SetHeight<S> { - type Height = Set<members::height>; - type Width = S::Width; + type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWidth<S> {} impl<S: State> State for SetWidth<S> { - type Height = S::Height; type Width = Set<members::width>; + type Height = S::Height; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHeight<S> {} + impl<S: State> State for SetHeight<S> { + type Width = S::Width; + type Height = Set<members::height>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `height` field - pub struct height(()); ///Marker type for the `width` field pub struct width(()); + ///Marker type for the `height` field + pub struct height(()); } } @@ -134,8 +134,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Height: aspect_ratio_state::IsSet, S::Width: aspect_ratio_state::IsSet, + S::Height: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { diff --git a/crates/jacquard-api/src/blog_pckt/block/task_item.rs b/crates/jacquard-api/src/blog_pckt/block/task_item.rs index aee720a8..8caef905 100644 --- a/crates/jacquard-api/src/blog_pckt/block/task_item.rs +++ b/crates/jacquard-api/src/blog_pckt/block/task_item.rs @@ -34,37 +34,37 @@ pub mod task_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Checked; type Content; + type Checked; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Checked = Unset; type Content = Unset; - } - ///State transition - sets the `checked` field to Set - pub struct SetChecked<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetChecked<S> {} - impl<S: State> State for SetChecked<S> { - type Checked = Set<members::checked>; - type Content = S::Content; + type Checked = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetContent<S> {} impl<S: State> State for SetContent<S> { - type Checked = S::Checked; type Content = Set<members::content>; + type Checked = S::Checked; + } + ///State transition - sets the `checked` field to Set + pub struct SetChecked<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetChecked<S> {} + impl<S: State> State for SetChecked<S> { + type Content = S::Content; + type Checked = Set<members::checked>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `checked` field - pub struct checked(()); ///Marker type for the `content` field pub struct content(()); + ///Marker type for the `checked` field + pub struct checked(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> TaskItemBuilder<'a, S> where S: task_item_state::State, - S::Checked: task_item_state::IsSet, S::Content: task_item_state::IsSet, + S::Checked: task_item_state::IsSet, { /// Build the final struct pub fn build(self) -> TaskItem<'a> { diff --git a/crates/jacquard-api/src/blog_pckt/content.rs b/crates/jacquard-api/src/blog_pckt/content.rs new file mode 100644 index 00000000..d34f19de --- /dev/null +++ b/crates/jacquard-api/src/blog_pckt/content.rs @@ -0,0 +1,190 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: blog.pckt.content +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Content<'a> { + /// Array of content blocks + #[serde(borrow)] + pub items: Vec<jacquard_common::types::value::Data<'a>>, +} + +pub mod content_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Items; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Items = Unset; + } + ///State transition - sets the `items` field to Set + pub struct SetItems<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetItems<S> {} + impl<S: State> State for SetItems<S> { + type Items = Set<members::items>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `items` field + pub struct items(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ContentBuilder<'a, S: content_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<Vec<jacquard_common::types::value::Data<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Content<'a> { + /// Create a new builder for this type + pub fn new() -> ContentBuilder<'a, content_state::Empty> { + ContentBuilder::new() + } +} + +impl<'a> ContentBuilder<'a, content_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ContentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ContentBuilder<'a, S> +where + S: content_state::State, + S::Items: content_state::IsUnset, +{ + /// Set the `items` field (required) + pub fn items( + mut self, + value: impl Into<Vec<jacquard_common::types::value::Data<'a>>>, + ) -> ContentBuilder<'a, content_state::SetItems<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ContentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ContentBuilder<'a, S> +where + S: content_state::State, + S::Items: content_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Content<'a> { + Content { + items: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Content<'a> { + Content { + items: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_blog_pckt_content() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("blog.pckt.content"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("items")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("items"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Array of content blocks", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: None, + refs: vec![], + closed: Some(false), + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Content<'a> { + fn nsid() -> &'static str { + "blog.pckt.content" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_blog_pckt_content() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/blog_pckt/document.rs b/crates/jacquard-api/src/blog_pckt/document.rs index c07ea913..b05e264c 100644 --- a/crates/jacquard-api/src/blog_pckt/document.rs +++ b/crates/jacquard-api/src/blog_pckt/document.rs @@ -33,37 +33,37 @@ pub mod document_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Site; type Document; + type Site; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Site = Unset; type Document = Unset; - } - ///State transition - sets the `site` field to Set - pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSite<S> {} - impl<S: State> State for SetSite<S> { - type Site = Set<members::site>; - type Document = S::Document; + type Site = Unset; } ///State transition - sets the `document` field to Set pub struct SetDocument<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDocument<S> {} impl<S: State> State for SetDocument<S> { - type Site = S::Site; type Document = Set<members::document>; + type Site = S::Site; + } + ///State transition - sets the `site` field to Set + pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSite<S> {} + impl<S: State> State for SetSite<S> { + type Document = S::Document; + type Site = Set<members::site>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `site` field - pub struct site(()); ///Marker type for the `document` field pub struct document(()); + ///Marker type for the `site` field + pub struct site(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> DocumentBuilder<'a, S> where S: document_state::State, - S::Site: document_state::IsSet, S::Document: document_state::IsSet, + S::Site: document_state::IsSet, { /// Build the final struct pub fn build(self) -> Document<'a> { diff --git a/crates/jacquard-api/src/blog_pckt/richtext/facet.rs b/crates/jacquard-api/src/blog_pckt/richtext/facet.rs index 77c2c9f1..03e73fe3 100644 --- a/crates/jacquard-api/src/blog_pckt/richtext/facet.rs +++ b/crates/jacquard-api/src/blog_pckt/richtext/facet.rs @@ -552,37 +552,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteStart; type ByteEnd; + type ByteStart; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteStart = Unset; type ByteEnd = Unset; - } - ///State transition - sets the `byte_start` field to Set - pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetByteStart<S> {} - impl<S: State> State for SetByteStart<S> { - type ByteStart = Set<members::byte_start>; - type ByteEnd = S::ByteEnd; + type ByteStart = Unset; } ///State transition - sets the `byte_end` field to Set pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetByteEnd<S> {} impl<S: State> State for SetByteEnd<S> { - type ByteStart = S::ByteStart; type ByteEnd = Set<members::byte_end>; + type ByteStart = S::ByteStart; + } + ///State transition - sets the `byte_start` field to Set + pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetByteStart<S> {} + impl<S: State> State for SetByteStart<S> { + type ByteEnd = S::ByteEnd; + type ByteStart = Set<members::byte_start>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_start` field - pub struct byte_start(()); ///Marker type for the `byte_end` field pub struct byte_end(()); + ///Marker type for the `byte_start` field + pub struct byte_start(()); } } @@ -652,8 +652,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteStart: byte_slice_state::IsSet, S::ByteEnd: byte_slice_state::IsSet, + S::ByteStart: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -1051,37 +1051,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Features; type Index; + type Features; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Features = Unset; type Index = Unset; - } - ///State transition - sets the `features` field to Set - pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFeatures<S> {} - impl<S: State> State for SetFeatures<S> { - type Features = Set<members::features>; - type Index = S::Index; + type Features = Unset; } ///State transition - sets the `index` field to Set pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndex<S> {} impl<S: State> State for SetIndex<S> { - type Features = S::Features; type Index = Set<members::index>; + type Features = S::Features; + } + ///State transition - sets the `features` field to Set + pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFeatures<S> {} + impl<S: State> State for SetFeatures<S> { + type Index = S::Index; + type Features = Set<members::features>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `features` field - pub struct features(()); ///Marker type for the `index` field pub struct index(()); + ///Marker type for the `features` field + pub struct features(()); } } @@ -1154,8 +1154,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Features: facet_state::IsSet, S::Index: facet_state::IsSet, + S::Features: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { diff --git a/crates/jacquard-api/src/blue__2048.rs b/crates/jacquard-api/src/blue__2048.rs index 56372485..072f98c2 100644 --- a/crates/jacquard-api/src/blue__2048.rs +++ b/crates/jacquard-api/src/blue__2048.rs @@ -43,66 +43,66 @@ pub mod sync_status_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; - type UpdatedAt; type Hash; type SyncedWithAtRepo; + type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; - type UpdatedAt = Unset; type Hash = Unset; type SyncedWithAtRepo = Unset; + type UpdatedAt = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type CreatedAt = Set<members::created_at>; - type UpdatedAt = S::UpdatedAt; - type Hash = S::Hash; - type SyncedWithAtRepo = S::SyncedWithAtRepo; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type CreatedAt = S::CreatedAt; - type UpdatedAt = Set<members::updated_at>; type Hash = S::Hash; type SyncedWithAtRepo = S::SyncedWithAtRepo; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `hash` field to Set pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHash<S> {} impl<S: State> State for SetHash<S> { type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Hash = Set<members::hash>; type SyncedWithAtRepo = S::SyncedWithAtRepo; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `synced_with_at_repo` field to Set pub struct SetSyncedWithAtRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSyncedWithAtRepo<S> {} impl<S: State> State for SetSyncedWithAtRepo<S> { type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Hash = S::Hash; type SyncedWithAtRepo = Set<members::synced_with_at_repo>; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type CreatedAt = S::CreatedAt; + type Hash = S::Hash; + type SyncedWithAtRepo = S::SyncedWithAtRepo; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `hash` field pub struct hash(()); ///Marker type for the `synced_with_at_repo` field pub struct synced_with_at_repo(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); } } @@ -216,9 +216,9 @@ impl<'a, S> SyncStatusBuilder<'a, S> where S: sync_status_state::State, S::CreatedAt: sync_status_state::IsSet, - S::UpdatedAt: sync_status_state::IsSet, S::Hash: sync_status_state::IsSet, S::SyncedWithAtRepo: sync_status_state::IsSet, + S::UpdatedAt: sync_status_state::IsSet, { /// Build the final struct pub fn build(self) -> SyncStatus<'a> { diff --git a/crates/jacquard-api/src/blue__2048/game.rs b/crates/jacquard-api/src/blue__2048/game.rs index ad1926c8..c5330362 100644 --- a/crates/jacquard-api/src/blue__2048/game.rs +++ b/crates/jacquard-api/src/blue__2048/game.rs @@ -43,105 +43,105 @@ pub mod game_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CurrentScore; type Completed; - type CreatedAt; + type CurrentScore; type SyncStatus; type SeededRecording; type Won; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CurrentScore = Unset; type Completed = Unset; - type CreatedAt = Unset; + type CurrentScore = Unset; type SyncStatus = Unset; type SeededRecording = Unset; type Won = Unset; - } - ///State transition - sets the `current_score` field to Set - pub struct SetCurrentScore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCurrentScore<S> {} - impl<S: State> State for SetCurrentScore<S> { - type CurrentScore = Set<members::current_score>; - type Completed = S::Completed; - type CreatedAt = S::CreatedAt; - type SyncStatus = S::SyncStatus; - type SeededRecording = S::SeededRecording; - type Won = S::Won; + type CreatedAt = Unset; } ///State transition - sets the `completed` field to Set pub struct SetCompleted<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCompleted<S> {} impl<S: State> State for SetCompleted<S> { - type CurrentScore = S::CurrentScore; type Completed = Set<members::completed>; - type CreatedAt = S::CreatedAt; + type CurrentScore = S::CurrentScore; type SyncStatus = S::SyncStatus; type SeededRecording = S::SeededRecording; type Won = S::Won; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CurrentScore = S::CurrentScore; + ///State transition - sets the `current_score` field to Set + pub struct SetCurrentScore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCurrentScore<S> {} + impl<S: State> State for SetCurrentScore<S> { type Completed = S::Completed; - type CreatedAt = Set<members::created_at>; + type CurrentScore = Set<members::current_score>; type SyncStatus = S::SyncStatus; type SeededRecording = S::SeededRecording; type Won = S::Won; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `sync_status` field to Set pub struct SetSyncStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSyncStatus<S> {} impl<S: State> State for SetSyncStatus<S> { - type CurrentScore = S::CurrentScore; type Completed = S::Completed; - type CreatedAt = S::CreatedAt; + type CurrentScore = S::CurrentScore; type SyncStatus = Set<members::sync_status>; type SeededRecording = S::SeededRecording; type Won = S::Won; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `seeded_recording` field to Set pub struct SetSeededRecording<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSeededRecording<S> {} impl<S: State> State for SetSeededRecording<S> { - type CurrentScore = S::CurrentScore; type Completed = S::Completed; - type CreatedAt = S::CreatedAt; + type CurrentScore = S::CurrentScore; type SyncStatus = S::SyncStatus; type SeededRecording = Set<members::seeded_recording>; type Won = S::Won; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `won` field to Set pub struct SetWon<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWon<S> {} impl<S: State> State for SetWon<S> { - type CurrentScore = S::CurrentScore; type Completed = S::Completed; - type CreatedAt = S::CreatedAt; + type CurrentScore = S::CurrentScore; type SyncStatus = S::SyncStatus; type SeededRecording = S::SeededRecording; type Won = Set<members::won>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Completed = S::Completed; + type CurrentScore = S::CurrentScore; + type SyncStatus = S::SyncStatus; + type SeededRecording = S::SeededRecording; + type Won = S::Won; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `current_score` field - pub struct current_score(()); ///Marker type for the `completed` field pub struct completed(()); - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `current_score` field + pub struct current_score(()); ///Marker type for the `sync_status` field pub struct sync_status(()); ///Marker type for the `seeded_recording` field pub struct seeded_recording(()); ///Marker type for the `won` field pub struct won(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -294,12 +294,12 @@ where impl<'a, S> GameBuilder<'a, S> where S: game_state::State, - S::CurrentScore: game_state::IsSet, S::Completed: game_state::IsSet, - S::CreatedAt: game_state::IsSet, + S::CurrentScore: game_state::IsSet, S::SyncStatus: game_state::IsSet, S::SeededRecording: game_state::IsSet, S::Won: game_state::IsSet, + S::CreatedAt: game_state::IsSet, { /// Build the final struct pub fn build(self) -> Game<'a> { diff --git a/crates/jacquard-api/src/blue__2048/key.rs b/crates/jacquard-api/src/blue__2048/key.rs index 52b5354c..36c22264 100644 --- a/crates/jacquard-api/src/blue__2048/key.rs +++ b/crates/jacquard-api/src/blue__2048/key.rs @@ -371,49 +371,49 @@ pub mod signature_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Signature; type AtUri; + type Signature; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Signature = Unset; type AtUri = Unset; + type Signature = Unset; type CreatedAt = Unset; } - ///State transition - sets the `signature` field to Set - pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSignature<S> {} - impl<S: State> State for SetSignature<S> { - type Signature = Set<members::signature>; - type AtUri = S::AtUri; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `at_uri` field to Set pub struct SetAtUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAtUri<S> {} impl<S: State> State for SetAtUri<S> { - type Signature = S::Signature; type AtUri = Set<members::at_uri>; + type Signature = S::Signature; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `signature` field to Set + pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSignature<S> {} + impl<S: State> State for SetSignature<S> { + type AtUri = S::AtUri; + type Signature = Set<members::signature>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Signature = S::Signature; type AtUri = S::AtUri; + type Signature = S::Signature; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `signature` field - pub struct signature(()); ///Marker type for the `at_uri` field pub struct at_uri(()); + ///Marker type for the `signature` field + pub struct signature(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -508,8 +508,8 @@ where impl<'a, S> SignatureRefBuilder<'a, S> where S: signature_ref_state::State, - S::Signature: signature_ref_state::IsSet, S::AtUri: signature_ref_state::IsSet, + S::Signature: signature_ref_state::IsSet, S::CreatedAt: signature_ref_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue__2048/key/game.rs b/crates/jacquard-api/src/blue__2048/key/game.rs index 2167d576..190b4d3d 100644 --- a/crates/jacquard-api/src/blue__2048/key/game.rs +++ b/crates/jacquard-api/src/blue__2048/key/game.rs @@ -34,37 +34,37 @@ pub mod game_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Key; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Key = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Key = S::Key; + type CreatedAt = Unset; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { - type CreatedAt = S::CreatedAt; type Key = Set<members::key>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Key = S::Key; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `key` field pub struct key(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> GameBuilder<'a, S> where S: game_state::State, - S::CreatedAt: game_state::IsSet, S::Key: game_state::IsSet, + S::CreatedAt: game_state::IsSet, { /// Build the final struct pub fn build(self) -> Game<'a> { diff --git a/crates/jacquard-api/src/blue__2048/key/player/stats.rs b/crates/jacquard-api/src/blue__2048/key/player/stats.rs index 5e3ba26e..e3d856cf 100644 --- a/crates/jacquard-api/src/blue__2048/key/player/stats.rs +++ b/crates/jacquard-api/src/blue__2048/key/player/stats.rs @@ -34,37 +34,37 @@ pub mod stats_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Key; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Key = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Key = S::Key; + type CreatedAt = Unset; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { - type CreatedAt = S::CreatedAt; type Key = Set<members::key>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Key = S::Key; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `key` field pub struct key(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> StatsBuilder<'a, S> where S: stats_state::State, - S::CreatedAt: stats_state::IsSet, S::Key: stats_state::IsSet, + S::CreatedAt: stats_state::IsSet, { /// Build the final struct pub fn build(self) -> Stats<'a> { diff --git a/crates/jacquard-api/src/blue__2048/player/profile.rs b/crates/jacquard-api/src/blue__2048/player/profile.rs index 81649737..aa802048 100644 --- a/crates/jacquard-api/src/blue__2048/player/profile.rs +++ b/crates/jacquard-api/src/blue__2048/player/profile.rs @@ -36,49 +36,49 @@ pub mod profile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SyncStatus; type CreatedAt; + type SyncStatus; type SoloPlay; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SyncStatus = Unset; type CreatedAt = Unset; + type SyncStatus = Unset; type SoloPlay = Unset; } - ///State transition - sets the `sync_status` field to Set - pub struct SetSyncStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSyncStatus<S> {} - impl<S: State> State for SetSyncStatus<S> { - type SyncStatus = Set<members::sync_status>; - type CreatedAt = S::CreatedAt; - type SoloPlay = S::SoloPlay; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type SyncStatus = S::SyncStatus; type CreatedAt = Set<members::created_at>; + type SyncStatus = S::SyncStatus; + type SoloPlay = S::SoloPlay; + } + ///State transition - sets the `sync_status` field to Set + pub struct SetSyncStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSyncStatus<S> {} + impl<S: State> State for SetSyncStatus<S> { + type CreatedAt = S::CreatedAt; + type SyncStatus = Set<members::sync_status>; type SoloPlay = S::SoloPlay; } ///State transition - sets the `solo_play` field to Set pub struct SetSoloPlay<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSoloPlay<S> {} impl<S: State> State for SetSoloPlay<S> { - type SyncStatus = S::SyncStatus; type CreatedAt = S::CreatedAt; + type SyncStatus = S::SyncStatus; type SoloPlay = Set<members::solo_play>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `sync_status` field - pub struct sync_status(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `sync_status` field + pub struct sync_status(()); ///Marker type for the `solo_play` field pub struct solo_play(()); } @@ -173,8 +173,8 @@ where impl<'a, S> ProfileBuilder<'a, S> where S: profile_state::State, - S::SyncStatus: profile_state::IsSet, S::CreatedAt: profile_state::IsSet, + S::SyncStatus: profile_state::IsSet, S::SoloPlay: profile_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue__2048/player/stats.rs b/crates/jacquard-api/src/blue__2048/player/stats.rs index c8180a09..0db21b8f 100644 --- a/crates/jacquard-api/src/blue__2048/player/stats.rs +++ b/crates/jacquard-api/src/blue__2048/player/stats.rs @@ -48,70 +48,56 @@ pub mod stats_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AverageScore; - type HighestScore; - type GamesPlayed; + type TotalScore; + type HighestNumberBlock; type TimesTwentyFortyEightBeenFound; type SyncStatus; + type GamesPlayed; + type HighestScore; type LeastMovesToFindTwentyFortyEight; - type TotalScore; - type HighestNumberBlock; + type AverageScore; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AverageScore = Unset; - type HighestScore = Unset; - type GamesPlayed = Unset; + type TotalScore = Unset; + type HighestNumberBlock = Unset; type TimesTwentyFortyEightBeenFound = Unset; type SyncStatus = Unset; + type GamesPlayed = Unset; + type HighestScore = Unset; type LeastMovesToFindTwentyFortyEight = Unset; - type TotalScore = Unset; - type HighestNumberBlock = Unset; + type AverageScore = Unset; type CreatedAt = Unset; } - ///State transition - sets the `average_score` field to Set - pub struct SetAverageScore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAverageScore<S> {} - impl<S: State> State for SetAverageScore<S> { - type AverageScore = Set<members::average_score>; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; - type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; - type SyncStatus = S::SyncStatus; - type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; + ///State transition - sets the `total_score` field to Set + pub struct SetTotalScore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTotalScore<S> {} + impl<S: State> State for SetTotalScore<S> { + type TotalScore = Set<members::total_score>; type HighestNumberBlock = S::HighestNumberBlock; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `highest_score` field to Set - pub struct SetHighestScore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHighestScore<S> {} - impl<S: State> State for SetHighestScore<S> { - type AverageScore = S::AverageScore; - type HighestScore = Set<members::highest_score>; - type GamesPlayed = S::GamesPlayed; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; - type HighestNumberBlock = S::HighestNumberBlock; + type AverageScore = S::AverageScore; type CreatedAt = S::CreatedAt; } - ///State transition - sets the `games_played` field to Set - pub struct SetGamesPlayed<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetGamesPlayed<S> {} - impl<S: State> State for SetGamesPlayed<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = Set<members::games_played>; + ///State transition - sets the `highest_number_block` field to Set + pub struct SetHighestNumberBlock<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHighestNumberBlock<S> {} + impl<S: State> State for SetHighestNumberBlock<S> { + type TotalScore = S::TotalScore; + type HighestNumberBlock = Set<members::highest_number_block>; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; - type HighestNumberBlock = S::HighestNumberBlock; + type AverageScore = S::AverageScore; type CreatedAt = S::CreatedAt; } ///State transition - sets the `times_twenty_forty_eight_been_found` field to Set @@ -120,30 +106,58 @@ pub mod stats_state { ); impl<S: State> sealed::Sealed for SetTimesTwentyFortyEightBeenFound<S> {} impl<S: State> State for SetTimesTwentyFortyEightBeenFound<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; type TimesTwentyFortyEightBeenFound = Set< members::times_twenty_forty_eight_been_found, >; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; - type HighestNumberBlock = S::HighestNumberBlock; + type AverageScore = S::AverageScore; type CreatedAt = S::CreatedAt; } ///State transition - sets the `sync_status` field to Set pub struct SetSyncStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSyncStatus<S> {} impl<S: State> State for SetSyncStatus<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = Set<members::sync_status>; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; + type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; + type AverageScore = S::AverageScore; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `games_played` field to Set + pub struct SetGamesPlayed<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetGamesPlayed<S> {} + impl<S: State> State for SetGamesPlayed<S> { + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; + type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; + type SyncStatus = S::SyncStatus; + type GamesPlayed = Set<members::games_played>; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; + type AverageScore = S::AverageScore; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `highest_score` field to Set + pub struct SetHighestScore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHighestScore<S> {} + impl<S: State> State for SetHighestScore<S> { type TotalScore = S::TotalScore; type HighestNumberBlock = S::HighestNumberBlock; + type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; + type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = Set<members::highest_score>; + type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; + type AverageScore = S::AverageScore; type CreatedAt = S::CreatedAt; } ///State transition - sets the `least_moves_to_find_twenty_forty_eight` field to Set @@ -152,79 +166,65 @@ pub mod stats_state { ); impl<S: State> sealed::Sealed for SetLeastMovesToFindTwentyFortyEight<S> {} impl<S: State> State for SetLeastMovesToFindTwentyFortyEight<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = Set< members::least_moves_to_find_twenty_forty_eight, >; - type TotalScore = S::TotalScore; - type HighestNumberBlock = S::HighestNumberBlock; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `total_score` field to Set - pub struct SetTotalScore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTotalScore<S> {} - impl<S: State> State for SetTotalScore<S> { type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; - type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; - type SyncStatus = S::SyncStatus; - type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = Set<members::total_score>; - type HighestNumberBlock = S::HighestNumberBlock; type CreatedAt = S::CreatedAt; } - ///State transition - sets the `highest_number_block` field to Set - pub struct SetHighestNumberBlock<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHighestNumberBlock<S> {} - impl<S: State> State for SetHighestNumberBlock<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; + ///State transition - sets the `average_score` field to Set + pub struct SetAverageScore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAverageScore<S> {} + impl<S: State> State for SetAverageScore<S> { + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; - type HighestNumberBlock = Set<members::highest_number_block>; + type AverageScore = Set<members::average_score>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type AverageScore = S::AverageScore; - type HighestScore = S::HighestScore; - type GamesPlayed = S::GamesPlayed; + type TotalScore = S::TotalScore; + type HighestNumberBlock = S::HighestNumberBlock; type TimesTwentyFortyEightBeenFound = S::TimesTwentyFortyEightBeenFound; type SyncStatus = S::SyncStatus; + type GamesPlayed = S::GamesPlayed; + type HighestScore = S::HighestScore; type LeastMovesToFindTwentyFortyEight = S::LeastMovesToFindTwentyFortyEight; - type TotalScore = S::TotalScore; - type HighestNumberBlock = S::HighestNumberBlock; + type AverageScore = S::AverageScore; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `average_score` field - pub struct average_score(()); - ///Marker type for the `highest_score` field - pub struct highest_score(()); - ///Marker type for the `games_played` field - pub struct games_played(()); + ///Marker type for the `total_score` field + pub struct total_score(()); + ///Marker type for the `highest_number_block` field + pub struct highest_number_block(()); ///Marker type for the `times_twenty_forty_eight_been_found` field pub struct times_twenty_forty_eight_been_found(()); ///Marker type for the `sync_status` field pub struct sync_status(()); + ///Marker type for the `games_played` field + pub struct games_played(()); + ///Marker type for the `highest_score` field + pub struct highest_score(()); ///Marker type for the `least_moves_to_find_twenty_forty_eight` field pub struct least_moves_to_find_twenty_forty_eight(()); - ///Marker type for the `total_score` field - pub struct total_score(()); - ///Marker type for the `highest_number_block` field - pub struct highest_number_block(()); + ///Marker type for the `average_score` field + pub struct average_score(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -449,14 +449,14 @@ where impl<'a, S> StatsBuilder<'a, S> where S: stats_state::State, - S::AverageScore: stats_state::IsSet, - S::HighestScore: stats_state::IsSet, - S::GamesPlayed: stats_state::IsSet, + S::TotalScore: stats_state::IsSet, + S::HighestNumberBlock: stats_state::IsSet, S::TimesTwentyFortyEightBeenFound: stats_state::IsSet, S::SyncStatus: stats_state::IsSet, + S::GamesPlayed: stats_state::IsSet, + S::HighestScore: stats_state::IsSet, S::LeastMovesToFindTwentyFortyEight: stats_state::IsSet, - S::TotalScore: stats_state::IsSet, - S::HighestNumberBlock: stats_state::IsSet, + S::AverageScore: stats_state::IsSet, S::CreatedAt: stats_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue__2048/verification.rs b/crates/jacquard-api/src/blue__2048/verification.rs index 577655e9..b1fcd165 100644 --- a/crates/jacquard-api/src/blue__2048/verification.rs +++ b/crates/jacquard-api/src/blue__2048/verification.rs @@ -46,83 +46,83 @@ pub mod verification_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Signature; type CreatedAt; type KeyRef; type RecordRef; - type Signature; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Signature = Unset; type CreatedAt = Unset; type KeyRef = Unset; type RecordRef = Unset; - type Signature = Unset; type Subject = Unset; } + ///State transition - sets the `signature` field to Set + pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSignature<S> {} + impl<S: State> State for SetSignature<S> { + type Signature = Set<members::signature>; + type CreatedAt = S::CreatedAt; + type KeyRef = S::KeyRef; + type RecordRef = S::RecordRef; + type Subject = S::Subject; + } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Signature = S::Signature; type CreatedAt = Set<members::created_at>; type KeyRef = S::KeyRef; type RecordRef = S::RecordRef; - type Signature = S::Signature; type Subject = S::Subject; } ///State transition - sets the `key_ref` field to Set pub struct SetKeyRef<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKeyRef<S> {} impl<S: State> State for SetKeyRef<S> { + type Signature = S::Signature; type CreatedAt = S::CreatedAt; type KeyRef = Set<members::key_ref>; type RecordRef = S::RecordRef; - type Signature = S::Signature; type Subject = S::Subject; } ///State transition - sets the `record_ref` field to Set pub struct SetRecordRef<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecordRef<S> {} impl<S: State> State for SetRecordRef<S> { - type CreatedAt = S::CreatedAt; - type KeyRef = S::KeyRef; - type RecordRef = Set<members::record_ref>; type Signature = S::Signature; - type Subject = S::Subject; - } - ///State transition - sets the `signature` field to Set - pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSignature<S> {} - impl<S: State> State for SetSignature<S> { type CreatedAt = S::CreatedAt; type KeyRef = S::KeyRef; - type RecordRef = S::RecordRef; - type Signature = Set<members::signature>; + type RecordRef = Set<members::record_ref>; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { + type Signature = S::Signature; type CreatedAt = S::CreatedAt; type KeyRef = S::KeyRef; type RecordRef = S::RecordRef; - type Signature = S::Signature; type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `signature` field + pub struct signature(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `key_ref` field pub struct key_ref(()); ///Marker type for the `record_ref` field pub struct record_ref(()); - ///Marker type for the `signature` field - pub struct signature(()); ///Marker type for the `subject` field pub struct subject(()); } @@ -257,10 +257,10 @@ where impl<'a, S> VerificationRefBuilder<'a, S> where S: verification_ref_state::State, + S::Signature: verification_ref_state::IsSet, S::CreatedAt: verification_ref_state::IsSet, S::KeyRef: verification_ref_state::IsSet, S::RecordRef: verification_ref_state::IsSet, - S::Signature: verification_ref_state::IsSet, S::Subject: verification_ref_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue_atplay.rs b/crates/jacquard-api/src/blue_atplay.rs new file mode 100644 index 00000000..a82096c3 --- /dev/null +++ b/crates/jacquard-api/src/blue_atplay.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod score; \ No newline at end of file diff --git a/crates/jacquard-api/src/blue_atplay/score.rs b/crates/jacquard-api/src/blue_atplay/score.rs new file mode 100644 index 00000000..5d93f671 --- /dev/null +++ b/crates/jacquard-api/src/blue_atplay/score.rs @@ -0,0 +1,311 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: blue.atplay.score.defs +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Attestation signature proving a score was submitted through ATPlay SDK +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Attestation<'a> { + /// Timestamp when the attestation was created (optional) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub attested_at: std::option::Option<jacquard_common::types::string::Datetime>, + /// DID key reference for verifying the signature + #[serde(borrow)] + pub key: jacquard_common::CowStr<'a>, + /// ES256 signature over the score record CID + #[serde(with = "jacquard_common::serde_bytes_helper")] + pub signature: bytes::Bytes, +} + +pub mod attestation_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Key; + type Signature; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Key = Unset; + type Signature = Unset; + } + ///State transition - sets the `key` field to Set + pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKey<S> {} + impl<S: State> State for SetKey<S> { + type Key = Set<members::key>; + type Signature = S::Signature; + } + ///State transition - sets the `signature` field to Set + pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSignature<S> {} + impl<S: State> State for SetSignature<S> { + type Key = S::Key; + type Signature = Set<members::signature>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `key` field + pub struct key(()); + ///Marker type for the `signature` field + pub struct signature(()); + } +} + +/// Builder for constructing an instance of this type +pub struct AttestationBuilder<'a, S: attestation_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<bytes::Bytes>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Attestation<'a> { + /// Create a new builder for this type + pub fn new() -> AttestationBuilder<'a, attestation_state::Empty> { + AttestationBuilder::new() + } +} + +impl<'a> AttestationBuilder<'a, attestation_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + AttestationBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: attestation_state::State> AttestationBuilder<'a, S> { + /// Set the `attestedAt` field (optional) + pub fn attested_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `attestedAt` field to an Option value (optional) + pub fn maybe_attested_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> AttestationBuilder<'a, S> +where + S: attestation_state::State, + S::Key: attestation_state::IsUnset, +{ + /// Set the `key` field (required) + pub fn key( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> AttestationBuilder<'a, attestation_state::SetKey<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + AttestationBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AttestationBuilder<'a, S> +where + S: attestation_state::State, + S::Signature: attestation_state::IsUnset, +{ + /// Set the `signature` field (required) + pub fn signature( + mut self, + value: impl Into<bytes::Bytes>, + ) -> AttestationBuilder<'a, attestation_state::SetSignature<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + AttestationBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AttestationBuilder<'a, S> +where + S: attestation_state::State, + S::Key: attestation_state::IsSet, + S::Signature: attestation_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Attestation<'a> { + Attestation { + attested_at: self.__unsafe_private_named.0, + key: self.__unsafe_private_named.1.unwrap(), + signature: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Attestation<'a> { + Attestation { + attested_at: self.__unsafe_private_named.0, + key: self.__unsafe_private_named.1.unwrap(), + signature: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_blue_atplay_score_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("blue.atplay.score.defs"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("attestation"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Attestation signature proving a score was submitted through ATPlay SDK", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("key"), + ::jacquard_common::smol_str::SmolStr::new_static("signature") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "attestedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the attestation was created (optional)", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("key"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "DID key reference for verifying the signature", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(512usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "signature", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes { + description: None, + max_length: Some(8192usize), + min_length: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Attestation<'a> { + fn nsid() -> &'static str { + "blue.atplay.score.defs" + } + fn def_name() -> &'static str { + "attestation" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_blue_atplay_score_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.key; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 512usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "key", + ), + max: 512usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/blue_recipes/feed.rs b/crates/jacquard-api/src/blue_recipes/feed.rs index 52c6464e..d933e3c1 100644 --- a/crates/jacquard-api/src/blue_recipes/feed.rs +++ b/crates/jacquard-api/src/blue_recipes/feed.rs @@ -36,37 +36,37 @@ pub mod not_found_recipe_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NotFound; type Uri; + type NotFound; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NotFound = Unset; type Uri = Unset; - } - ///State transition - sets the `not_found` field to Set - pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotFound<S> {} - impl<S: State> State for SetNotFound<S> { - type NotFound = Set<members::not_found>; - type Uri = S::Uri; + type NotFound = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type NotFound = S::NotFound; type Uri = Set<members::uri>; + type NotFound = S::NotFound; + } + ///State transition - sets the `not_found` field to Set + pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotFound<S> {} + impl<S: State> State for SetNotFound<S> { + type Uri = S::Uri; + type NotFound = Set<members::not_found>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `not_found` field - pub struct not_found(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `not_found` field + pub struct not_found(()); } } @@ -139,8 +139,8 @@ where impl<'a, S> NotFoundRecipeBuilder<'a, S> where S: not_found_recipe_state::State, - S::NotFound: not_found_recipe_state::IsSet, S::Uri: not_found_recipe_state::IsSet, + S::NotFound: not_found_recipe_state::IsSet, { /// Build the final struct pub fn build(self) -> NotFoundRecipe<'a> { @@ -371,85 +371,85 @@ pub mod recipe_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; + type Author; type Record; type IndexedAt; - type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; + type Uri = Unset; + type Author = Unset; type Record = Unset; type IndexedAt = Unset; - type Author = Unset; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; + type Uri = S::Uri; + type Author = S::Author; + type Record = S::Record; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; type Cid = S::Cid; + type Uri = Set<members::uri>; + type Author = S::Author; type Record = S::Record; type IndexedAt = S::IndexedAt; - type Author = S::Author; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Cid = S::Cid; type Uri = S::Uri; - type Cid = Set<members::cid>; + type Author = Set<members::author>; type Record = S::Record; type IndexedAt = S::IndexedAt; - type Author = S::Author; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Uri = S::Uri; type Cid = S::Cid; + type Uri = S::Uri; + type Author = S::Author; type Record = Set<members::record>; type IndexedAt = S::IndexedAt; - type Author = S::Author; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Uri = S::Uri; type Cid = S::Cid; - type Record = S::Record; - type IndexedAt = Set<members::indexed_at>; - type Author = S::Author; - } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { type Uri = S::Uri; - type Cid = S::Cid; + type Author = S::Author; type Record = S::Record; - type IndexedAt = S::IndexedAt; - type Author = Set<members::author>; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `author` field + pub struct author(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `author` field - pub struct author(()); } } @@ -582,11 +582,11 @@ where impl<'a, S> RecipeViewBuilder<'a, S> where S: recipe_view_state::State, - S::Uri: recipe_view_state::IsSet, S::Cid: recipe_view_state::IsSet, + S::Uri: recipe_view_state::IsSet, + S::Author: recipe_view_state::IsSet, S::Record: recipe_view_state::IsSet, S::IndexedAt: recipe_view_state::IsSet, - S::Author: recipe_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RecipeView<'a> { diff --git a/crates/jacquard-api/src/blue_recipes/feed/recipe.rs b/crates/jacquard-api/src/blue_recipes/feed/recipe.rs index 4e9b1572..604bb275 100644 --- a/crates/jacquard-api/src/blue_recipes/feed/recipe.rs +++ b/crates/jacquard-api/src/blue_recipes/feed/recipe.rs @@ -362,49 +362,49 @@ pub mod recipe_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Ingredients; type Title; + type Ingredients; type Steps; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Ingredients = Unset; type Title = Unset; + type Ingredients = Unset; type Steps = Unset; } - ///State transition - sets the `ingredients` field to Set - pub struct SetIngredients<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIngredients<S> {} - impl<S: State> State for SetIngredients<S> { - type Ingredients = Set<members::ingredients>; - type Title = S::Title; - type Steps = S::Steps; - } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Ingredients = S::Ingredients; type Title = Set<members::title>; + type Ingredients = S::Ingredients; + type Steps = S::Steps; + } + ///State transition - sets the `ingredients` field to Set + pub struct SetIngredients<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIngredients<S> {} + impl<S: State> State for SetIngredients<S> { + type Title = S::Title; + type Ingredients = Set<members::ingredients>; type Steps = S::Steps; } ///State transition - sets the `steps` field to Set pub struct SetSteps<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSteps<S> {} impl<S: State> State for SetSteps<S> { - type Ingredients = S::Ingredients; type Title = S::Title; + type Ingredients = S::Ingredients; type Steps = Set<members::steps>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `ingredients` field - pub struct ingredients(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `ingredients` field + pub struct ingredients(()); ///Marker type for the `steps` field pub struct steps(()); } @@ -587,8 +587,8 @@ where impl<'a, S> RecipeBuilder<'a, S> where S: recipe_state::State, - S::Ingredients: recipe_state::IsSet, S::Title: recipe_state::IsSet, + S::Ingredients: recipe_state::IsSet, S::Steps: recipe_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue_rito/feed/bookmark.rs b/crates/jacquard-api/src/blue_rito/feed/bookmark.rs index c6309306..ef9dd9f2 100644 --- a/crates/jacquard-api/src/blue_rito/feed/bookmark.rs +++ b/crates/jacquard-api/src/blue_rito/feed/bookmark.rs @@ -419,49 +419,49 @@ pub mod bookmark_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Comments; type Subject; + type Comments; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Comments = Unset; type Subject = Unset; + type Comments = Unset; type CreatedAt = Unset; } - ///State transition - sets the `comments` field to Set - pub struct SetComments<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetComments<S> {} - impl<S: State> State for SetComments<S> { - type Comments = Set<members::comments>; - type Subject = S::Subject; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type Comments = S::Comments; type Subject = Set<members::subject>; + type Comments = S::Comments; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `comments` field to Set + pub struct SetComments<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetComments<S> {} + impl<S: State> State for SetComments<S> { + type Subject = S::Subject; + type Comments = Set<members::comments>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Comments = S::Comments; type Subject = S::Subject; + type Comments = S::Comments; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `comments` field - pub struct comments(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `comments` field + pub struct comments(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -636,8 +636,8 @@ impl<'a, S: bookmark_state::State> BookmarkBuilder<'a, S> { impl<'a, S> BookmarkBuilder<'a, S> where S: bookmark_state::State, - S::Comments: bookmark_state::IsSet, S::Subject: bookmark_state::IsSet, + S::Comments: bookmark_state::IsSet, S::CreatedAt: bookmark_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue_rito/feed/like.rs b/crates/jacquard-api/src/blue_rito/feed/like.rs index a2754c59..08349d48 100644 --- a/crates/jacquard-api/src/blue_rito/feed/like.rs +++ b/crates/jacquard-api/src/blue_rito/feed/like.rs @@ -33,37 +33,37 @@ pub mod like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> LikeBuilder<'a, S> where S: like_state::State, - S::CreatedAt: like_state::IsSet, S::Subject: like_state::IsSet, + S::CreatedAt: like_state::IsSet, { /// Build the final struct pub fn build(self) -> Like<'a> { diff --git a/crates/jacquard-api/src/blue_rito/label/auto/like/settings.rs b/crates/jacquard-api/src/blue_rito/label/auto/like/settings.rs index 6616060c..1da613b6 100644 --- a/crates/jacquard-api/src/blue_rito/label/auto/like/settings.rs +++ b/crates/jacquard-api/src/blue_rito/label/auto/like/settings.rs @@ -40,37 +40,37 @@ pub mod settings_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Apply; type CreatedAt; + type Apply; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Apply = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `apply` field to Set - pub struct SetApply<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetApply<S> {} - impl<S: State> State for SetApply<S> { - type Apply = Set<members::apply>; - type CreatedAt = S::CreatedAt; + type Apply = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Apply = S::Apply; type CreatedAt = Set<members::created_at>; + type Apply = S::Apply; + } + ///State transition - sets the `apply` field to Set + pub struct SetApply<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetApply<S> {} + impl<S: State> State for SetApply<S> { + type CreatedAt = S::CreatedAt; + type Apply = Set<members::apply>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `apply` field - pub struct apply(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `apply` field + pub struct apply(()); } } @@ -169,8 +169,8 @@ impl<'a, S: settings_state::State> SettingsBuilder<'a, S> { impl<'a, S> SettingsBuilder<'a, S> where S: settings_state::State, - S::Apply: settings_state::IsSet, S::CreatedAt: settings_state::IsSet, + S::Apply: settings_state::IsSet, { /// Build the final struct pub fn build(self) -> Settings<'a> { diff --git a/crates/jacquard-api/src/blue_rito/label/auto/post.rs b/crates/jacquard-api/src/blue_rito/label/auto/post.rs index 5aa13ae9..f2213061 100644 --- a/crates/jacquard-api/src/blue_rito/label/auto/post.rs +++ b/crates/jacquard-api/src/blue_rito/label/auto/post.rs @@ -46,85 +46,85 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type DurationInHours; type Label; + type AppliedTo; type Condition; - type DurationInHours; type CreatedAt; - type AppliedTo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type DurationInHours = Unset; type Label = Unset; + type AppliedTo = Unset; type Condition = Unset; - type DurationInHours = Unset; type CreatedAt = Unset; - type AppliedTo = Unset; + } + ///State transition - sets the `duration_in_hours` field to Set + pub struct SetDurationInHours<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDurationInHours<S> {} + impl<S: State> State for SetDurationInHours<S> { + type DurationInHours = Set<members::duration_in_hours>; + type Label = S::Label; + type AppliedTo = S::AppliedTo; + type Condition = S::Condition; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `label` field to Set pub struct SetLabel<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLabel<S> {} impl<S: State> State for SetLabel<S> { + type DurationInHours = S::DurationInHours; type Label = Set<members::label>; + type AppliedTo = S::AppliedTo; type Condition = S::Condition; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `applied_to` field to Set + pub struct SetAppliedTo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAppliedTo<S> {} + impl<S: State> State for SetAppliedTo<S> { type DurationInHours = S::DurationInHours; + type Label = S::Label; + type AppliedTo = Set<members::applied_to>; + type Condition = S::Condition; type CreatedAt = S::CreatedAt; - type AppliedTo = S::AppliedTo; } ///State transition - sets the `condition` field to Set pub struct SetCondition<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCondition<S> {} impl<S: State> State for SetCondition<S> { - type Label = S::Label; - type Condition = Set<members::condition>; type DurationInHours = S::DurationInHours; - type CreatedAt = S::CreatedAt; - type AppliedTo = S::AppliedTo; - } - ///State transition - sets the `duration_in_hours` field to Set - pub struct SetDurationInHours<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDurationInHours<S> {} - impl<S: State> State for SetDurationInHours<S> { type Label = S::Label; - type Condition = S::Condition; - type DurationInHours = Set<members::duration_in_hours>; - type CreatedAt = S::CreatedAt; type AppliedTo = S::AppliedTo; + type Condition = Set<members::condition>; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Label = S::Label; - type Condition = S::Condition; type DurationInHours = S::DurationInHours; - type CreatedAt = Set<members::created_at>; - type AppliedTo = S::AppliedTo; - } - ///State transition - sets the `applied_to` field to Set - pub struct SetAppliedTo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAppliedTo<S> {} - impl<S: State> State for SetAppliedTo<S> { type Label = S::Label; + type AppliedTo = S::AppliedTo; type Condition = S::Condition; - type DurationInHours = S::DurationInHours; - type CreatedAt = S::CreatedAt; - type AppliedTo = Set<members::applied_to>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `duration_in_hours` field + pub struct duration_in_hours(()); ///Marker type for the `label` field pub struct label(()); + ///Marker type for the `applied_to` field + pub struct applied_to(()); ///Marker type for the `condition` field pub struct condition(()); - ///Marker type for the `duration_in_hours` field - pub struct duration_in_hours(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `applied_to` field - pub struct applied_to(()); } } @@ -274,11 +274,11 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, + S::DurationInHours: post_state::IsSet, S::Label: post_state::IsSet, + S::AppliedTo: post_state::IsSet, S::Condition: post_state::IsSet, - S::DurationInHours: post_state::IsSet, S::CreatedAt: post_state::IsSet, - S::AppliedTo: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/blue_rito/service/get_schema.rs b/crates/jacquard-api/src/blue_rito/service/get_schema.rs index 61f6834d..35e401a2 100644 --- a/crates/jacquard-api/src/blue_rito/service/get_schema.rs +++ b/crates/jacquard-api/src/blue_rito/service/get_schema.rs @@ -38,49 +38,49 @@ pub mod langs_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Moderation; type Title; + type Moderation; type Lang; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Moderation = Unset; type Title = Unset; + type Moderation = Unset; type Lang = Unset; } - ///State transition - sets the `moderation` field to Set - pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetModeration<S> {} - impl<S: State> State for SetModeration<S> { - type Moderation = Set<members::moderation>; - type Title = S::Title; - type Lang = S::Lang; - } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Moderation = S::Moderation; type Title = Set<members::title>; + type Moderation = S::Moderation; + type Lang = S::Lang; + } + ///State transition - sets the `moderation` field to Set + pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetModeration<S> {} + impl<S: State> State for SetModeration<S> { + type Title = S::Title; + type Moderation = Set<members::moderation>; type Lang = S::Lang; } ///State transition - sets the `lang` field to Set pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLang<S> {} impl<S: State> State for SetLang<S> { - type Moderation = S::Moderation; type Title = S::Title; + type Moderation = S::Moderation; type Lang = Set<members::lang>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `moderation` field - pub struct moderation(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `moderation` field + pub struct moderation(()); ///Marker type for the `lang` field pub struct lang(()); } @@ -192,8 +192,8 @@ where impl<'a, S> LangsBuilder<'a, S> where S: langs_state::State, - S::Moderation: langs_state::IsSet, S::Title: langs_state::IsSet, + S::Moderation: langs_state::IsSet, S::Lang: langs_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/blue_skytalk.rs b/crates/jacquard-api/src/blue_skytalk.rs new file mode 100644 index 00000000..cc904216 --- /dev/null +++ b/crates/jacquard-api/src/blue_skytalk.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod talk; \ No newline at end of file diff --git a/crates/jacquard-api/src/blue_skytalk/talk.rs b/crates/jacquard-api/src/blue_skytalk/talk.rs new file mode 100644 index 00000000..42d84c17 --- /dev/null +++ b/crates/jacquard-api/src/blue_skytalk/talk.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod thread; \ No newline at end of file diff --git a/crates/jacquard-api/src/blue_skytalk/talk/thread.rs b/crates/jacquard-api/src/blue_skytalk/talk/thread.rs new file mode 100644 index 00000000..d889f5d7 --- /dev/null +++ b/crates/jacquard-api/src/blue_skytalk/talk/thread.rs @@ -0,0 +1,491 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: blue.skytalk.talk.thread +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A thread in a channel +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Thread<'a> { + /// The channel this thread belongs to + #[serde(borrow)] + pub channel_id: jacquard_common::CowStr<'a>, + /// Timestamp of thread creation + pub created_at: jacquard_common::types::string::Datetime, + /// The text content of the thread + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub text: std::option::Option<jacquard_common::CowStr<'a>>, + /// The title of the thread + #[serde(borrow)] + pub title: jacquard_common::CowStr<'a>, +} + +pub mod thread_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type ChannelId; + type Title; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type ChannelId = Unset; + type Title = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type ChannelId = S::ChannelId; + type Title = S::Title; + } + ///State transition - sets the `channel_id` field to Set + pub struct SetChannelId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetChannelId<S> {} + impl<S: State> State for SetChannelId<S> { + type CreatedAt = S::CreatedAt; + type ChannelId = Set<members::channel_id>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type CreatedAt = S::CreatedAt; + type ChannelId = S::ChannelId; + type Title = Set<members::title>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `channel_id` field + pub struct channel_id(()); + ///Marker type for the `title` field + pub struct title(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ThreadBuilder<'a, S: thread_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Thread<'a> { + /// Create a new builder for this type + pub fn new() -> ThreadBuilder<'a, thread_state::Empty> { + ThreadBuilder::new() + } +} + +impl<'a> ThreadBuilder<'a, thread_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ThreadBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ThreadBuilder<'a, S> +where + S: thread_state::State, + S::ChannelId: thread_state::IsUnset, +{ + /// Set the `channelId` field (required) + pub fn channel_id( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ThreadBuilder<'a, thread_state::SetChannelId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ThreadBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ThreadBuilder<'a, S> +where + S: thread_state::State, + S::CreatedAt: thread_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ThreadBuilder<'a, thread_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ThreadBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: thread_state::State> ThreadBuilder<'a, S> { + /// Set the `text` field (optional) + pub fn text( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `text` field to an Option value (optional) + pub fn maybe_text(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> ThreadBuilder<'a, S> +where + S: thread_state::State, + S::Title: thread_state::IsUnset, +{ + /// Set the `title` field (required) + pub fn title( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ThreadBuilder<'a, thread_state::SetTitle<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + ThreadBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ThreadBuilder<'a, S> +where + S: thread_state::State, + S::CreatedAt: thread_state::IsSet, + S::ChannelId: thread_state::IsSet, + S::Title: thread_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Thread<'a> { + Thread { + channel_id: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + text: self.__unsafe_private_named.2, + title: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Thread<'a> { + Thread { + channel_id: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + text: self.__unsafe_private_named.2, + title: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Thread<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ThreadRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ThreadGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Thread<'a>, +} + +impl From<ThreadGetRecordOutput<'_>> for Thread<'_> { + fn from(output: ThreadGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Thread<'_> { + const NSID: &'static str = "blue.skytalk.talk.thread"; + type Record = ThreadRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ThreadRecord; +impl jacquard_common::xrpc::XrpcResp for ThreadRecord { + const NSID: &'static str = "blue.skytalk.talk.thread"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ThreadGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ThreadRecord { + const NSID: &'static str = "blue.skytalk.talk.thread"; + type Record = ThreadRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Thread<'a> { + fn nsid() -> &'static str { + "blue.skytalk.talk.thread" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_blue_skytalk_talk_thread() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.text { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 4000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 4000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.text { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 40000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 40000usize, + actual: count, + }); + } + } + } + { + let value = &self.title; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "title", + ), + max: 300usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.title; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 3000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "title", + ), + max: 3000usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_blue_skytalk_talk_thread() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("blue.skytalk.talk.thread"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("A thread in a channel"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("channelId"), + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "channelId", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The channel this thread belongs to", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp of thread creation", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The text content of the thread", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(4000usize), + min_graphemes: None, + max_graphemes: Some(40000usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The title of the thread", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(300usize), + min_graphemes: None, + max_graphemes: Some(3000usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/buzz_bookhive.rs b/crates/jacquard-api/src/buzz_bookhive.rs index ae02e95e..8738ab80 100644 --- a/crates/jacquard-api/src/buzz_bookhive.rs +++ b/crates/jacquard-api/src/buzz_bookhive.rs @@ -69,105 +69,105 @@ pub mod activity_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type UserDid; + type Title; type UserHandle; + type CreatedAt; type Type; type HiveId; - type CreatedAt; - type Title; - type UserDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type UserDid = Unset; + type Title = Unset; type UserHandle = Unset; + type CreatedAt = Unset; type Type = Unset; type HiveId = Unset; - type CreatedAt = Unset; - type Title = Unset; - type UserDid = Unset; + } + ///State transition - sets the `user_did` field to Set + pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUserDid<S> {} + impl<S: State> State for SetUserDid<S> { + type UserDid = Set<members::user_did>; + type Title = S::Title; + type UserHandle = S::UserHandle; + type CreatedAt = S::CreatedAt; + type Type = S::Type; + type HiveId = S::HiveId; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type UserDid = S::UserDid; + type Title = Set<members::title>; + type UserHandle = S::UserHandle; + type CreatedAt = S::CreatedAt; + type Type = S::Type; + type HiveId = S::HiveId; } ///State transition - sets the `user_handle` field to Set pub struct SetUserHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUserHandle<S> {} impl<S: State> State for SetUserHandle<S> { + type UserDid = S::UserDid; + type Title = S::Title; type UserHandle = Set<members::user_handle>; + type CreatedAt = S::CreatedAt; type Type = S::Type; type HiveId = S::HiveId; - type CreatedAt = S::CreatedAt; - type Title = S::Title; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type UserDid = S::UserDid; + type Title = S::Title; + type UserHandle = S::UserHandle; + type CreatedAt = Set<members::created_at>; + type Type = S::Type; + type HiveId = S::HiveId; } ///State transition - sets the `type` field to Set pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetType<S> {} impl<S: State> State for SetType<S> { + type UserDid = S::UserDid; + type Title = S::Title; type UserHandle = S::UserHandle; + type CreatedAt = S::CreatedAt; type Type = Set<members::r#type>; type HiveId = S::HiveId; - type CreatedAt = S::CreatedAt; - type Title = S::Title; - type UserDid = S::UserDid; } ///State transition - sets the `hive_id` field to Set pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHiveId<S> {} impl<S: State> State for SetHiveId<S> { - type UserHandle = S::UserHandle; - type Type = S::Type; - type HiveId = Set<members::hive_id>; - type CreatedAt = S::CreatedAt; - type Title = S::Title; type UserDid = S::UserDid; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type UserHandle = S::UserHandle; - type Type = S::Type; - type HiveId = S::HiveId; - type CreatedAt = Set<members::created_at>; type Title = S::Title; - type UserDid = S::UserDid; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { type UserHandle = S::UserHandle; - type Type = S::Type; - type HiveId = S::HiveId; type CreatedAt = S::CreatedAt; - type Title = Set<members::title>; - type UserDid = S::UserDid; - } - ///State transition - sets the `user_did` field to Set - pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUserDid<S> {} - impl<S: State> State for SetUserDid<S> { - type UserHandle = S::UserHandle; type Type = S::Type; - type HiveId = S::HiveId; - type CreatedAt = S::CreatedAt; - type Title = S::Title; - type UserDid = Set<members::user_did>; + type HiveId = Set<members::hive_id>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `user_did` field + pub struct user_did(()); + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `user_handle` field pub struct user_handle(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `type` field pub struct r#type(()); ///Marker type for the `hive_id` field pub struct hive_id(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `title` field - pub struct title(()); - ///Marker type for the `user_did` field - pub struct user_did(()); } } @@ -320,12 +320,12 @@ where impl<'a, S> ActivityBuilder<'a, S> where S: activity_state::State, + S::UserDid: activity_state::IsSet, + S::Title: activity_state::IsSet, S::UserHandle: activity_state::IsSet, + S::CreatedAt: activity_state::IsSet, S::Type: activity_state::IsSet, S::HiveId: activity_state::IsSet, - S::CreatedAt: activity_state::IsSet, - S::Title: activity_state::IsSet, - S::UserDid: activity_state::IsSet, { /// Build the final struct pub fn build(self) -> Activity<'a> { @@ -1754,105 +1754,105 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Parent; + type Did; + type Handle; type Comment; type CreatedAt; - type Handle; - type Did; type Book; + type Parent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Parent = Unset; + type Did = Unset; + type Handle = Unset; type Comment = Unset; type CreatedAt = Unset; - type Handle = Unset; - type Did = Unset; type Book = Unset; + type Parent = Unset; } - ///State transition - sets the `parent` field to Set - pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetParent<S> {} - impl<S: State> State for SetParent<S> { - type Parent = Set<members::parent>; + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Did = Set<members::did>; + type Handle = S::Handle; type Comment = S::Comment; type CreatedAt = S::CreatedAt; - type Handle = S::Handle; + type Book = S::Book; + type Parent = S::Parent; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { type Did = S::Did; + type Handle = Set<members::handle>; + type Comment = S::Comment; + type CreatedAt = S::CreatedAt; type Book = S::Book; + type Parent = S::Parent; } ///State transition - sets the `comment` field to Set pub struct SetComment<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetComment<S> {} impl<S: State> State for SetComment<S> { - type Parent = S::Parent; + type Did = S::Did; + type Handle = S::Handle; type Comment = Set<members::comment>; type CreatedAt = S::CreatedAt; - type Handle = S::Handle; - type Did = S::Did; type Book = S::Book; + type Parent = S::Parent; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Parent = S::Parent; - type Comment = S::Comment; - type CreatedAt = Set<members::created_at>; - type Handle = S::Handle; type Did = S::Did; - type Book = S::Book; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Parent = S::Parent; + type Handle = S::Handle; type Comment = S::Comment; - type CreatedAt = S::CreatedAt; - type Handle = Set<members::handle>; - type Did = S::Did; + type CreatedAt = Set<members::created_at>; type Book = S::Book; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { type Parent = S::Parent; - type Comment = S::Comment; - type CreatedAt = S::CreatedAt; - type Handle = S::Handle; - type Did = Set<members::did>; - type Book = S::Book; } ///State transition - sets the `book` field to Set pub struct SetBook<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBook<S> {} impl<S: State> State for SetBook<S> { - type Parent = S::Parent; + type Did = S::Did; + type Handle = S::Handle; type Comment = S::Comment; type CreatedAt = S::CreatedAt; - type Handle = S::Handle; - type Did = S::Did; type Book = Set<members::book>; + type Parent = S::Parent; + } + ///State transition - sets the `parent` field to Set + pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetParent<S> {} + impl<S: State> State for SetParent<S> { + type Did = S::Did; + type Handle = S::Handle; + type Comment = S::Comment; + type CreatedAt = S::CreatedAt; + type Book = S::Book; + type Parent = Set<members::parent>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `parent` field - pub struct parent(()); + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `handle` field + pub struct handle(()); ///Marker type for the `comment` field pub struct comment(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `handle` field - pub struct handle(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `book` field pub struct book(()); + ///Marker type for the `parent` field + pub struct parent(()); } } @@ -2005,12 +2005,12 @@ where impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::Parent: comment_state::IsSet, + S::Did: comment_state::IsSet, + S::Handle: comment_state::IsSet, S::Comment: comment_state::IsSet, S::CreatedAt: comment_state::IsSet, - S::Handle: comment_state::IsSet, - S::Did: comment_state::IsSet, S::Book: comment_state::IsSet, + S::Parent: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { @@ -2168,67 +2168,67 @@ pub mod profile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type BooksRead; type DisplayName; type Reviews; type Handle; - type BooksRead; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type BooksRead = Unset; type DisplayName = Unset; type Reviews = Unset; type Handle = Unset; - type BooksRead = Unset; + } + ///State transition - sets the `books_read` field to Set + pub struct SetBooksRead<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBooksRead<S> {} + impl<S: State> State for SetBooksRead<S> { + type BooksRead = Set<members::books_read>; + type DisplayName = S::DisplayName; + type Reviews = S::Reviews; + type Handle = S::Handle; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDisplayName<S> {} impl<S: State> State for SetDisplayName<S> { + type BooksRead = S::BooksRead; type DisplayName = Set<members::display_name>; type Reviews = S::Reviews; type Handle = S::Handle; - type BooksRead = S::BooksRead; } ///State transition - sets the `reviews` field to Set pub struct SetReviews<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReviews<S> {} impl<S: State> State for SetReviews<S> { + type BooksRead = S::BooksRead; type DisplayName = S::DisplayName; type Reviews = Set<members::reviews>; type Handle = S::Handle; - type BooksRead = S::BooksRead; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type DisplayName = S::DisplayName; - type Reviews = S::Reviews; - type Handle = Set<members::handle>; type BooksRead = S::BooksRead; - } - ///State transition - sets the `books_read` field to Set - pub struct SetBooksRead<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBooksRead<S> {} - impl<S: State> State for SetBooksRead<S> { type DisplayName = S::DisplayName; type Reviews = S::Reviews; - type Handle = S::Handle; - type BooksRead = Set<members::books_read>; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `books_read` field + pub struct books_read(()); ///Marker type for the `display_name` field pub struct display_name(()); ///Marker type for the `reviews` field pub struct reviews(()); ///Marker type for the `handle` field pub struct handle(()); - ///Marker type for the `books_read` field - pub struct books_read(()); } } @@ -2392,10 +2392,10 @@ where impl<'a, S> ProfileBuilder<'a, S> where S: profile_state::State, + S::BooksRead: profile_state::IsSet, S::DisplayName: profile_state::IsSet, S::Reviews: profile_state::IsSet, S::Handle: profile_state::IsSet, - S::BooksRead: profile_state::IsSet, { /// Build the final struct pub fn build(self) -> Profile<'a> { @@ -2528,67 +2528,67 @@ pub mod review_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Review; - type CreatedAt; - type Did; type Handle; + type Did; + type CreatedAt; + type Review; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Review = Unset; - type CreatedAt = Unset; - type Did = Unset; type Handle = Unset; + type Did = Unset; + type CreatedAt = Unset; + type Review = Unset; } - ///State transition - sets the `review` field to Set - pub struct SetReview<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReview<S> {} - impl<S: State> State for SetReview<S> { - type Review = Set<members::review>; - type CreatedAt = S::CreatedAt; + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Handle = Set<members::handle>; type Did = S::Did; - type Handle = S::Handle; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = S::CreatedAt; type Review = S::Review; - type CreatedAt = Set<members::created_at>; - type Did = S::Did; - type Handle = S::Handle; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Review = S::Review; - type CreatedAt = S::CreatedAt; - type Did = Set<members::did>; type Handle = S::Handle; + type Did = Set<members::did>; + type CreatedAt = S::CreatedAt; + type Review = S::Review; } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Handle = S::Handle; + type Did = S::Did; + type CreatedAt = Set<members::created_at>; type Review = S::Review; - type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `review` field to Set + pub struct SetReview<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReview<S> {} + impl<S: State> State for SetReview<S> { + type Handle = S::Handle; type Did = S::Did; - type Handle = Set<members::handle>; + type CreatedAt = S::CreatedAt; + type Review = Set<members::review>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `review` field - pub struct review(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `review` field + pub struct review(()); } } @@ -2715,10 +2715,10 @@ impl<'a, S: review_state::State> ReviewBuilder<'a, S> { impl<'a, S> ReviewBuilder<'a, S> where S: review_state::State, - S::Review: review_state::IsSet, - S::CreatedAt: review_state::IsSet, - S::Did: review_state::IsSet, S::Handle: review_state::IsSet, + S::Did: review_state::IsSet, + S::CreatedAt: review_state::IsSet, + S::Review: review_state::IsSet, { /// Build the final struct pub fn build(self) -> Review<'a> { @@ -2842,105 +2842,105 @@ pub mod user_book_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Authors; - type CreatedAt; - type Title; + type HiveId; type Thumbnail; type UserDid; - type HiveId; + type Title; + type Authors; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Authors = Unset; - type CreatedAt = Unset; - type Title = Unset; + type HiveId = Unset; type Thumbnail = Unset; type UserDid = Unset; - type HiveId = Unset; + type Title = Unset; + type Authors = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `authors` field to Set - pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthors<S> {} - impl<S: State> State for SetAuthors<S> { - type Authors = Set<members::authors>; - type CreatedAt = S::CreatedAt; - type Title = S::Title; + ///State transition - sets the `hive_id` field to Set + pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHiveId<S> {} + impl<S: State> State for SetHiveId<S> { + type HiveId = Set<members::hive_id>; type Thumbnail = S::Thumbnail; type UserDid = S::UserDid; - type HiveId = S::HiveId; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Authors = S::Authors; - type CreatedAt = Set<members::created_at>; type Title = S::Title; - type Thumbnail = S::Thumbnail; - type UserDid = S::UserDid; - type HiveId = S::HiveId; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { type Authors = S::Authors; type CreatedAt = S::CreatedAt; - type Title = Set<members::title>; - type Thumbnail = S::Thumbnail; - type UserDid = S::UserDid; - type HiveId = S::HiveId; } ///State transition - sets the `thumbnail` field to Set pub struct SetThumbnail<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetThumbnail<S> {} impl<S: State> State for SetThumbnail<S> { - type Authors = S::Authors; - type CreatedAt = S::CreatedAt; - type Title = S::Title; + type HiveId = S::HiveId; type Thumbnail = Set<members::thumbnail>; type UserDid = S::UserDid; - type HiveId = S::HiveId; + type Title = S::Title; + type Authors = S::Authors; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `user_did` field to Set pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUserDid<S> {} impl<S: State> State for SetUserDid<S> { - type Authors = S::Authors; - type CreatedAt = S::CreatedAt; - type Title = S::Title; + type HiveId = S::HiveId; type Thumbnail = S::Thumbnail; type UserDid = Set<members::user_did>; - type HiveId = S::HiveId; + type Title = S::Title; + type Authors = S::Authors; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `hive_id` field to Set - pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHiveId<S> {} - impl<S: State> State for SetHiveId<S> { + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type HiveId = S::HiveId; + type Thumbnail = S::Thumbnail; + type UserDid = S::UserDid; + type Title = Set<members::title>; type Authors = S::Authors; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `authors` field to Set + pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthors<S> {} + impl<S: State> State for SetAuthors<S> { + type HiveId = S::HiveId; + type Thumbnail = S::Thumbnail; + type UserDid = S::UserDid; type Title = S::Title; + type Authors = Set<members::authors>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type HiveId = S::HiveId; type Thumbnail = S::Thumbnail; type UserDid = S::UserDid; - type HiveId = Set<members::hive_id>; + type Title = S::Title; + type Authors = S::Authors; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `authors` field - pub struct authors(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `title` field - pub struct title(()); + ///Marker type for the `hive_id` field + pub struct hive_id(()); ///Marker type for the `thumbnail` field pub struct thumbnail(()); ///Marker type for the `user_did` field pub struct user_did(()); - ///Marker type for the `hive_id` field - pub struct hive_id(()); + ///Marker type for the `title` field + pub struct title(()); + ///Marker type for the `authors` field + pub struct authors(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -3286,12 +3286,12 @@ impl<'a, S: user_book_state::State> UserBookBuilder<'a, S> { impl<'a, S> UserBookBuilder<'a, S> where S: user_book_state::State, - S::Authors: user_book_state::IsSet, - S::CreatedAt: user_book_state::IsSet, - S::Title: user_book_state::IsSet, + S::HiveId: user_book_state::IsSet, S::Thumbnail: user_book_state::IsSet, S::UserDid: user_book_state::IsSet, - S::HiveId: user_book_state::IsSet, + S::Title: user_book_state::IsSet, + S::Authors: user_book_state::IsSet, + S::CreatedAt: user_book_state::IsSet, { /// Build the final struct pub fn build(self) -> UserBook<'a> { diff --git a/crates/jacquard-api/src/buzz_bookhive/book.rs b/crates/jacquard-api/src/buzz_bookhive/book.rs index a535a0ea..6141879b 100644 --- a/crates/jacquard-api/src/buzz_bookhive/book.rs +++ b/crates/jacquard-api/src/buzz_bookhive/book.rs @@ -64,65 +64,65 @@ pub mod book_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type HiveId; type CreatedAt; type Authors; + type HiveId; type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type HiveId = Unset; type CreatedAt = Unset; type Authors = Unset; + type HiveId = Unset; type Title = Unset; } - ///State transition - sets the `hive_id` field to Set - pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHiveId<S> {} - impl<S: State> State for SetHiveId<S> { - type HiveId = Set<members::hive_id>; - type CreatedAt = S::CreatedAt; - type Authors = S::Authors; - type Title = S::Title; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type HiveId = S::HiveId; type CreatedAt = Set<members::created_at>; type Authors = S::Authors; + type HiveId = S::HiveId; type Title = S::Title; } ///State transition - sets the `authors` field to Set pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthors<S> {} impl<S: State> State for SetAuthors<S> { - type HiveId = S::HiveId; type CreatedAt = S::CreatedAt; type Authors = Set<members::authors>; + type HiveId = S::HiveId; + type Title = S::Title; + } + ///State transition - sets the `hive_id` field to Set + pub struct SetHiveId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHiveId<S> {} + impl<S: State> State for SetHiveId<S> { + type CreatedAt = S::CreatedAt; + type Authors = S::Authors; + type HiveId = Set<members::hive_id>; type Title = S::Title; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type HiveId = S::HiveId; type CreatedAt = S::CreatedAt; type Authors = S::Authors; + type HiveId = S::HiveId; type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `hive_id` field - pub struct hive_id(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `authors` field pub struct authors(()); + ///Marker type for the `hive_id` field + pub struct hive_id(()); ///Marker type for the `title` field pub struct title(()); } @@ -374,9 +374,9 @@ where impl<'a, S> BookBuilder<'a, S> where S: book_state::State, - S::HiveId: book_state::IsSet, S::CreatedAt: book_state::IsSet, S::Authors: book_state::IsSet, + S::HiveId: book_state::IsSet, S::Title: book_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/buzz_bookhive/buzz.rs b/crates/jacquard-api/src/buzz_bookhive/buzz.rs index 09dd9974..1193c4c6 100644 --- a/crates/jacquard-api/src/buzz_bookhive/buzz.rs +++ b/crates/jacquard-api/src/buzz_bookhive/buzz.rs @@ -40,66 +40,66 @@ pub mod buzz_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; + type Comment; type Book; type Parent; - type Comment; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; + type Comment = Unset; type Book = Unset; type Parent = Unset; - type Comment = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type CreatedAt = Set<members::created_at>; + type Comment = S::Comment; + type Book = S::Book; + type Parent = S::Parent; + } + ///State transition - sets the `comment` field to Set + pub struct SetComment<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetComment<S> {} + impl<S: State> State for SetComment<S> { + type CreatedAt = S::CreatedAt; + type Comment = Set<members::comment>; type Book = S::Book; type Parent = S::Parent; - type Comment = S::Comment; } ///State transition - sets the `book` field to Set pub struct SetBook<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBook<S> {} impl<S: State> State for SetBook<S> { type CreatedAt = S::CreatedAt; + type Comment = S::Comment; type Book = Set<members::book>; type Parent = S::Parent; - type Comment = S::Comment; } ///State transition - sets the `parent` field to Set pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetParent<S> {} impl<S: State> State for SetParent<S> { type CreatedAt = S::CreatedAt; - type Book = S::Book; - type Parent = Set<members::parent>; type Comment = S::Comment; - } - ///State transition - sets the `comment` field to Set - pub struct SetComment<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetComment<S> {} - impl<S: State> State for SetComment<S> { - type CreatedAt = S::CreatedAt; type Book = S::Book; - type Parent = S::Parent; - type Comment = Set<members::comment>; + type Parent = Set<members::parent>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `comment` field + pub struct comment(()); ///Marker type for the `book` field pub struct book(()); ///Marker type for the `parent` field pub struct parent(()); - ///Marker type for the `comment` field - pub struct comment(()); } } @@ -213,9 +213,9 @@ impl<'a, S> BuzzBuilder<'a, S> where S: buzz_state::State, S::CreatedAt: buzz_state::IsSet, + S::Comment: buzz_state::IsSet, S::Book: buzz_state::IsSet, S::Parent: buzz_state::IsSet, - S::Comment: buzz_state::IsSet, { /// Build the final struct pub fn build(self) -> Buzz<'a> { diff --git a/crates/jacquard-api/src/buzz_bookhive/hive_book.rs b/crates/jacquard-api/src/buzz_bookhive/hive_book.rs index f2e84f73..1cb0bb12 100644 --- a/crates/jacquard-api/src/buzz_bookhive/hive_book.rs +++ b/crates/jacquard-api/src/buzz_bookhive/hive_book.rs @@ -70,105 +70,105 @@ pub mod hive_book_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Thumbnail; + type UpdatedAt; + type Title; type CreatedAt; type Id; - type Title; + type Thumbnail; type Authors; - type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Thumbnail = Unset; + type UpdatedAt = Unset; + type Title = Unset; type CreatedAt = Unset; type Id = Unset; - type Title = Unset; + type Thumbnail = Unset; type Authors = Unset; - type UpdatedAt = Unset; } - ///State transition - sets the `thumbnail` field to Set - pub struct SetThumbnail<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetThumbnail<S> {} - impl<S: State> State for SetThumbnail<S> { - type Thumbnail = Set<members::thumbnail>; + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type UpdatedAt = Set<members::updated_at>; + type Title = S::Title; type CreatedAt = S::CreatedAt; type Id = S::Id; - type Title = S::Title; + type Thumbnail = S::Thumbnail; type Authors = S::Authors; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { type UpdatedAt = S::UpdatedAt; + type Title = Set<members::title>; + type CreatedAt = S::CreatedAt; + type Id = S::Id; + type Thumbnail = S::Thumbnail; + type Authors = S::Authors; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Thumbnail = S::Thumbnail; + type UpdatedAt = S::UpdatedAt; + type Title = S::Title; type CreatedAt = Set<members::created_at>; type Id = S::Id; - type Title = S::Title; + type Thumbnail = S::Thumbnail; type Authors = S::Authors; - type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { - type Thumbnail = S::Thumbnail; + type UpdatedAt = S::UpdatedAt; + type Title = S::Title; type CreatedAt = S::CreatedAt; type Id = Set<members::id>; - type Title = S::Title; + type Thumbnail = S::Thumbnail; type Authors = S::Authors; - type UpdatedAt = S::UpdatedAt; } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Thumbnail = S::Thumbnail; + ///State transition - sets the `thumbnail` field to Set + pub struct SetThumbnail<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetThumbnail<S> {} + impl<S: State> State for SetThumbnail<S> { + type UpdatedAt = S::UpdatedAt; + type Title = S::Title; type CreatedAt = S::CreatedAt; type Id = S::Id; - type Title = Set<members::title>; + type Thumbnail = Set<members::thumbnail>; type Authors = S::Authors; - type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `authors` field to Set pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthors<S> {} impl<S: State> State for SetAuthors<S> { - type Thumbnail = S::Thumbnail; - type CreatedAt = S::CreatedAt; - type Id = S::Id; - type Title = S::Title; - type Authors = Set<members::authors>; type UpdatedAt = S::UpdatedAt; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type Thumbnail = S::Thumbnail; + type Title = S::Title; type CreatedAt = S::CreatedAt; type Id = S::Id; - type Title = S::Title; - type Authors = S::Authors; - type UpdatedAt = Set<members::updated_at>; + type Thumbnail = S::Thumbnail; + type Authors = Set<members::authors>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `thumbnail` field - pub struct thumbnail(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `id` field pub struct id(()); - ///Marker type for the `title` field - pub struct title(()); + ///Marker type for the `thumbnail` field + pub struct thumbnail(()); ///Marker type for the `authors` field pub struct authors(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); } } @@ -457,12 +457,12 @@ where impl<'a, S> HiveBookBuilder<'a, S> where S: hive_book_state::State, - S::Thumbnail: hive_book_state::IsSet, + S::UpdatedAt: hive_book_state::IsSet, + S::Title: hive_book_state::IsSet, S::CreatedAt: hive_book_state::IsSet, S::Id: hive_book_state::IsSet, - S::Title: hive_book_state::IsSet, + S::Thumbnail: hive_book_state::IsSet, S::Authors: hive_book_state::IsSet, - S::UpdatedAt: hive_book_state::IsSet, { /// Build the final struct pub fn build(self) -> HiveBook<'a> { diff --git a/crates/jacquard-api/src/cat_vt3e.rs b/crates/jacquard-api/src/cat_vt3e.rs new file mode 100644 index 00000000..f19b93e0 --- /dev/null +++ b/crates/jacquard-api/src/cat_vt3e.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod gallery; \ No newline at end of file diff --git a/crates/jacquard-api/src/cat_vt3e/gallery.rs b/crates/jacquard-api/src/cat_vt3e/gallery.rs new file mode 100644 index 00000000..8357272a --- /dev/null +++ b/crates/jacquard-api/src/cat_vt3e/gallery.rs @@ -0,0 +1,8 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod group; +pub mod group_item; +pub mod image; \ No newline at end of file diff --git a/crates/jacquard-api/src/cat_vt3e/gallery/group.rs b/crates/jacquard-api/src/cat_vt3e/gallery/group.rs new file mode 100644 index 00000000..b89804f6 --- /dev/null +++ b/crates/jacquard-api/src/cat_vt3e/gallery/group.rs @@ -0,0 +1,367 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: cat.vt3e.gallery.group +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// defines a group of images in the gallery +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Group<'a> { + pub created_at: jacquard_common::types::string::Datetime, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub title: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod group_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct GroupBuilder<'a, S: group_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Group<'a> { + /// Create a new builder for this type + pub fn new() -> GroupBuilder<'a, group_state::Empty> { + GroupBuilder::new() + } +} + +impl<'a> GroupBuilder<'a, group_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GroupBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GroupBuilder<'a, S> +where + S: group_state::State, + S::CreatedAt: group_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> GroupBuilder<'a, group_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + GroupBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: group_state::State> GroupBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: group_state::State> GroupBuilder<'a, S> { + /// Set the `title` field (optional) + pub fn title( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `title` field to an Option value (optional) + pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> GroupBuilder<'a, S> +where + S: group_state::State, + S::CreatedAt: group_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Group<'a> { + Group { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + title: self.__unsafe_private_named.2, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Group<'a> { + Group { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + title: self.__unsafe_private_named.2, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Group<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, GroupRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GroupGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Group<'a>, +} + +impl From<GroupGetRecordOutput<'_>> for Group<'_> { + fn from(output: GroupGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Group<'_> { + const NSID: &'static str = "cat.vt3e.gallery.group"; + type Record = GroupRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GroupRecord; +impl jacquard_common::xrpc::XrpcResp for GroupRecord { + const NSID: &'static str = "cat.vt3e.gallery.group"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = GroupGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for GroupRecord { + const NSID: &'static str = "cat.vt3e.gallery.group"; + type Record = GroupRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Group<'a> { + fn nsid() -> &'static str { + "cat.vt3e.gallery.group" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_cat_vt3e_gallery_group() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.title { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "title", + ), + max: 300usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_cat_vt3e_gallery_group() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("cat.vt3e.gallery.group"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "defines a group of images in the gallery", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(300usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/cat_vt3e/gallery/group_item.rs b/crates/jacquard-api/src/cat_vt3e/gallery/group_item.rs new file mode 100644 index 00000000..da92b2b1 --- /dev/null +++ b/crates/jacquard-api/src/cat_vt3e/gallery/group_item.rs @@ -0,0 +1,421 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: cat.vt3e.gallery.groupItem +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// defines an item in a gallery group +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GroupItem<'a> { + pub added_at: jacquard_common::types::string::Datetime, + /// uri of the group that the image belongs to + #[serde(borrow)] + pub group: jacquard_common::types::string::AtUri<'a>, + /// uri of the image that this item represents + #[serde(borrow)] + pub image: jacquard_common::types::string::AtUri<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub note: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod group_item_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type AddedAt; + type Group; + type Image; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type AddedAt = Unset; + type Group = Unset; + type Image = Unset; + } + ///State transition - sets the `added_at` field to Set + pub struct SetAddedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAddedAt<S> {} + impl<S: State> State for SetAddedAt<S> { + type AddedAt = Set<members::added_at>; + type Group = S::Group; + type Image = S::Image; + } + ///State transition - sets the `group` field to Set + pub struct SetGroup<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetGroup<S> {} + impl<S: State> State for SetGroup<S> { + type AddedAt = S::AddedAt; + type Group = Set<members::group>; + type Image = S::Image; + } + ///State transition - sets the `image` field to Set + pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetImage<S> {} + impl<S: State> State for SetImage<S> { + type AddedAt = S::AddedAt; + type Group = S::Group; + type Image = Set<members::image>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `added_at` field + pub struct added_at(()); + ///Marker type for the `group` field + pub struct group(()); + ///Marker type for the `image` field + pub struct image(()); + } +} + +/// Builder for constructing an instance of this type +pub struct GroupItemBuilder<'a, S: group_item_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> GroupItem<'a> { + /// Create a new builder for this type + pub fn new() -> GroupItemBuilder<'a, group_item_state::Empty> { + GroupItemBuilder::new() + } +} + +impl<'a> GroupItemBuilder<'a, group_item_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GroupItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GroupItemBuilder<'a, S> +where + S: group_item_state::State, + S::AddedAt: group_item_state::IsUnset, +{ + /// Set the `addedAt` field (required) + pub fn added_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> GroupItemBuilder<'a, group_item_state::SetAddedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + GroupItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GroupItemBuilder<'a, S> +where + S: group_item_state::State, + S::Group: group_item_state::IsUnset, +{ + /// Set the `group` field (required) + pub fn group( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> GroupItemBuilder<'a, group_item_state::SetGroup<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + GroupItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GroupItemBuilder<'a, S> +where + S: group_item_state::State, + S::Image: group_item_state::IsUnset, +{ + /// Set the `image` field (required) + pub fn image( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> GroupItemBuilder<'a, group_item_state::SetImage<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + GroupItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: group_item_state::State> GroupItemBuilder<'a, S> { + /// Set the `note` field (optional) + pub fn note( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `note` field to an Option value (optional) + pub fn maybe_note(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> GroupItemBuilder<'a, S> +where + S: group_item_state::State, + S::AddedAt: group_item_state::IsSet, + S::Group: group_item_state::IsSet, + S::Image: group_item_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> GroupItem<'a> { + GroupItem { + added_at: self.__unsafe_private_named.0.unwrap(), + group: self.__unsafe_private_named.1.unwrap(), + image: self.__unsafe_private_named.2.unwrap(), + note: self.__unsafe_private_named.3, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> GroupItem<'a> { + GroupItem { + added_at: self.__unsafe_private_named.0.unwrap(), + group: self.__unsafe_private_named.1.unwrap(), + image: self.__unsafe_private_named.2.unwrap(), + note: self.__unsafe_private_named.3, + extra_data: Some(extra_data), + } + } +} + +impl<'a> GroupItem<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, GroupItemRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GroupItemGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: GroupItem<'a>, +} + +impl From<GroupItemGetRecordOutput<'_>> for GroupItem<'_> { + fn from(output: GroupItemGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for GroupItem<'_> { + const NSID: &'static str = "cat.vt3e.gallery.groupItem"; + type Record = GroupItemRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GroupItemRecord; +impl jacquard_common::xrpc::XrpcResp for GroupItemRecord { + const NSID: &'static str = "cat.vt3e.gallery.groupItem"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = GroupItemGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for GroupItemRecord { + const NSID: &'static str = "cat.vt3e.gallery.groupItem"; + type Record = GroupItemRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for GroupItem<'a> { + fn nsid() -> &'static str { + "cat.vt3e.gallery.groupItem" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_cat_vt3e_gallery_groupItem() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_cat_vt3e_gallery_groupItem() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("cat.vt3e.gallery.groupItem"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "defines an item in a gallery group", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("group"), + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_common::smol_str::SmolStr::new_static("addedAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("addedAt"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("group"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "uri of the group that the image belongs to", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "uri of the image that this item represents", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("note"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/cat_vt3e/gallery/image.rs b/crates/jacquard-api/src/cat_vt3e/gallery/image.rs new file mode 100644 index 00000000..12fd2c75 --- /dev/null +++ b/crates/jacquard-api/src/cat_vt3e/gallery/image.rs @@ -0,0 +1,712 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: cat.vt3e.gallery.image +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// defines an image in the gallery +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Image<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub alt: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub aspect_ratio: std::option::Option<i64>, + /// provides a blurred preview of the image for use while loading, see github.com/woltapp/blurhash + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub blurhash: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub caption: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub checksum: std::option::Option<jacquard_common::CowStr<'a>>, + pub created_at: jacquard_common::types::string::Datetime, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub dominant_colour: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub height: std::option::Option<i64>, + #[serde(borrow)] + pub image: jacquard_common::types::blob::BlobRef<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub size_in_bytes: std::option::Option<i64>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub title: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub width: std::option::Option<i64>, +} + +pub mod image_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Image; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Image = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `image` field to Set + pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetImage<S> {} + impl<S: State> State for SetImage<S> { + type Image = Set<members::image>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Image = S::Image; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `image` field + pub struct image(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ImageBuilder<'a, S: image_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<i64>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Image<'a> { + /// Create a new builder for this type + pub fn new() -> ImageBuilder<'a, image_state::Empty> { + ImageBuilder::new() + } +} + +impl<'a> ImageBuilder<'a, image_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ImageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `alt` field (optional) + pub fn alt(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `alt` field to an Option value (optional) + pub fn maybe_alt(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `aspectRatio` field (optional) + pub fn aspect_ratio(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `aspectRatio` field to an Option value (optional) + pub fn maybe_aspect_ratio(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `blurhash` field (optional) + pub fn blurhash( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `blurhash` field to an Option value (optional) + pub fn maybe_blurhash(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `caption` field (optional) + pub fn caption( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `caption` field to an Option value (optional) + pub fn maybe_caption(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `checksum` field (optional) + pub fn checksum( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `checksum` field to an Option value (optional) + pub fn maybe_checksum(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S> ImageBuilder<'a, S> +where + S: image_state::State, + S::CreatedAt: image_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ImageBuilder<'a, image_state::SetCreatedAt<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + ImageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `dominantColour` field (optional) + pub fn dominant_colour( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `dominantColour` field to an Option value (optional) + pub fn maybe_dominant_colour( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `height` field (optional) + pub fn height(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.7 = value.into(); + self + } + /// Set the `height` field to an Option value (optional) + pub fn maybe_height(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.7 = value; + self + } +} + +impl<'a, S> ImageBuilder<'a, S> +where + S: image_state::State, + S::Image: image_state::IsUnset, +{ + /// Set the `image` field (required) + pub fn image( + mut self, + value: impl Into<jacquard_common::types::blob::BlobRef<'a>>, + ) -> ImageBuilder<'a, image_state::SetImage<S>> { + self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); + ImageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `sizeInBytes` field (optional) + pub fn size_in_bytes(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.9 = value.into(); + self + } + /// Set the `sizeInBytes` field to an Option value (optional) + pub fn maybe_size_in_bytes(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.9 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `title` field (optional) + pub fn title( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.10 = value.into(); + self + } + /// Set the `title` field to an Option value (optional) + pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.10 = value; + self + } +} + +impl<'a, S: image_state::State> ImageBuilder<'a, S> { + /// Set the `width` field (optional) + pub fn width(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.11 = value.into(); + self + } + /// Set the `width` field to an Option value (optional) + pub fn maybe_width(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.11 = value; + self + } +} + +impl<'a, S> ImageBuilder<'a, S> +where + S: image_state::State, + S::Image: image_state::IsSet, + S::CreatedAt: image_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Image<'a> { + Image { + alt: self.__unsafe_private_named.0, + aspect_ratio: self.__unsafe_private_named.1, + blurhash: self.__unsafe_private_named.2, + caption: self.__unsafe_private_named.3, + checksum: self.__unsafe_private_named.4, + created_at: self.__unsafe_private_named.5.unwrap(), + dominant_colour: self.__unsafe_private_named.6, + height: self.__unsafe_private_named.7, + image: self.__unsafe_private_named.8.unwrap(), + size_in_bytes: self.__unsafe_private_named.9, + title: self.__unsafe_private_named.10, + width: self.__unsafe_private_named.11, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Image<'a> { + Image { + alt: self.__unsafe_private_named.0, + aspect_ratio: self.__unsafe_private_named.1, + blurhash: self.__unsafe_private_named.2, + caption: self.__unsafe_private_named.3, + checksum: self.__unsafe_private_named.4, + created_at: self.__unsafe_private_named.5.unwrap(), + dominant_colour: self.__unsafe_private_named.6, + height: self.__unsafe_private_named.7, + image: self.__unsafe_private_named.8.unwrap(), + size_in_bytes: self.__unsafe_private_named.9, + title: self.__unsafe_private_named.10, + width: self.__unsafe_private_named.11, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Image<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ImageRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ImageGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Image<'a>, +} + +impl From<ImageGetRecordOutput<'_>> for Image<'_> { + fn from(output: ImageGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Image<'_> { + const NSID: &'static str = "cat.vt3e.gallery.image"; + type Record = ImageRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ImageRecord; +impl jacquard_common::xrpc::XrpcResp for ImageRecord { + const NSID: &'static str = "cat.vt3e.gallery.image"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ImageGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ImageRecord { + const NSID: &'static str = "cat.vt3e.gallery.image"; + type Record = ImageRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { + fn nsid() -> &'static str { + "cat.vt3e.gallery.image" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_cat_vt3e_gallery_image() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.alt { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 2000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "alt", + ), + max: 2000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.caption { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 2000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "caption", + ), + max: 2000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.title { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 512usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "title", + ), + max: 512usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_cat_vt3e_gallery_image() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("cat.vt3e.gallery.image"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "defines an image in the gallery", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("alt"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(2000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "aspectRatio", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "blurhash", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "provides a blurred preview of the image for use while loading, see github.com/woltapp/blurhash", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("caption"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(2000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "checksum", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "dominantColour", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("height"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "sizeInBytes", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(512usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("width"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/chat_bsky/actor.rs b/crates/jacquard-api/src/chat_bsky/actor.rs index 010aaa7d..2b55ebb6 100644 --- a/crates/jacquard-api/src/chat_bsky/actor.rs +++ b/crates/jacquard-api/src/chat_bsky/actor.rs @@ -58,37 +58,37 @@ pub mod profile_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Handle = Set<members::handle>; - type Did = S::Did; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Handle = S::Handle; type Did = Set<members::did>; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Did = S::Did; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -305,8 +305,8 @@ impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { impl<'a, S> ProfileViewBasicBuilder<'a, S> where S: profile_view_basic_state::State, - S::Handle: profile_view_basic_state::IsSet, S::Did: profile_view_basic_state::IsSet, + S::Handle: profile_view_basic_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileViewBasic<'a> { diff --git a/crates/jacquard-api/src/chat_bsky/convo.rs b/crates/jacquard-api/src/chat_bsky/convo.rs index d39ac73f..c2417859 100644 --- a/crates/jacquard-api/src/chat_bsky/convo.rs +++ b/crates/jacquard-api/src/chat_bsky/convo.rs @@ -66,85 +66,85 @@ pub mod convo_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Id; - type Muted; - type Members; type Rev; + type Members; + type Muted; type UnreadCount; + type Id; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Id = Unset; - type Muted = Unset; - type Members = Unset; type Rev = Unset; + type Members = Unset; + type Muted = Unset; type UnreadCount = Unset; + type Id = Unset; } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { - type Id = Set<members::id>; - type Muted = S::Muted; + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Rev = Set<members::rev>; type Members = S::Members; - type Rev = S::Rev; + type Muted = S::Muted; type UnreadCount = S::UnreadCount; - } - ///State transition - sets the `muted` field to Set - pub struct SetMuted<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMuted<S> {} - impl<S: State> State for SetMuted<S> { type Id = S::Id; - type Muted = Set<members::muted>; - type Members = S::Members; - type Rev = S::Rev; - type UnreadCount = S::UnreadCount; } ///State transition - sets the `members` field to Set pub struct SetMembers<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMembers<S> {} impl<S: State> State for SetMembers<S> { - type Id = S::Id; - type Muted = S::Muted; - type Members = Set<members::members>; type Rev = S::Rev; + type Members = Set<members::members>; + type Muted = S::Muted; type UnreadCount = S::UnreadCount; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { type Id = S::Id; - type Muted = S::Muted; + } + ///State transition - sets the `muted` field to Set + pub struct SetMuted<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMuted<S> {} + impl<S: State> State for SetMuted<S> { + type Rev = S::Rev; type Members = S::Members; - type Rev = Set<members::rev>; + type Muted = Set<members::muted>; type UnreadCount = S::UnreadCount; + type Id = S::Id; } ///State transition - sets the `unread_count` field to Set pub struct SetUnreadCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUnreadCount<S> {} impl<S: State> State for SetUnreadCount<S> { - type Id = S::Id; - type Muted = S::Muted; - type Members = S::Members; type Rev = S::Rev; + type Members = S::Members; + type Muted = S::Muted; type UnreadCount = Set<members::unread_count>; + type Id = S::Id; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Rev = S::Rev; + type Members = S::Members; + type Muted = S::Muted; + type UnreadCount = S::UnreadCount; + type Id = Set<members::id>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `id` field - pub struct id(()); - ///Marker type for the `muted` field - pub struct muted(()); - ///Marker type for the `members` field - pub struct members(()); ///Marker type for the `rev` field pub struct rev(()); + ///Marker type for the `members` field + pub struct members(()); + ///Marker type for the `muted` field + pub struct muted(()); ///Marker type for the `unread_count` field pub struct unread_count(()); + ///Marker type for the `id` field + pub struct id(()); } } @@ -331,11 +331,11 @@ where impl<'a, S> ConvoViewBuilder<'a, S> where S: convo_view_state::State, - S::Id: convo_view_state::IsSet, - S::Muted: convo_view_state::IsSet, - S::Members: convo_view_state::IsSet, S::Rev: convo_view_state::IsSet, + S::Members: convo_view_state::IsSet, + S::Muted: convo_view_state::IsSet, S::UnreadCount: convo_view_state::IsSet, + S::Id: convo_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ConvoView<'a> { @@ -1733,65 +1733,65 @@ pub mod deleted_message_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Rev; type Id; type SentAt; - type Rev; type Sender; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Rev = Unset; type Id = Unset; type SentAt = Unset; - type Rev = Unset; type Sender = Unset; } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Rev = Set<members::rev>; + type Id = S::Id; + type SentAt = S::SentAt; + type Sender = S::Sender; + } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { + type Rev = S::Rev; type Id = Set<members::id>; type SentAt = S::SentAt; - type Rev = S::Rev; type Sender = S::Sender; } ///State transition - sets the `sent_at` field to Set pub struct SetSentAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSentAt<S> {} impl<S: State> State for SetSentAt<S> { - type Id = S::Id; - type SentAt = Set<members::sent_at>; type Rev = S::Rev; - type Sender = S::Sender; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { type Id = S::Id; - type SentAt = S::SentAt; - type Rev = Set<members::rev>; + type SentAt = Set<members::sent_at>; type Sender = S::Sender; } ///State transition - sets the `sender` field to Set pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSender<S> {} impl<S: State> State for SetSender<S> { + type Rev = S::Rev; type Id = S::Id; type SentAt = S::SentAt; - type Rev = S::Rev; type Sender = Set<members::sender>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `sent_at` field pub struct sent_at(()); - ///Marker type for the `rev` field - pub struct rev(()); ///Marker type for the `sender` field pub struct sender(()); } @@ -1906,9 +1906,9 @@ where impl<'a, S> DeletedMessageViewBuilder<'a, S> where S: deleted_message_view_state::State, + S::Rev: deleted_message_view_state::IsSet, S::Id: deleted_message_view_state::IsSet, S::SentAt: deleted_message_view_state::IsSet, - S::Rev: deleted_message_view_state::IsSet, S::Sender: deleted_message_view_state::IsSet, { /// Build the final struct @@ -2024,8 +2024,8 @@ pub mod log_add_reaction_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Reaction; type ConvoId; + type Reaction; type Message; type Rev; } @@ -2033,26 +2033,26 @@ pub mod log_add_reaction_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Reaction = Unset; type ConvoId = Unset; + type Reaction = Unset; type Message = Unset; type Rev = Unset; } - ///State transition - sets the `reaction` field to Set - pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReaction<S> {} - impl<S: State> State for SetReaction<S> { - type Reaction = Set<members::reaction>; - type ConvoId = S::ConvoId; - type Message = S::Message; - type Rev = S::Rev; - } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvoId<S> {} impl<S: State> State for SetConvoId<S> { - type Reaction = S::Reaction; type ConvoId = Set<members::convo_id>; + type Reaction = S::Reaction; + type Message = S::Message; + type Rev = S::Rev; + } + ///State transition - sets the `reaction` field to Set + pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReaction<S> {} + impl<S: State> State for SetReaction<S> { + type ConvoId = S::ConvoId; + type Reaction = Set<members::reaction>; type Message = S::Message; type Rev = S::Rev; } @@ -2060,8 +2060,8 @@ pub mod log_add_reaction_state { pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type Reaction = S::Reaction; type ConvoId = S::ConvoId; + type Reaction = S::Reaction; type Message = Set<members::message>; type Rev = S::Rev; } @@ -2069,18 +2069,18 @@ pub mod log_add_reaction_state { pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRev<S> {} impl<S: State> State for SetRev<S> { - type Reaction = S::Reaction; type ConvoId = S::ConvoId; + type Reaction = S::Reaction; type Message = S::Message; type Rev = Set<members::rev>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `reaction` field - pub struct reaction(()); ///Marker type for the `convo_id` field pub struct convo_id(()); + ///Marker type for the `reaction` field + pub struct reaction(()); ///Marker type for the `message` field pub struct message(()); ///Marker type for the `rev` field @@ -2197,8 +2197,8 @@ where impl<'a, S> LogAddReactionBuilder<'a, S> where S: log_add_reaction_state::State, - S::Reaction: log_add_reaction_state::IsSet, S::ConvoId: log_add_reaction_state::IsSet, + S::Reaction: log_add_reaction_state::IsSet, S::Message: log_add_reaction_state::IsSet, S::Rev: log_add_reaction_state::IsSet, { @@ -2332,51 +2332,51 @@ pub mod log_create_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Message; type Rev; type ConvoId; + type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Message = Unset; type Rev = Unset; type ConvoId = Unset; - } - ///State transition - sets the `message` field to Set - pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessage<S> {} - impl<S: State> State for SetMessage<S> { - type Message = Set<members::message>; - type Rev = S::Rev; - type ConvoId = S::ConvoId; + type Message = Unset; } ///State transition - sets the `rev` field to Set pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRev<S> {} impl<S: State> State for SetRev<S> { - type Message = S::Message; type Rev = Set<members::rev>; type ConvoId = S::ConvoId; + type Message = S::Message; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvoId<S> {} impl<S: State> State for SetConvoId<S> { - type Message = S::Message; type Rev = S::Rev; type ConvoId = Set<members::convo_id>; + type Message = S::Message; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type Rev = S::Rev; + type ConvoId = S::ConvoId; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `message` field - pub struct message(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `convo_id` field pub struct convo_id(()); + ///Marker type for the `message` field + pub struct message(()); } } @@ -2469,9 +2469,9 @@ where impl<'a, S> LogCreateMessageBuilder<'a, S> where S: log_create_message_state::State, - S::Message: log_create_message_state::IsSet, S::Rev: log_create_message_state::IsSet, S::ConvoId: log_create_message_state::IsSet, + S::Message: log_create_message_state::IsSet, { /// Build the final struct pub fn build(self) -> LogCreateMessage<'a> { @@ -2565,51 +2565,51 @@ pub mod log_delete_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type ConvoId; type Rev; type Message; - type ConvoId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type ConvoId = Unset; type Rev = Unset; type Message = Unset; - type ConvoId = Unset; + } + ///State transition - sets the `convo_id` field to Set + pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetConvoId<S> {} + impl<S: State> State for SetConvoId<S> { + type ConvoId = Set<members::convo_id>; + type Rev = S::Rev; + type Message = S::Message; } ///State transition - sets the `rev` field to Set pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRev<S> {} impl<S: State> State for SetRev<S> { + type ConvoId = S::ConvoId; type Rev = Set<members::rev>; type Message = S::Message; - type ConvoId = S::ConvoId; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type Rev = S::Rev; - type Message = Set<members::message>; type ConvoId = S::ConvoId; - } - ///State transition - sets the `convo_id` field to Set - pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetConvoId<S> {} - impl<S: State> State for SetConvoId<S> { type Rev = S::Rev; - type Message = S::Message; - type ConvoId = Set<members::convo_id>; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `convo_id` field + pub struct convo_id(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `message` field pub struct message(()); - ///Marker type for the `convo_id` field - pub struct convo_id(()); } } @@ -2702,9 +2702,9 @@ where impl<'a, S> LogDeleteMessageBuilder<'a, S> where S: log_delete_message_state::State, + S::ConvoId: log_delete_message_state::IsSet, S::Rev: log_delete_message_state::IsSet, S::Message: log_delete_message_state::IsSet, - S::ConvoId: log_delete_message_state::IsSet, { /// Build the final struct pub fn build(self) -> LogDeleteMessage<'a> { @@ -2870,51 +2870,51 @@ pub mod log_read_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Rev; type ConvoId; type Message; - type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Rev = Unset; type ConvoId = Unset; type Message = Unset; - type Rev = Unset; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Rev = Set<members::rev>; + type ConvoId = S::ConvoId; + type Message = S::Message; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvoId<S> {} impl<S: State> State for SetConvoId<S> { + type Rev = S::Rev; type ConvoId = Set<members::convo_id>; type Message = S::Message; - type Rev = S::Rev; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type ConvoId = S::ConvoId; - type Message = Set<members::message>; type Rev = S::Rev; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { type ConvoId = S::ConvoId; - type Message = S::Message; - type Rev = Set<members::rev>; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `convo_id` field pub struct convo_id(()); ///Marker type for the `message` field pub struct message(()); - ///Marker type for the `rev` field - pub struct rev(()); } } @@ -3007,9 +3007,9 @@ where impl<'a, S> LogReadMessageBuilder<'a, S> where S: log_read_message_state::State, + S::Rev: log_read_message_state::IsSet, S::ConvoId: log_read_message_state::IsSet, S::Message: log_read_message_state::IsSet, - S::Rev: log_read_message_state::IsSet, { /// Build the final struct pub fn build(self) -> LogReadMessage<'a> { @@ -3105,67 +3105,67 @@ pub mod log_remove_reaction_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ConvoId; - type Reaction; type Rev; type Message; + type ConvoId; + type Reaction; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ConvoId = Unset; - type Reaction = Unset; type Rev = Unset; type Message = Unset; - } - ///State transition - sets the `convo_id` field to Set - pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetConvoId<S> {} - impl<S: State> State for SetConvoId<S> { - type ConvoId = Set<members::convo_id>; - type Reaction = S::Reaction; - type Rev = S::Rev; - type Message = S::Message; - } - ///State transition - sets the `reaction` field to Set - pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReaction<S> {} - impl<S: State> State for SetReaction<S> { - type ConvoId = S::ConvoId; - type Reaction = Set<members::reaction>; - type Rev = S::Rev; - type Message = S::Message; + type ConvoId = Unset; + type Reaction = Unset; } ///State transition - sets the `rev` field to Set pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRev<S> {} impl<S: State> State for SetRev<S> { - type ConvoId = S::ConvoId; - type Reaction = S::Reaction; type Rev = Set<members::rev>; type Message = S::Message; + type ConvoId = S::ConvoId; + type Reaction = S::Reaction; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { + type Rev = S::Rev; + type Message = Set<members::message>; type ConvoId = S::ConvoId; type Reaction = S::Reaction; + } + ///State transition - sets the `convo_id` field to Set + pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetConvoId<S> {} + impl<S: State> State for SetConvoId<S> { type Rev = S::Rev; - type Message = Set<members::message>; + type Message = S::Message; + type ConvoId = Set<members::convo_id>; + type Reaction = S::Reaction; + } + ///State transition - sets the `reaction` field to Set + pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReaction<S> {} + impl<S: State> State for SetReaction<S> { + type Rev = S::Rev; + type Message = S::Message; + type ConvoId = S::ConvoId; + type Reaction = Set<members::reaction>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `convo_id` field - pub struct convo_id(()); - ///Marker type for the `reaction` field - pub struct reaction(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `message` field pub struct message(()); + ///Marker type for the `convo_id` field + pub struct convo_id(()); + ///Marker type for the `reaction` field + pub struct reaction(()); } } @@ -3278,10 +3278,10 @@ where impl<'a, S> LogRemoveReactionBuilder<'a, S> where S: log_remove_reaction_state::State, - S::ConvoId: log_remove_reaction_state::IsSet, - S::Reaction: log_remove_reaction_state::IsSet, S::Rev: log_remove_reaction_state::IsSet, S::Message: log_remove_reaction_state::IsSet, + S::ConvoId: log_remove_reaction_state::IsSet, + S::Reaction: log_remove_reaction_state::IsSet, { /// Build the final struct pub fn build(self) -> LogRemoveReaction<'a> { @@ -3898,85 +3898,85 @@ pub mod message_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; type Id; - type Sender; type SentAt; + type Rev; type Text; + type Sender; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; type Id = Unset; - type Sender = Unset; type SentAt = Unset; + type Rev = Unset; type Text = Unset; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { - type Rev = Set<members::rev>; - type Id = S::Id; - type Sender = S::Sender; - type SentAt = S::SentAt; - type Text = S::Text; + type Sender = Unset; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { - type Rev = S::Rev; type Id = Set<members::id>; - type Sender = S::Sender; type SentAt = S::SentAt; - type Text = S::Text; - } - ///State transition - sets the `sender` field to Set - pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSender<S> {} - impl<S: State> State for SetSender<S> { type Rev = S::Rev; - type Id = S::Id; - type Sender = Set<members::sender>; - type SentAt = S::SentAt; type Text = S::Text; + type Sender = S::Sender; } ///State transition - sets the `sent_at` field to Set pub struct SetSentAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSentAt<S> {} impl<S: State> State for SetSentAt<S> { - type Rev = S::Rev; type Id = S::Id; - type Sender = S::Sender; type SentAt = Set<members::sent_at>; + type Rev = S::Rev; type Text = S::Text; + type Sender = S::Sender; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Id = S::Id; + type SentAt = S::SentAt; + type Rev = Set<members::rev>; + type Text = S::Text; + type Sender = S::Sender; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { - type Rev = S::Rev; type Id = S::Id; - type Sender = S::Sender; type SentAt = S::SentAt; + type Rev = S::Rev; type Text = Set<members::text>; + type Sender = S::Sender; + } + ///State transition - sets the `sender` field to Set + pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSender<S> {} + impl<S: State> State for SetSender<S> { + type Id = S::Id; + type SentAt = S::SentAt; + type Rev = S::Rev; + type Text = S::Text; + type Sender = Set<members::sender>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); ///Marker type for the `id` field pub struct id(()); - ///Marker type for the `sender` field - pub struct sender(()); ///Marker type for the `sent_at` field pub struct sent_at(()); + ///Marker type for the `rev` field + pub struct rev(()); ///Marker type for the `text` field pub struct text(()); + ///Marker type for the `sender` field + pub struct sender(()); } } @@ -4169,11 +4169,11 @@ where impl<'a, S> MessageViewBuilder<'a, S> where S: message_view_state::State, - S::Rev: message_view_state::IsSet, S::Id: message_view_state::IsSet, - S::Sender: message_view_state::IsSet, S::SentAt: message_view_state::IsSet, + S::Rev: message_view_state::IsSet, S::Text: message_view_state::IsSet, + S::Sender: message_view_state::IsSet, { /// Build the final struct pub fn build(self) -> MessageView<'a> { @@ -4427,51 +4427,51 @@ pub mod reaction_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Sender; type Value; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Sender = Unset; type Value = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Sender = S::Sender; - type Value = S::Value; + type CreatedAt = Unset; } ///State transition - sets the `sender` field to Set pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSender<S> {} impl<S: State> State for SetSender<S> { - type CreatedAt = S::CreatedAt; type Sender = Set<members::sender>; type Value = S::Value; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type CreatedAt = S::CreatedAt; type Sender = S::Sender; type Value = Set<members::value>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Sender = S::Sender; + type Value = S::Value; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `sender` field pub struct sender(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -4564,9 +4564,9 @@ where impl<'a, S> ReactionViewBuilder<'a, S> where S: reaction_view_state::State, - S::CreatedAt: reaction_view_state::IsSet, S::Sender: reaction_view_state::IsSet, S::Value: reaction_view_state::IsSet, + S::CreatedAt: reaction_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ReactionView<'a> { diff --git a/crates/jacquard-api/src/chat_bsky/convo/send_message.rs b/crates/jacquard-api/src/chat_bsky/convo/send_message.rs index a6b37be1..5950b13a 100644 --- a/crates/jacquard-api/src/chat_bsky/convo/send_message.rs +++ b/crates/jacquard-api/src/chat_bsky/convo/send_message.rs @@ -33,37 +33,37 @@ pub mod send_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Message; type ConvoId; + type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Message = Unset; type ConvoId = Unset; - } - ///State transition - sets the `message` field to Set - pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessage<S> {} - impl<S: State> State for SetMessage<S> { - type Message = Set<members::message>; - type ConvoId = S::ConvoId; + type Message = Unset; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvoId<S> {} impl<S: State> State for SetConvoId<S> { - type Message = S::Message; type ConvoId = Set<members::convo_id>; + type Message = S::Message; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type ConvoId = S::ConvoId; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `message` field - pub struct message(()); ///Marker type for the `convo_id` field pub struct convo_id(()); + ///Marker type for the `message` field + pub struct message(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> SendMessageBuilder<'a, S> where S: send_message_state::State, - S::Message: send_message_state::IsSet, S::ConvoId: send_message_state::IsSet, + S::Message: send_message_state::IsSet, { /// Build the final struct pub fn build(self) -> SendMessage<'a> { diff --git a/crates/jacquard-api/src/chat_bsky/convo/send_message_batch.rs b/crates/jacquard-api/src/chat_bsky/convo/send_message_batch.rs index a875bcda..c4e64688 100644 --- a/crates/jacquard-api/src/chat_bsky/convo/send_message_batch.rs +++ b/crates/jacquard-api/src/chat_bsky/convo/send_message_batch.rs @@ -33,37 +33,37 @@ pub mod batch_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Message; type ConvoId; + type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Message = Unset; type ConvoId = Unset; - } - ///State transition - sets the `message` field to Set - pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessage<S> {} - impl<S: State> State for SetMessage<S> { - type Message = Set<members::message>; - type ConvoId = S::ConvoId; + type Message = Unset; } ///State transition - sets the `convo_id` field to Set pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvoId<S> {} impl<S: State> State for SetConvoId<S> { - type Message = S::Message; type ConvoId = Set<members::convo_id>; + type Message = S::Message; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type ConvoId = S::ConvoId; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `message` field - pub struct message(()); ///Marker type for the `convo_id` field pub struct convo_id(()); + ///Marker type for the `message` field + pub struct message(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> BatchItemBuilder<'a, S> where S: batch_item_state::State, - S::Message: batch_item_state::IsSet, S::ConvoId: batch_item_state::IsSet, + S::Message: batch_item_state::IsSet, { /// Build the final struct pub fn build(self) -> BatchItem<'a> { diff --git a/crates/jacquard-api/src/chat_bsky/moderation/get_actor_metadata.rs b/crates/jacquard-api/src/chat_bsky/moderation/get_actor_metadata.rs index c5f48474..9b2f6b80 100644 --- a/crates/jacquard-api/src/chat_bsky/moderation/get_actor_metadata.rs +++ b/crates/jacquard-api/src/chat_bsky/moderation/get_actor_metadata.rs @@ -185,67 +185,67 @@ pub mod metadata_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type MessagesReceived; - type ConvosStarted; type Convos; + type MessagesReceived; type MessagesSent; + type ConvosStarted; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type MessagesReceived = Unset; - type ConvosStarted = Unset; type Convos = Unset; + type MessagesReceived = Unset; type MessagesSent = Unset; - } - ///State transition - sets the `messages_received` field to Set - pub struct SetMessagesReceived<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessagesReceived<S> {} - impl<S: State> State for SetMessagesReceived<S> { - type MessagesReceived = Set<members::messages_received>; - type ConvosStarted = S::ConvosStarted; - type Convos = S::Convos; - type MessagesSent = S::MessagesSent; - } - ///State transition - sets the `convos_started` field to Set - pub struct SetConvosStarted<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetConvosStarted<S> {} - impl<S: State> State for SetConvosStarted<S> { - type MessagesReceived = S::MessagesReceived; - type ConvosStarted = Set<members::convos_started>; - type Convos = S::Convos; - type MessagesSent = S::MessagesSent; + type ConvosStarted = Unset; } ///State transition - sets the `convos` field to Set pub struct SetConvos<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetConvos<S> {} impl<S: State> State for SetConvos<S> { + type Convos = Set<members::convos>; type MessagesReceived = S::MessagesReceived; + type MessagesSent = S::MessagesSent; type ConvosStarted = S::ConvosStarted; - type Convos = Set<members::convos>; + } + ///State transition - sets the `messages_received` field to Set + pub struct SetMessagesReceived<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessagesReceived<S> {} + impl<S: State> State for SetMessagesReceived<S> { + type Convos = S::Convos; + type MessagesReceived = Set<members::messages_received>; type MessagesSent = S::MessagesSent; + type ConvosStarted = S::ConvosStarted; } ///State transition - sets the `messages_sent` field to Set pub struct SetMessagesSent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessagesSent<S> {} impl<S: State> State for SetMessagesSent<S> { + type Convos = S::Convos; type MessagesReceived = S::MessagesReceived; + type MessagesSent = Set<members::messages_sent>; type ConvosStarted = S::ConvosStarted; + } + ///State transition - sets the `convos_started` field to Set + pub struct SetConvosStarted<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetConvosStarted<S> {} + impl<S: State> State for SetConvosStarted<S> { type Convos = S::Convos; - type MessagesSent = Set<members::messages_sent>; + type MessagesReceived = S::MessagesReceived; + type MessagesSent = S::MessagesSent; + type ConvosStarted = Set<members::convos_started>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `messages_received` field - pub struct messages_received(()); - ///Marker type for the `convos_started` field - pub struct convos_started(()); ///Marker type for the `convos` field pub struct convos(()); + ///Marker type for the `messages_received` field + pub struct messages_received(()); ///Marker type for the `messages_sent` field pub struct messages_sent(()); + ///Marker type for the `convos_started` field + pub struct convos_started(()); } } @@ -358,10 +358,10 @@ where impl<'a, S> MetadataBuilder<'a, S> where S: metadata_state::State, - S::MessagesReceived: metadata_state::IsSet, - S::ConvosStarted: metadata_state::IsSet, S::Convos: metadata_state::IsSet, + S::MessagesReceived: metadata_state::IsSet, S::MessagesSent: metadata_state::IsSet, + S::ConvosStarted: metadata_state::IsSet, { /// Build the final struct pub fn build(self) -> Metadata<'a> { diff --git a/crates/jacquard-api/src/chat_bsky/moderation/update_actor_access.rs b/crates/jacquard-api/src/chat_bsky/moderation/update_actor_access.rs index ebdd92b2..b93c5d19 100644 --- a/crates/jacquard-api/src/chat_bsky/moderation/update_actor_access.rs +++ b/crates/jacquard-api/src/chat_bsky/moderation/update_actor_access.rs @@ -35,37 +35,37 @@ pub mod update_actor_access_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Actor; type AllowAccess; + type Actor; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Actor = Unset; type AllowAccess = Unset; - } - ///State transition - sets the `actor` field to Set - pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetActor<S> {} - impl<S: State> State for SetActor<S> { - type Actor = Set<members::actor>; - type AllowAccess = S::AllowAccess; + type Actor = Unset; } ///State transition - sets the `allow_access` field to Set pub struct SetAllowAccess<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAllowAccess<S> {} impl<S: State> State for SetAllowAccess<S> { - type Actor = S::Actor; type AllowAccess = Set<members::allow_access>; + type Actor = S::Actor; + } + ///State transition - sets the `actor` field to Set + pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActor<S> {} + impl<S: State> State for SetActor<S> { + type AllowAccess = S::AllowAccess; + type Actor = Set<members::actor>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `actor` field - pub struct actor(()); ///Marker type for the `allow_access` field pub struct allow_access(()); + ///Marker type for the `actor` field + pub struct actor(()); } } @@ -155,8 +155,8 @@ impl<'a, S: update_actor_access_state::State> UpdateActorAccessBuilder<'a, S> { impl<'a, S> UpdateActorAccessBuilder<'a, S> where S: update_actor_access_state::State, - S::Actor: update_actor_access_state::IsSet, S::AllowAccess: update_actor_access_state::IsSet, + S::Actor: update_actor_access_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateActorAccess<'a> { diff --git a/crates/jacquard-api/src/city_yoyle.rs b/crates/jacquard-api/src/city_yoyle.rs new file mode 100644 index 00000000..cbaa2578 --- /dev/null +++ b/crates/jacquard-api/src/city_yoyle.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod status; \ No newline at end of file diff --git a/crates/jacquard-api/src/city_yoyle/status.rs b/crates/jacquard-api/src/city_yoyle/status.rs new file mode 100644 index 00000000..1a12e75e --- /dev/null +++ b/crates/jacquard-api/src/city_yoyle/status.rs @@ -0,0 +1,332 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: city.yoyle.status +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Short status update +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Status<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub created_at: std::option::Option<jacquard_common::types::string::Datetime>, + #[serde(borrow)] + pub text: jacquard_common::CowStr<'a>, +} + +pub mod status_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Text; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Text = Unset; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type Text = Set<members::text>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `text` field + pub struct text(()); + } +} + +/// Builder for constructing an instance of this type +pub struct StatusBuilder<'a, S: status_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Status<'a> { + /// Create a new builder for this type + pub fn new() -> StatusBuilder<'a, status_state::Empty> { + StatusBuilder::new() + } +} + +impl<'a> StatusBuilder<'a, status_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + StatusBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: status_state::State> StatusBuilder<'a, S> { + /// Set the `createdAt` field (optional) + pub fn created_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `createdAt` field to an Option value (optional) + pub fn maybe_created_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> StatusBuilder<'a, S> +where + S: status_state::State, + S::Text: status_state::IsUnset, +{ + /// Set the `text` field (required) + pub fn text( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> StatusBuilder<'a, status_state::SetText<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + StatusBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatusBuilder<'a, S> +where + S: status_state::State, + S::Text: status_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Status<'a> { + Status { + created_at: self.__unsafe_private_named.0, + text: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Status<'a> { + Status { + created_at: self.__unsafe_private_named.0, + text: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Status<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, StatusRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct StatusGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Status<'a>, +} + +impl From<StatusGetRecordOutput<'_>> for Status<'_> { + fn from(output: StatusGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Status<'_> { + const NSID: &'static str = "city.yoyle.status"; + type Record = StatusRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct StatusRecord; +impl jacquard_common::xrpc::XrpcResp for StatusRecord { + const NSID: &'static str = "city.yoyle.status"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = StatusGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for StatusRecord { + const NSID: &'static str = "city.yoyle.status"; + type Record = StatusRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Status<'a> { + fn nsid() -> &'static str { + "city.yoyle.status" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_city_yoyle_status() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.text; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 3000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 3000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.text; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_city_yoyle_status() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("city.yoyle.status"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("Short status update"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("text") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(3000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/club_stellz/evm/address_control.rs b/crates/jacquard-api/src/club_stellz/evm/address_control.rs index 56749fa9..637fb1a9 100644 --- a/crates/jacquard-api/src/club_stellz/evm/address_control.rs +++ b/crates/jacquard-api/src/club_stellz/evm/address_control.rs @@ -40,51 +40,51 @@ pub mod address_control_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Siwe; type Signature; type Address; + type Siwe; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Siwe = Unset; type Signature = Unset; type Address = Unset; - } - ///State transition - sets the `siwe` field to Set - pub struct SetSiwe<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSiwe<S> {} - impl<S: State> State for SetSiwe<S> { - type Siwe = Set<members::siwe>; - type Signature = S::Signature; - type Address = S::Address; + type Siwe = Unset; } ///State transition - sets the `signature` field to Set pub struct SetSignature<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSignature<S> {} impl<S: State> State for SetSignature<S> { - type Siwe = S::Siwe; type Signature = Set<members::signature>; type Address = S::Address; + type Siwe = S::Siwe; } ///State transition - sets the `address` field to Set pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAddress<S> {} impl<S: State> State for SetAddress<S> { - type Siwe = S::Siwe; type Signature = S::Signature; type Address = Set<members::address>; + type Siwe = S::Siwe; + } + ///State transition - sets the `siwe` field to Set + pub struct SetSiwe<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSiwe<S> {} + impl<S: State> State for SetSiwe<S> { + type Signature = S::Signature; + type Address = S::Address; + type Siwe = Set<members::siwe>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `siwe` field - pub struct siwe(()); ///Marker type for the `signature` field pub struct signature(()); ///Marker type for the `address` field pub struct address(()); + ///Marker type for the `siwe` field + pub struct siwe(()); } } @@ -191,9 +191,9 @@ where impl<'a, S> AddressControlBuilder<'a, S> where S: address_control_state::State, - S::Siwe: address_control_state::IsSet, S::Signature: address_control_state::IsSet, S::Address: address_control_state::IsSet, + S::Siwe: address_control_state::IsSet, { /// Build the final struct pub fn build(self) -> AddressControl<'a> { @@ -539,149 +539,149 @@ pub mod siwe_message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Nonce; - type IssuedAt; + type Address; type Version; type Uri; - type Address; - type ChainId; + type Nonce; + type IssuedAt; type Statement; + type ChainId; type Domain; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Nonce = Unset; - type IssuedAt = Unset; + type Address = Unset; type Version = Unset; type Uri = Unset; - type Address = Unset; - type ChainId = Unset; + type Nonce = Unset; + type IssuedAt = Unset; type Statement = Unset; + type ChainId = Unset; type Domain = Unset; } - ///State transition - sets the `nonce` field to Set - pub struct SetNonce<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNonce<S> {} - impl<S: State> State for SetNonce<S> { - type Nonce = Set<members::nonce>; - type IssuedAt = S::IssuedAt; + ///State transition - sets the `address` field to Set + pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAddress<S> {} + impl<S: State> State for SetAddress<S> { + type Address = Set<members::address>; type Version = S::Version; type Uri = S::Uri; - type Address = S::Address; - type ChainId = S::ChainId; - type Statement = S::Statement; - type Domain = S::Domain; - } - ///State transition - sets the `issued_at` field to Set - pub struct SetIssuedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIssuedAt<S> {} - impl<S: State> State for SetIssuedAt<S> { type Nonce = S::Nonce; - type IssuedAt = Set<members::issued_at>; - type Version = S::Version; - type Uri = S::Uri; - type Address = S::Address; - type ChainId = S::ChainId; + type IssuedAt = S::IssuedAt; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = S::Domain; } ///State transition - sets the `version` field to Set pub struct SetVersion<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVersion<S> {} impl<S: State> State for SetVersion<S> { - type Nonce = S::Nonce; - type IssuedAt = S::IssuedAt; + type Address = S::Address; type Version = Set<members::version>; type Uri = S::Uri; - type Address = S::Address; - type ChainId = S::ChainId; + type Nonce = S::Nonce; + type IssuedAt = S::IssuedAt; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = S::Domain; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Nonce = S::Nonce; - type IssuedAt = S::IssuedAt; + type Address = S::Address; type Version = S::Version; type Uri = Set<members::uri>; - type Address = S::Address; - type ChainId = S::ChainId; + type Nonce = S::Nonce; + type IssuedAt = S::IssuedAt; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = S::Domain; } - ///State transition - sets the `address` field to Set - pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAddress<S> {} - impl<S: State> State for SetAddress<S> { - type Nonce = S::Nonce; - type IssuedAt = S::IssuedAt; + ///State transition - sets the `nonce` field to Set + pub struct SetNonce<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNonce<S> {} + impl<S: State> State for SetNonce<S> { + type Address = S::Address; type Version = S::Version; type Uri = S::Uri; - type Address = Set<members::address>; - type ChainId = S::ChainId; + type Nonce = Set<members::nonce>; + type IssuedAt = S::IssuedAt; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = S::Domain; } - ///State transition - sets the `chain_id` field to Set - pub struct SetChainId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetChainId<S> {} - impl<S: State> State for SetChainId<S> { - type Nonce = S::Nonce; - type IssuedAt = S::IssuedAt; + ///State transition - sets the `issued_at` field to Set + pub struct SetIssuedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIssuedAt<S> {} + impl<S: State> State for SetIssuedAt<S> { + type Address = S::Address; type Version = S::Version; type Uri = S::Uri; - type Address = S::Address; - type ChainId = Set<members::chain_id>; + type Nonce = S::Nonce; + type IssuedAt = Set<members::issued_at>; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = S::Domain; } ///State transition - sets the `statement` field to Set pub struct SetStatement<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatement<S> {} impl<S: State> State for SetStatement<S> { + type Address = S::Address; + type Version = S::Version; + type Uri = S::Uri; type Nonce = S::Nonce; type IssuedAt = S::IssuedAt; + type Statement = Set<members::statement>; + type ChainId = S::ChainId; + type Domain = S::Domain; + } + ///State transition - sets the `chain_id` field to Set + pub struct SetChainId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetChainId<S> {} + impl<S: State> State for SetChainId<S> { + type Address = S::Address; type Version = S::Version; type Uri = S::Uri; - type Address = S::Address; - type ChainId = S::ChainId; - type Statement = Set<members::statement>; + type Nonce = S::Nonce; + type IssuedAt = S::IssuedAt; + type Statement = S::Statement; + type ChainId = Set<members::chain_id>; type Domain = S::Domain; } ///State transition - sets the `domain` field to Set pub struct SetDomain<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDomain<S> {} impl<S: State> State for SetDomain<S> { - type Nonce = S::Nonce; - type IssuedAt = S::IssuedAt; + type Address = S::Address; type Version = S::Version; type Uri = S::Uri; - type Address = S::Address; - type ChainId = S::ChainId; + type Nonce = S::Nonce; + type IssuedAt = S::IssuedAt; type Statement = S::Statement; + type ChainId = S::ChainId; type Domain = Set<members::domain>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `nonce` field - pub struct nonce(()); - ///Marker type for the `issued_at` field - pub struct issued_at(()); + ///Marker type for the `address` field + pub struct address(()); ///Marker type for the `version` field pub struct version(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `address` field - pub struct address(()); - ///Marker type for the `chain_id` field - pub struct chain_id(()); + ///Marker type for the `nonce` field + pub struct nonce(()); + ///Marker type for the `issued_at` field + pub struct issued_at(()); ///Marker type for the `statement` field pub struct statement(()); + ///Marker type for the `chain_id` field + pub struct chain_id(()); ///Marker type for the `domain` field pub struct domain(()); } @@ -876,13 +876,13 @@ where impl<'a, S> SiweMessageBuilder<'a, S> where S: siwe_message_state::State, - S::Nonce: siwe_message_state::IsSet, - S::IssuedAt: siwe_message_state::IsSet, + S::Address: siwe_message_state::IsSet, S::Version: siwe_message_state::IsSet, S::Uri: siwe_message_state::IsSet, - S::Address: siwe_message_state::IsSet, - S::ChainId: siwe_message_state::IsSet, + S::Nonce: siwe_message_state::IsSet, + S::IssuedAt: siwe_message_state::IsSet, S::Statement: siwe_message_state::IsSet, + S::ChainId: siwe_message_state::IsSet, S::Domain: siwe_message_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/com_atproto/admin.rs b/crates/jacquard-api/src/com_atproto/admin.rs index be518337..ec3c5974 100644 --- a/crates/jacquard-api/src/com_atproto/admin.rs +++ b/crates/jacquard-api/src/com_atproto/admin.rs @@ -80,51 +80,51 @@ pub mod account_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Handle; type IndexedAt; type Did; - type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Handle = Unset; type IndexedAt = Unset; type Did = Unset; - type Handle = Unset; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Handle = Set<members::handle>; + type IndexedAt = S::IndexedAt; + type Did = S::Did; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { + type Handle = S::Handle; type IndexedAt = Set<members::indexed_at>; type Did = S::Did; - type Handle = S::Handle; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type IndexedAt = S::IndexedAt; - type Did = Set<members::did>; type Handle = S::Handle; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { type IndexedAt = S::IndexedAt; - type Did = S::Did; - type Handle = Set<members::handle>; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `handle` field + pub struct handle(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `handle` field - pub struct handle(()); } } @@ -401,9 +401,9 @@ impl<'a, S: account_view_state::State> AccountViewBuilder<'a, S> { impl<'a, S> AccountViewBuilder<'a, S> where S: account_view_state::State, + S::Handle: account_view_state::IsSet, S::IndexedAt: account_view_state::IsSet, S::Did: account_view_state::IsSet, - S::Handle: account_view_state::IsSet, { /// Build the final struct pub fn build(self) -> AccountView<'a> { diff --git a/crates/jacquard-api/src/com_atproto/admin/update_account_email.rs b/crates/jacquard-api/src/com_atproto/admin/update_account_email.rs index cf27c636..24aebdcd 100644 --- a/crates/jacquard-api/src/com_atproto/admin/update_account_email.rs +++ b/crates/jacquard-api/src/com_atproto/admin/update_account_email.rs @@ -34,37 +34,37 @@ pub mod update_account_email_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Account; type Email; + type Account; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Account = Unset; type Email = Unset; - } - ///State transition - sets the `account` field to Set - pub struct SetAccount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAccount<S> {} - impl<S: State> State for SetAccount<S> { - type Account = Set<members::account>; - type Email = S::Email; + type Account = Unset; } ///State transition - sets the `email` field to Set pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEmail<S> {} impl<S: State> State for SetEmail<S> { - type Account = S::Account; type Email = Set<members::email>; + type Account = S::Account; + } + ///State transition - sets the `account` field to Set + pub struct SetAccount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAccount<S> {} + impl<S: State> State for SetAccount<S> { + type Email = S::Email; + type Account = Set<members::account>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `account` field - pub struct account(()); ///Marker type for the `email` field pub struct email(()); + ///Marker type for the `account` field + pub struct account(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> UpdateAccountEmailBuilder<'a, S> where S: update_account_email_state::State, - S::Account: update_account_email_state::IsSet, S::Email: update_account_email_state::IsSet, + S::Account: update_account_email_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateAccountEmail<'a> { diff --git a/crates/jacquard-api/src/com_atproto/identity.rs b/crates/jacquard-api/src/com_atproto/identity.rs index 062bb12b..ad1d03c9 100644 --- a/crates/jacquard-api/src/com_atproto/identity.rs +++ b/crates/jacquard-api/src/com_atproto/identity.rs @@ -47,51 +47,51 @@ pub mod identity_info_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; type DidDoc; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; type DidDoc = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Handle = Set<members::handle>; - type Did = S::Did; - type DidDoc = S::DidDoc; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Handle = S::Handle; type Did = Set<members::did>; type DidDoc = S::DidDoc; + type Handle = S::Handle; } ///State transition - sets the `did_doc` field to Set pub struct SetDidDoc<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDidDoc<S> {} impl<S: State> State for SetDidDoc<S> { - type Handle = S::Handle; type Did = S::Did; type DidDoc = Set<members::did_doc>; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Did = S::Did; + type DidDoc = S::DidDoc; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `did_doc` field pub struct did_doc(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -184,9 +184,9 @@ where impl<'a, S> IdentityInfoBuilder<'a, S> where S: identity_info_state::State, - S::Handle: identity_info_state::IsSet, S::Did: identity_info_state::IsSet, S::DidDoc: identity_info_state::IsSet, + S::Handle: identity_info_state::IsSet, { /// Build the final struct pub fn build(self) -> IdentityInfo<'a> { diff --git a/crates/jacquard-api/src/com_atproto/label.rs b/crates/jacquard-api/src/com_atproto/label.rs index e5ee1b58..ec41f4b1 100644 --- a/crates/jacquard-api/src/com_atproto/label.rs +++ b/crates/jacquard-api/src/com_atproto/label.rs @@ -63,67 +63,67 @@ pub mod label_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Src; - type Cts; type Val; + type Uri; + type Cts; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Src = Unset; - type Cts = Unset; type Val = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Src = S::Src; - type Cts = S::Cts; - type Val = S::Val; + type Uri = Unset; + type Cts = Unset; } ///State transition - sets the `src` field to Set pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSrc<S> {} impl<S: State> State for SetSrc<S> { - type Uri = S::Uri; type Src = Set<members::src>; - type Cts = S::Cts; type Val = S::Val; - } - ///State transition - sets the `cts` field to Set - pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCts<S> {} - impl<S: State> State for SetCts<S> { type Uri = S::Uri; - type Src = S::Src; - type Cts = Set<members::cts>; - type Val = S::Val; + type Cts = S::Cts; } ///State transition - sets the `val` field to Set pub struct SetVal<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVal<S> {} impl<S: State> State for SetVal<S> { + type Src = S::Src; + type Val = Set<members::val>; type Uri = S::Uri; + type Cts = S::Cts; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Src = S::Src; + type Val = S::Val; + type Uri = Set<members::uri>; type Cts = S::Cts; - type Val = Set<members::val>; + } + ///State transition - sets the `cts` field to Set + pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCts<S> {} + impl<S: State> State for SetCts<S> { + type Src = S::Src; + type Val = S::Val; + type Uri = S::Uri; + type Cts = Set<members::cts>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `src` field pub struct src(()); - ///Marker type for the `cts` field - pub struct cts(()); ///Marker type for the `val` field pub struct val(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cts` field + pub struct cts(()); } } @@ -328,10 +328,10 @@ impl<'a, S: label_state::State> LabelBuilder<'a, S> { impl<'a, S> LabelBuilder<'a, S> where S: label_state::State, - S::Uri: label_state::IsSet, S::Src: label_state::IsSet, - S::Cts: label_state::IsSet, S::Val: label_state::IsSet, + S::Uri: label_state::IsSet, + S::Cts: label_state::IsSet, { /// Build the final struct pub fn build(self) -> Label<'a> { @@ -1059,67 +1059,67 @@ pub mod label_value_definition_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Severity; type Identifier; - type Locales; type Blurs; + type Locales; + type Severity; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Severity = Unset; type Identifier = Unset; - type Locales = Unset; type Blurs = Unset; - } - ///State transition - sets the `severity` field to Set - pub struct SetSeverity<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSeverity<S> {} - impl<S: State> State for SetSeverity<S> { - type Severity = Set<members::severity>; - type Identifier = S::Identifier; - type Locales = S::Locales; - type Blurs = S::Blurs; + type Locales = Unset; + type Severity = Unset; } ///State transition - sets the `identifier` field to Set pub struct SetIdentifier<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIdentifier<S> {} impl<S: State> State for SetIdentifier<S> { - type Severity = S::Severity; type Identifier = Set<members::identifier>; - type Locales = S::Locales; type Blurs = S::Blurs; + type Locales = S::Locales; + type Severity = S::Severity; + } + ///State transition - sets the `blurs` field to Set + pub struct SetBlurs<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlurs<S> {} + impl<S: State> State for SetBlurs<S> { + type Identifier = S::Identifier; + type Blurs = Set<members::blurs>; + type Locales = S::Locales; + type Severity = S::Severity; } ///State transition - sets the `locales` field to Set pub struct SetLocales<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLocales<S> {} impl<S: State> State for SetLocales<S> { - type Severity = S::Severity; type Identifier = S::Identifier; - type Locales = Set<members::locales>; type Blurs = S::Blurs; - } - ///State transition - sets the `blurs` field to Set - pub struct SetBlurs<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlurs<S> {} - impl<S: State> State for SetBlurs<S> { + type Locales = Set<members::locales>; type Severity = S::Severity; + } + ///State transition - sets the `severity` field to Set + pub struct SetSeverity<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSeverity<S> {} + impl<S: State> State for SetSeverity<S> { type Identifier = S::Identifier; + type Blurs = S::Blurs; type Locales = S::Locales; - type Blurs = Set<members::blurs>; + type Severity = Set<members::severity>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `severity` field - pub struct severity(()); ///Marker type for the `identifier` field pub struct identifier(()); - ///Marker type for the `locales` field - pub struct locales(()); ///Marker type for the `blurs` field pub struct blurs(()); + ///Marker type for the `locales` field + pub struct locales(()); + ///Marker type for the `severity` field + pub struct severity(()); } } @@ -1274,10 +1274,10 @@ where impl<'a, S> LabelValueDefinitionBuilder<'a, S> where S: label_value_definition_state::State, - S::Severity: label_value_definition_state::IsSet, S::Identifier: label_value_definition_state::IsSet, - S::Locales: label_value_definition_state::IsSet, S::Blurs: label_value_definition_state::IsSet, + S::Locales: label_value_definition_state::IsSet, + S::Severity: label_value_definition_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelValueDefinition<'a> { @@ -1687,51 +1687,51 @@ pub mod label_value_definition_strings_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Lang; type Name; type Description; - type Lang; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Lang = Unset; type Name = Unset; type Description = Unset; - type Lang = Unset; + } + ///State transition - sets the `lang` field to Set + pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLang<S> {} + impl<S: State> State for SetLang<S> { + type Lang = Set<members::lang>; + type Name = S::Name; + type Description = S::Description; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type Lang = S::Lang; type Name = Set<members::name>; type Description = S::Description; - type Lang = S::Lang; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Name = S::Name; - type Description = Set<members::description>; type Lang = S::Lang; - } - ///State transition - sets the `lang` field to Set - pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLang<S> {} - impl<S: State> State for SetLang<S> { type Name = S::Name; - type Description = S::Description; - type Lang = Set<members::lang>; + type Description = Set<members::description>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `lang` field + pub struct lang(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `description` field pub struct description(()); - ///Marker type for the `lang` field - pub struct lang(()); } } @@ -1841,9 +1841,9 @@ where impl<'a, S> LabelValueDefinitionStringsBuilder<'a, S> where S: label_value_definition_strings_state::State, + S::Lang: label_value_definition_strings_state::IsSet, S::Name: label_value_definition_strings_state::IsSet, S::Description: label_value_definition_strings_state::IsSet, - S::Lang: label_value_definition_strings_state::IsSet, { /// Build the final struct pub fn build(self) -> LabelValueDefinitionStrings<'a> { diff --git a/crates/jacquard-api/src/com_atproto/repo/apply_writes.rs b/crates/jacquard-api/src/com_atproto/repo/apply_writes.rs index 8c0f7cb3..e046b121 100644 --- a/crates/jacquard-api/src/com_atproto/repo/apply_writes.rs +++ b/crates/jacquard-api/src/com_atproto/repo/apply_writes.rs @@ -42,37 +42,37 @@ pub mod create_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Value; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Value = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Collection = Set<members::collection>; - type Value = S::Value; + type Collection = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Collection = S::Collection; type Value = Set<members::value>; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type Value = S::Value; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -179,8 +179,8 @@ where impl<'a, S> CreateBuilder<'a, S> where S: create_state::State, - S::Collection: create_state::IsSet, S::Value: create_state::IsSet, + S::Collection: create_state::IsSet, { /// Build the final struct pub fn build(self) -> Create<'a> { @@ -1020,37 +1020,37 @@ pub mod delete_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Rkey; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Rkey = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Collection = Set<members::collection>; - type Rkey = S::Rkey; + type Collection = Unset; } ///State transition - sets the `rkey` field to Set pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRkey<S> {} impl<S: State> State for SetRkey<S> { - type Collection = S::Collection; type Rkey = Set<members::rkey>; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type Rkey = S::Rkey; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `rkey` field pub struct rkey(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -1131,8 +1131,8 @@ where impl<'a, S> DeleteBuilder<'a, S> where S: delete_state::State, - S::Collection: delete_state::IsSet, S::Rkey: delete_state::IsSet, + S::Collection: delete_state::IsSet, { /// Build the final struct pub fn build(self) -> Delete<'a> { @@ -1568,51 +1568,51 @@ pub mod update_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Value; type Collection; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Value = Unset; type Collection = Unset; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Rkey = Set<members::rkey>; - type Value = S::Value; - type Collection = S::Collection; + type Rkey = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Rkey = S::Rkey; type Value = Set<members::value>; type Collection = S::Collection; + type Rkey = S::Rkey; } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { - type Rkey = S::Rkey; type Value = S::Value; type Collection = Set<members::collection>; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Value = S::Value; + type Collection = S::Collection; + type Rkey = Set<members::rkey>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `value` field pub struct value(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -1713,9 +1713,9 @@ where impl<'a, S> UpdateBuilder<'a, S> where S: update_state::State, - S::Rkey: update_state::IsSet, S::Value: update_state::IsSet, S::Collection: update_state::IsSet, + S::Rkey: update_state::IsSet, { /// Build the final struct pub fn build(self) -> Update<'a> { @@ -1791,37 +1791,37 @@ pub mod update_result_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Uri = S::Uri; type Cid = Set<members::cid>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Cid = S::Cid; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -1914,8 +1914,8 @@ impl<'a, S: update_result_state::State> UpdateResultBuilder<'a, S> { impl<'a, S> UpdateResultBuilder<'a, S> where S: update_result_state::State, - S::Uri: update_result_state::IsSet, S::Cid: update_result_state::IsSet, + S::Uri: update_result_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateResult<'a> { diff --git a/crates/jacquard-api/src/com_atproto/repo/create_record.rs b/crates/jacquard-api/src/com_atproto/repo/create_record.rs index dbaf0b9b..f35727d5 100644 --- a/crates/jacquard-api/src/com_atproto/repo/create_record.rs +++ b/crates/jacquard-api/src/com_atproto/repo/create_record.rs @@ -53,51 +53,51 @@ pub mod create_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Repo; type Record; type Collection; - type Repo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Repo = Unset; type Record = Unset; type Collection = Unset; - type Repo = Unset; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { + type Repo = Set<members::repo>; + type Record = S::Record; + type Collection = S::Collection; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { + type Repo = S::Repo; type Record = Set<members::record>; type Collection = S::Collection; - type Repo = S::Repo; } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { - type Record = S::Record; - type Collection = Set<members::collection>; type Repo = S::Repo; - } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { type Record = S::Record; - type Collection = S::Collection; - type Repo = Set<members::repo>; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `collection` field pub struct collection(()); - ///Marker type for the `repo` field - pub struct repo(()); } } @@ -258,9 +258,9 @@ impl<'a, S: create_record_state::State> CreateRecordBuilder<'a, S> { impl<'a, S> CreateRecordBuilder<'a, S> where S: create_record_state::State, + S::Repo: create_record_state::IsSet, S::Record: create_record_state::IsSet, S::Collection: create_record_state::IsSet, - S::Repo: create_record_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateRecord<'a> { diff --git a/crates/jacquard-api/src/com_atproto/repo/delete_record.rs b/crates/jacquard-api/src/com_atproto/repo/delete_record.rs index 03dd23b3..54cbe858 100644 --- a/crates/jacquard-api/src/com_atproto/repo/delete_record.rs +++ b/crates/jacquard-api/src/com_atproto/repo/delete_record.rs @@ -48,49 +48,49 @@ pub mod delete_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Collection; + type Rkey; type Repo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Collection = Unset; + type Rkey = Unset; type Repo = Unset; } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Rkey = Set<members::rkey>; - type Collection = S::Collection; - type Repo = S::Repo; - } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { - type Rkey = S::Rkey; type Collection = Set<members::collection>; + type Rkey = S::Rkey; + type Repo = S::Repo; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Collection = S::Collection; + type Rkey = Set<members::rkey>; type Repo = S::Repo; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Rkey = S::Rkey; type Collection = S::Collection; + type Rkey = S::Rkey; type Repo = Set<members::repo>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `rkey` field + pub struct rkey(()); ///Marker type for the `repo` field pub struct repo(()); } @@ -233,8 +233,8 @@ impl<'a, S: delete_record_state::State> DeleteRecordBuilder<'a, S> { impl<'a, S> DeleteRecordBuilder<'a, S> where S: delete_record_state::State, - S::Rkey: delete_record_state::IsSet, S::Collection: delete_record_state::IsSet, + S::Rkey: delete_record_state::IsSet, S::Repo: delete_record_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/com_atproto/repo/get_record.rs b/crates/jacquard-api/src/com_atproto/repo/get_record.rs index 8786d059..67a73960 100644 --- a/crates/jacquard-api/src/com_atproto/repo/get_record.rs +++ b/crates/jacquard-api/src/com_atproto/repo/get_record.rs @@ -39,51 +39,51 @@ pub mod get_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Rkey; type Repo; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Rkey = Unset; type Repo = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Collection = Set<members::collection>; - type Rkey = S::Rkey; - type Repo = S::Repo; + type Collection = Unset; } ///State transition - sets the `rkey` field to Set pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRkey<S> {} impl<S: State> State for SetRkey<S> { - type Collection = S::Collection; type Rkey = Set<members::rkey>; type Repo = S::Repo; + type Collection = S::Collection; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Collection = S::Collection; type Rkey = S::Rkey; type Repo = Set<members::repo>; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type Rkey = S::Rkey; + type Repo = S::Repo; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `rkey` field pub struct rkey(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -204,9 +204,9 @@ where impl<'a, S> GetRecordBuilder<'a, S> where S: get_record_state::State, - S::Collection: get_record_state::IsSet, S::Rkey: get_record_state::IsSet, S::Repo: get_record_state::IsSet, + S::Collection: get_record_state::IsSet, { /// Build the final struct pub fn build(self) -> GetRecord<'a> { diff --git a/crates/jacquard-api/src/com_atproto/repo/list_missing_blobs.rs b/crates/jacquard-api/src/com_atproto/repo/list_missing_blobs.rs index 6a5fbc52..3bc064e6 100644 --- a/crates/jacquard-api/src/com_atproto/repo/list_missing_blobs.rs +++ b/crates/jacquard-api/src/com_atproto/repo/list_missing_blobs.rs @@ -186,37 +186,37 @@ pub mod record_blob_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type RecordUri; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type RecordUri = Unset; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type RecordUri = S::RecordUri; + type Cid = Unset; } ///State transition - sets the `record_uri` field to Set pub struct SetRecordUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecordUri<S> {} impl<S: State> State for SetRecordUri<S> { - type Cid = S::Cid; type RecordUri = Set<members::record_uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type RecordUri = S::RecordUri; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `record_uri` field pub struct record_uri(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -289,8 +289,8 @@ where impl<'a, S> RecordBlobBuilder<'a, S> where S: record_blob_state::State, - S::Cid: record_blob_state::IsSet, S::RecordUri: record_blob_state::IsSet, + S::Cid: record_blob_state::IsSet, { /// Build the final struct pub fn build(self) -> RecordBlob<'a> { diff --git a/crates/jacquard-api/src/com_atproto/repo/list_records.rs b/crates/jacquard-api/src/com_atproto/repo/list_records.rs index ad621d4c..ea902519 100644 --- a/crates/jacquard-api/src/com_atproto/repo/list_records.rs +++ b/crates/jacquard-api/src/com_atproto/repo/list_records.rs @@ -40,37 +40,37 @@ pub mod list_records_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; type Repo; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; type Repo = Unset; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Collection = Set<members::collection>; - type Repo = S::Repo; + type Collection = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Collection = S::Collection; type Repo = Set<members::repo>; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type Repo = S::Repo; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -188,8 +188,8 @@ impl<'a, S: list_records_state::State> ListRecordsBuilder<'a, S> { impl<'a, S> ListRecordsBuilder<'a, S> where S: list_records_state::State, - S::Collection: list_records_state::IsSet, S::Repo: list_records_state::IsSet, + S::Collection: list_records_state::IsSet, { /// Build the final struct pub fn build(self) -> ListRecords<'a> { @@ -278,49 +278,49 @@ pub mod record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; + type Uri = Unset; type Value = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; - type Value = S::Value; - } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Uri = S::Uri; type Cid = Set<members::cid>; + type Uri = S::Uri; + type Value = S::Value; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Cid = S::Cid; + type Uri = Set<members::uri>; type Value = S::Value; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Uri = S::Uri; type Cid = S::Cid; + type Uri = S::Uri; type Value = Set<members::value>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `value` field pub struct value(()); } @@ -415,8 +415,8 @@ where impl<'a, S> RecordBuilder<'a, S> where S: record_state::State, - S::Uri: record_state::IsSet, S::Cid: record_state::IsSet, + S::Uri: record_state::IsSet, S::Value: record_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/com_atproto/repo/put_record.rs b/crates/jacquard-api/src/com_atproto/repo/put_record.rs index 14759be2..2bd3a07a 100644 --- a/crates/jacquard-api/src/com_atproto/repo/put_record.rs +++ b/crates/jacquard-api/src/com_atproto/repo/put_record.rs @@ -54,67 +54,67 @@ pub mod put_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; - type Collection; type Record; + type Repo; type Rkey; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; - type Collection = Unset; type Record = Unset; + type Repo = Unset; type Rkey = Unset; - } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { - type Repo = Set<members::repo>; - type Collection = S::Collection; - type Record = S::Record; - type Rkey = S::Rkey; - } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Repo = S::Repo; - type Collection = Set<members::collection>; - type Record = S::Record; - type Rkey = S::Rkey; + type Collection = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { + type Record = Set<members::record>; type Repo = S::Repo; + type Rkey = S::Rkey; type Collection = S::Collection; - type Record = Set<members::record>; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { + type Record = S::Record; + type Repo = Set<members::repo>; type Rkey = S::Rkey; + type Collection = S::Collection; } ///State transition - sets the `rkey` field to Set pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRkey<S> {} impl<S: State> State for SetRkey<S> { + type Record = S::Record; type Repo = S::Repo; + type Rkey = Set<members::rkey>; type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { type Record = S::Record; - type Rkey = Set<members::rkey>; + type Repo = S::Repo; + type Rkey = S::Rkey; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); - ///Marker type for the `collection` field - pub struct collection(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `rkey` field pub struct rkey(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -289,10 +289,10 @@ impl<'a, S: put_record_state::State> PutRecordBuilder<'a, S> { impl<'a, S> PutRecordBuilder<'a, S> where S: put_record_state::State, - S::Repo: put_record_state::IsSet, - S::Collection: put_record_state::IsSet, S::Record: put_record_state::IsSet, + S::Repo: put_record_state::IsSet, S::Rkey: put_record_state::IsSet, + S::Collection: put_record_state::IsSet, { /// Build the final struct pub fn build(self) -> PutRecord<'a> { diff --git a/crates/jacquard-api/src/com_atproto/server.rs b/crates/jacquard-api/src/com_atproto/server.rs index 947c98c0..285eb788 100644 --- a/crates/jacquard-api/src/com_atproto/server.rs +++ b/crates/jacquard-api/src/com_atproto/server.rs @@ -66,127 +66,127 @@ pub mod invite_code_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Code; + type Disabled; + type Uses; type Available; type ForAccount; + type Code; type CreatedBy; type CreatedAt; - type Uses; - type Disabled; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Code = Unset; + type Disabled = Unset; + type Uses = Unset; type Available = Unset; type ForAccount = Unset; + type Code = Unset; type CreatedBy = Unset; type CreatedAt = Unset; - type Uses = Unset; - type Disabled = Unset; } - ///State transition - sets the `code` field to Set - pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCode<S> {} - impl<S: State> State for SetCode<S> { - type Code = Set<members::code>; + ///State transition - sets the `disabled` field to Set + pub struct SetDisabled<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisabled<S> {} + impl<S: State> State for SetDisabled<S> { + type Disabled = Set<members::disabled>; + type Uses = S::Uses; type Available = S::Available; type ForAccount = S::ForAccount; + type Code = S::Code; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Uses = S::Uses; + } + ///State transition - sets the `uses` field to Set + pub struct SetUses<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUses<S> {} + impl<S: State> State for SetUses<S> { type Disabled = S::Disabled; + type Uses = Set<members::uses>; + type Available = S::Available; + type ForAccount = S::ForAccount; + type Code = S::Code; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `available` field to Set pub struct SetAvailable<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAvailable<S> {} impl<S: State> State for SetAvailable<S> { - type Code = S::Code; + type Disabled = S::Disabled; + type Uses = S::Uses; type Available = Set<members::available>; type ForAccount = S::ForAccount; + type Code = S::Code; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Uses = S::Uses; - type Disabled = S::Disabled; } ///State transition - sets the `for_account` field to Set pub struct SetForAccount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetForAccount<S> {} impl<S: State> State for SetForAccount<S> { - type Code = S::Code; + type Disabled = S::Disabled; + type Uses = S::Uses; type Available = S::Available; type ForAccount = Set<members::for_account>; + type Code = S::Code; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Uses = S::Uses; + } + ///State transition - sets the `code` field to Set + pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCode<S> {} + impl<S: State> State for SetCode<S> { type Disabled = S::Disabled; + type Uses = S::Uses; + type Available = S::Available; + type ForAccount = S::ForAccount; + type Code = Set<members::code>; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { - type Code = S::Code; + type Disabled = S::Disabled; + type Uses = S::Uses; type Available = S::Available; type ForAccount = S::ForAccount; + type Code = S::Code; type CreatedBy = Set<members::created_by>; type CreatedAt = S::CreatedAt; - type Uses = S::Uses; - type Disabled = S::Disabled; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Code = S::Code; - type Available = S::Available; - type ForAccount = S::ForAccount; - type CreatedBy = S::CreatedBy; - type CreatedAt = Set<members::created_at>; - type Uses = S::Uses; type Disabled = S::Disabled; - } - ///State transition - sets the `uses` field to Set - pub struct SetUses<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUses<S> {} - impl<S: State> State for SetUses<S> { - type Code = S::Code; + type Uses = S::Uses; type Available = S::Available; type ForAccount = S::ForAccount; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Uses = Set<members::uses>; - type Disabled = S::Disabled; - } - ///State transition - sets the `disabled` field to Set - pub struct SetDisabled<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisabled<S> {} - impl<S: State> State for SetDisabled<S> { type Code = S::Code; - type Available = S::Available; - type ForAccount = S::ForAccount; type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Uses = S::Uses; - type Disabled = Set<members::disabled>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `code` field - pub struct code(()); + ///Marker type for the `disabled` field + pub struct disabled(()); + ///Marker type for the `uses` field + pub struct uses(()); ///Marker type for the `available` field pub struct available(()); ///Marker type for the `for_account` field pub struct for_account(()); + ///Marker type for the `code` field + pub struct code(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `uses` field - pub struct uses(()); - ///Marker type for the `disabled` field - pub struct disabled(()); } } @@ -359,13 +359,13 @@ where impl<'a, S> InviteCodeBuilder<'a, S> where S: invite_code_state::State, - S::Code: invite_code_state::IsSet, + S::Disabled: invite_code_state::IsSet, + S::Uses: invite_code_state::IsSet, S::Available: invite_code_state::IsSet, S::ForAccount: invite_code_state::IsSet, + S::Code: invite_code_state::IsSet, S::CreatedBy: invite_code_state::IsSet, S::CreatedAt: invite_code_state::IsSet, - S::Uses: invite_code_state::IsSet, - S::Disabled: invite_code_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteCode<'a> { diff --git a/crates/jacquard-api/src/com_atproto/server/create_app_password.rs b/crates/jacquard-api/src/com_atproto/server/create_app_password.rs index 8c8c1686..db353baf 100644 --- a/crates/jacquard-api/src/com_atproto/server/create_app_password.rs +++ b/crates/jacquard-api/src/com_atproto/server/create_app_password.rs @@ -37,50 +37,50 @@ pub mod app_password_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; - type Password; type Name; + type Password; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; - type Password = Unset; type Name = Unset; + type Password = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type CreatedAt = Set<members::created_at>; - type Password = S::Password; - type Name = S::Name; - } - ///State transition - sets the `password` field to Set - pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPassword<S> {} - impl<S: State> State for SetPassword<S> { - type CreatedAt = S::CreatedAt; - type Password = Set<members::password>; type Name = S::Name; + type Password = S::Password; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type CreatedAt = S::CreatedAt; - type Password = S::Password; type Name = Set<members::name>; + type Password = S::Password; + } + ///State transition - sets the `password` field to Set + pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPassword<S> {} + impl<S: State> State for SetPassword<S> { + type CreatedAt = S::CreatedAt; + type Name = S::Name; + type Password = Set<members::password>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `password` field - pub struct password(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `password` field + pub struct password(()); } } @@ -188,8 +188,8 @@ impl<'a, S> AppPasswordBuilder<'a, S> where S: app_password_state::State, S::CreatedAt: app_password_state::IsSet, - S::Password: app_password_state::IsSet, S::Name: app_password_state::IsSet, + S::Password: app_password_state::IsSet, { /// Build the final struct pub fn build(self) -> AppPassword<'a> { diff --git a/crates/jacquard-api/src/com_atproto/server/create_invite_codes.rs b/crates/jacquard-api/src/com_atproto/server/create_invite_codes.rs index 1567defe..d046e273 100644 --- a/crates/jacquard-api/src/com_atproto/server/create_invite_codes.rs +++ b/crates/jacquard-api/src/com_atproto/server/create_invite_codes.rs @@ -33,37 +33,37 @@ pub mod account_codes_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Codes; type Account; + type Codes; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Codes = Unset; type Account = Unset; - } - ///State transition - sets the `codes` field to Set - pub struct SetCodes<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCodes<S> {} - impl<S: State> State for SetCodes<S> { - type Codes = Set<members::codes>; - type Account = S::Account; + type Codes = Unset; } ///State transition - sets the `account` field to Set pub struct SetAccount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccount<S> {} impl<S: State> State for SetAccount<S> { - type Codes = S::Codes; type Account = Set<members::account>; + type Codes = S::Codes; + } + ///State transition - sets the `codes` field to Set + pub struct SetCodes<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCodes<S> {} + impl<S: State> State for SetCodes<S> { + type Account = S::Account; + type Codes = Set<members::codes>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `codes` field - pub struct codes(()); ///Marker type for the `account` field pub struct account(()); + ///Marker type for the `codes` field + pub struct codes(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> AccountCodesBuilder<'a, S> where S: account_codes_state::State, - S::Codes: account_codes_state::IsSet, S::Account: account_codes_state::IsSet, + S::Codes: account_codes_state::IsSet, { /// Build the final struct pub fn build(self) -> AccountCodes<'a> { @@ -361,37 +361,37 @@ pub mod create_invite_codes_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CodeCount; type UseCount; + type CodeCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CodeCount = Unset; type UseCount = Unset; - } - ///State transition - sets the `code_count` field to Set - pub struct SetCodeCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCodeCount<S> {} - impl<S: State> State for SetCodeCount<S> { - type CodeCount = Set<members::code_count>; - type UseCount = S::UseCount; + type CodeCount = Unset; } ///State transition - sets the `use_count` field to Set pub struct SetUseCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUseCount<S> {} impl<S: State> State for SetUseCount<S> { - type CodeCount = S::CodeCount; type UseCount = Set<members::use_count>; + type CodeCount = S::CodeCount; + } + ///State transition - sets the `code_count` field to Set + pub struct SetCodeCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCodeCount<S> {} + impl<S: State> State for SetCodeCount<S> { + type UseCount = S::UseCount; + type CodeCount = Set<members::code_count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `code_count` field - pub struct code_count(()); ///Marker type for the `use_count` field pub struct use_count(()); + ///Marker type for the `code_count` field + pub struct code_count(()); } } @@ -484,8 +484,8 @@ where impl<'a, S> CreateInviteCodesBuilder<'a, S> where S: create_invite_codes_state::State, - S::CodeCount: create_invite_codes_state::IsSet, S::UseCount: create_invite_codes_state::IsSet, + S::CodeCount: create_invite_codes_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateInviteCodes<'a> { diff --git a/crates/jacquard-api/src/com_atproto/server/delete_account.rs b/crates/jacquard-api/src/com_atproto/server/delete_account.rs index 49e46ced..35d52634 100644 --- a/crates/jacquard-api/src/com_atproto/server/delete_account.rs +++ b/crates/jacquard-api/src/com_atproto/server/delete_account.rs @@ -35,51 +35,51 @@ pub mod delete_account_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Password; - type Did; type Token; + type Did; + type Password; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Password = Unset; - type Did = Unset; type Token = Unset; + type Did = Unset; + type Password = Unset; } - ///State transition - sets the `password` field to Set - pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPassword<S> {} - impl<S: State> State for SetPassword<S> { - type Password = Set<members::password>; + ///State transition - sets the `token` field to Set + pub struct SetToken<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetToken<S> {} + impl<S: State> State for SetToken<S> { + type Token = Set<members::token>; type Did = S::Did; - type Token = S::Token; + type Password = S::Password; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Password = S::Password; - type Did = Set<members::did>; type Token = S::Token; - } - ///State transition - sets the `token` field to Set - pub struct SetToken<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetToken<S> {} - impl<S: State> State for SetToken<S> { + type Did = Set<members::did>; type Password = S::Password; + } + ///State transition - sets the `password` field to Set + pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPassword<S> {} + impl<S: State> State for SetPassword<S> { + type Token = S::Token; type Did = S::Did; - type Token = Set<members::token>; + type Password = Set<members::password>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `password` field - pub struct password(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `token` field pub struct token(()); + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `password` field + pub struct password(()); } } @@ -172,9 +172,9 @@ where impl<'a, S> DeleteAccountBuilder<'a, S> where S: delete_account_state::State, - S::Password: delete_account_state::IsSet, - S::Did: delete_account_state::IsSet, S::Token: delete_account_state::IsSet, + S::Did: delete_account_state::IsSet, + S::Password: delete_account_state::IsSet, { /// Build the final struct pub fn build(self) -> DeleteAccount<'a> { diff --git a/crates/jacquard-api/src/com_atproto/server/list_app_passwords.rs b/crates/jacquard-api/src/com_atproto/server/list_app_passwords.rs index 01aa0e55..ecefe898 100644 --- a/crates/jacquard-api/src/com_atproto/server/list_app_passwords.rs +++ b/crates/jacquard-api/src/com_atproto/server/list_app_passwords.rs @@ -34,37 +34,37 @@ pub mod app_password_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Name; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Name = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Name = S::Name; + type CreatedAt = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Name = S::Name; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -151,8 +151,8 @@ impl<'a, S: app_password_state::State> AppPasswordBuilder<'a, S> { impl<'a, S> AppPasswordBuilder<'a, S> where S: app_password_state::State, - S::CreatedAt: app_password_state::IsSet, S::Name: app_password_state::IsSet, + S::CreatedAt: app_password_state::IsSet, { /// Build the final struct pub fn build(self) -> AppPassword<'a> { diff --git a/crates/jacquard-api/src/com_atproto/sync/get_blocks.rs b/crates/jacquard-api/src/com_atproto/sync/get_blocks.rs index 4571bdb4..6ff6d0a1 100644 --- a/crates/jacquard-api/src/com_atproto/sync/get_blocks.rs +++ b/crates/jacquard-api/src/com_atproto/sync/get_blocks.rs @@ -32,37 +32,37 @@ pub mod get_blocks_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Cids; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Cids = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Cids = S::Cids; + type Did = Unset; } ///State transition - sets the `cids` field to Set pub struct SetCids<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCids<S> {} impl<S: State> State for SetCids<S> { - type Did = S::Did; type Cids = Set<members::cids>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Cids = S::Cids; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `cids` field pub struct cids(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetBlocksBuilder<'a, S> where S: get_blocks_state::State, - S::Did: get_blocks_state::IsSet, S::Cids: get_blocks_state::IsSet, + S::Did: get_blocks_state::IsSet, { /// Build the final struct pub fn build(self) -> GetBlocks<'a> { diff --git a/crates/jacquard-api/src/com_atproto/sync/get_record.rs b/crates/jacquard-api/src/com_atproto/sync/get_record.rs index e2f91988..3bcb7e25 100644 --- a/crates/jacquard-api/src/com_atproto/sync/get_record.rs +++ b/crates/jacquard-api/src/com_atproto/sync/get_record.rs @@ -37,50 +37,50 @@ pub mod get_record_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; - type Rkey; type Collection; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; - type Rkey = Unset; type Collection = Unset; + type Rkey = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Did = Set<members::did>; - type Rkey = S::Rkey; - type Collection = S::Collection; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Did = S::Did; - type Rkey = Set<members::rkey>; type Collection = S::Collection; + type Rkey = S::Rkey; } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { type Did = S::Did; - type Rkey = S::Rkey; type Collection = Set<members::collection>; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Did = S::Did; + type Collection = S::Collection; + type Rkey = Set<members::rkey>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -182,8 +182,8 @@ impl<'a, S> GetRecordBuilder<'a, S> where S: get_record_state::State, S::Did: get_record_state::IsSet, - S::Rkey: get_record_state::IsSet, S::Collection: get_record_state::IsSet, + S::Rkey: get_record_state::IsSet, { /// Build the final struct pub fn build(self) -> GetRecord<'a> { diff --git a/crates/jacquard-api/src/com_atproto/sync/list_repos.rs b/crates/jacquard-api/src/com_atproto/sync/list_repos.rs index 26fbfcd9..fa5ad81f 100644 --- a/crates/jacquard-api/src/com_atproto/sync/list_repos.rs +++ b/crates/jacquard-api/src/com_atproto/sync/list_repos.rs @@ -194,51 +194,51 @@ pub mod repo_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev; type Did; type Head; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev = Unset; type Did = Unset; type Head = Unset; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { - type Rev = Set<members::rev>; - type Did = S::Did; - type Head = S::Head; + type Rev = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Rev = S::Rev; type Did = Set<members::did>; type Head = S::Head; + type Rev = S::Rev; } ///State transition - sets the `head` field to Set pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHead<S> {} impl<S: State> State for SetHead<S> { - type Rev = S::Rev; type Did = S::Did; type Head = Set<members::head>; + type Rev = S::Rev; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Did = S::Did; + type Head = S::Head; + type Rev = Set<members::rev>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev` field - pub struct rev(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `head` field pub struct head(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -359,9 +359,9 @@ impl<'a, S: repo_state::State> RepoBuilder<'a, S> { impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, - S::Rev: repo_state::IsSet, S::Did: repo_state::IsSet, S::Head: repo_state::IsSet, + S::Rev: repo_state::IsSet, { /// Build the final struct pub fn build(self) -> Repo<'a> { diff --git a/crates/jacquard-api/src/com_atproto/sync/subscribe_repos.rs b/crates/jacquard-api/src/com_atproto/sync/subscribe_repos.rs index a198c0d0..acedb655 100644 --- a/crates/jacquard-api/src/com_atproto/sync/subscribe_repos.rs +++ b/crates/jacquard-api/src/com_atproto/sync/subscribe_repos.rs @@ -41,66 +41,66 @@ pub mod account_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Time; - type Seq; type Did; type Active; + type Seq; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Time = Unset; - type Seq = Unset; type Did = Unset; type Active = Unset; + type Seq = Unset; } ///State transition - sets the `time` field to Set pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTime<S> {} impl<S: State> State for SetTime<S> { type Time = Set<members::time>; - type Seq = S::Seq; - type Did = S::Did; - type Active = S::Active; - } - ///State transition - sets the `seq` field to Set - pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSeq<S> {} - impl<S: State> State for SetSeq<S> { - type Time = S::Time; - type Seq = Set<members::seq>; type Did = S::Did; type Active = S::Active; + type Seq = S::Seq; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Time = S::Time; - type Seq = S::Seq; type Did = Set<members::did>; type Active = S::Active; + type Seq = S::Seq; } ///State transition - sets the `active` field to Set pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActive<S> {} impl<S: State> State for SetActive<S> { type Time = S::Time; - type Seq = S::Seq; type Did = S::Did; type Active = Set<members::active>; + type Seq = S::Seq; + } + ///State transition - sets the `seq` field to Set + pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSeq<S> {} + impl<S: State> State for SetSeq<S> { + type Time = S::Time; + type Did = S::Did; + type Active = S::Active; + type Seq = Set<members::seq>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `time` field pub struct time(()); - ///Marker type for the `seq` field - pub struct seq(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `active` field pub struct active(()); + ///Marker type for the `seq` field + pub struct seq(()); } } @@ -228,9 +228,9 @@ impl<'a, S> AccountBuilder<'a, S> where S: account_state::State, S::Time: account_state::IsSet, - S::Seq: account_state::IsSet, S::Did: account_state::IsSet, S::Active: account_state::IsSet, + S::Seq: account_state::IsSet, { /// Build the final struct pub fn build(self) -> Account<'a> { @@ -1073,205 +1073,205 @@ pub mod commit_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Seq; + type TooBig; type Rebase; type Repo; - type Rev; - type Blobs; - type Blocks; - type Commit; - type Seq; type Time; - type TooBig; type Ops; + type Blocks; + type Blobs; + type Commit; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Seq = Unset; + type TooBig = Unset; type Rebase = Unset; type Repo = Unset; - type Rev = Unset; - type Blobs = Unset; - type Blocks = Unset; - type Commit = Unset; - type Seq = Unset; type Time = Unset; - type TooBig = Unset; type Ops = Unset; + type Blocks = Unset; + type Blobs = Unset; + type Commit = Unset; + type Rev = Unset; + } + ///State transition - sets the `seq` field to Set + pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSeq<S> {} + impl<S: State> State for SetSeq<S> { + type Seq = Set<members::seq>; + type TooBig = S::TooBig; + type Rebase = S::Rebase; + type Repo = S::Repo; + type Time = S::Time; + type Ops = S::Ops; + type Blocks = S::Blocks; + type Blobs = S::Blobs; + type Commit = S::Commit; + type Rev = S::Rev; + } + ///State transition - sets the `too_big` field to Set + pub struct SetTooBig<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTooBig<S> {} + impl<S: State> State for SetTooBig<S> { + type Seq = S::Seq; + type TooBig = Set<members::too_big>; + type Rebase = S::Rebase; + type Repo = S::Repo; + type Time = S::Time; + type Ops = S::Ops; + type Blocks = S::Blocks; + type Blobs = S::Blobs; + type Commit = S::Commit; + type Rev = S::Rev; } ///State transition - sets the `rebase` field to Set pub struct SetRebase<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRebase<S> {} impl<S: State> State for SetRebase<S> { + type Seq = S::Seq; + type TooBig = S::TooBig; type Rebase = Set<members::rebase>; type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; - type Blocks = S::Blocks; - type Commit = S::Commit; - type Seq = S::Seq; type Time = S::Time; - type TooBig = S::TooBig; type Ops = S::Ops; + type Blocks = S::Blocks; + type Blobs = S::Blobs; + type Commit = S::Commit; + type Rev = S::Rev; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { + type Seq = S::Seq; + type TooBig = S::TooBig; type Rebase = S::Rebase; type Repo = Set<members::repo>; - type Rev = S::Rev; - type Blobs = S::Blobs; + type Time = S::Time; + type Ops = S::Ops; type Blocks = S::Blocks; + type Blobs = S::Blobs; type Commit = S::Commit; + type Rev = S::Rev; + } + ///State transition - sets the `time` field to Set + pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTime<S> {} + impl<S: State> State for SetTime<S> { type Seq = S::Seq; - type Time = S::Time; type TooBig = S::TooBig; - type Ops = S::Ops; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { type Rebase = S::Rebase; type Repo = S::Repo; - type Rev = Set<members::rev>; - type Blobs = S::Blobs; + type Time = Set<members::time>; + type Ops = S::Ops; type Blocks = S::Blocks; + type Blobs = S::Blobs; type Commit = S::Commit; + type Rev = S::Rev; + } + ///State transition - sets the `ops` field to Set + pub struct SetOps<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOps<S> {} + impl<S: State> State for SetOps<S> { type Seq = S::Seq; - type Time = S::Time; type TooBig = S::TooBig; - type Ops = S::Ops; - } - ///State transition - sets the `blobs` field to Set - pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlobs<S> {} - impl<S: State> State for SetBlobs<S> { type Rebase = S::Rebase; type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = Set<members::blobs>; + type Time = S::Time; + type Ops = Set<members::ops>; type Blocks = S::Blocks; + type Blobs = S::Blobs; type Commit = S::Commit; - type Seq = S::Seq; - type Time = S::Time; - type TooBig = S::TooBig; - type Ops = S::Ops; + type Rev = S::Rev; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlocks<S> {} impl<S: State> State for SetBlocks<S> { + type Seq = S::Seq; + type TooBig = S::TooBig; type Rebase = S::Rebase; type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; + type Time = S::Time; + type Ops = S::Ops; type Blocks = Set<members::blocks>; + type Blobs = S::Blobs; type Commit = S::Commit; + type Rev = S::Rev; + } + ///State transition - sets the `blobs` field to Set + pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlobs<S> {} + impl<S: State> State for SetBlobs<S> { type Seq = S::Seq; - type Time = S::Time; type TooBig = S::TooBig; + type Rebase = S::Rebase; + type Repo = S::Repo; + type Time = S::Time; type Ops = S::Ops; + type Blocks = S::Blocks; + type Blobs = Set<members::blobs>; + type Commit = S::Commit; + type Rev = S::Rev; } ///State transition - sets the `commit` field to Set pub struct SetCommit<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCommit<S> {} impl<S: State> State for SetCommit<S> { - type Rebase = S::Rebase; - type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; - type Blocks = S::Blocks; - type Commit = Set<members::commit>; type Seq = S::Seq; - type Time = S::Time; type TooBig = S::TooBig; - type Ops = S::Ops; - } - ///State transition - sets the `seq` field to Set - pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSeq<S> {} - impl<S: State> State for SetSeq<S> { type Rebase = S::Rebase; type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; - type Blocks = S::Blocks; - type Commit = S::Commit; - type Seq = Set<members::seq>; type Time = S::Time; - type TooBig = S::TooBig; type Ops = S::Ops; - } - ///State transition - sets the `time` field to Set - pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTime<S> {} - impl<S: State> State for SetTime<S> { - type Rebase = S::Rebase; - type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; type Blocks = S::Blocks; - type Commit = S::Commit; + type Blobs = S::Blobs; + type Commit = Set<members::commit>; + type Rev = S::Rev; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { type Seq = S::Seq; - type Time = Set<members::time>; type TooBig = S::TooBig; - type Ops = S::Ops; - } - ///State transition - sets the `too_big` field to Set - pub struct SetTooBig<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTooBig<S> {} - impl<S: State> State for SetTooBig<S> { type Rebase = S::Rebase; type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; - type Blocks = S::Blocks; - type Commit = S::Commit; - type Seq = S::Seq; type Time = S::Time; - type TooBig = Set<members::too_big>; type Ops = S::Ops; - } - ///State transition - sets the `ops` field to Set - pub struct SetOps<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetOps<S> {} - impl<S: State> State for SetOps<S> { - type Rebase = S::Rebase; - type Repo = S::Repo; - type Rev = S::Rev; - type Blobs = S::Blobs; type Blocks = S::Blocks; + type Blobs = S::Blobs; type Commit = S::Commit; - type Seq = S::Seq; - type Time = S::Time; - type TooBig = S::TooBig; - type Ops = Set<members::ops>; + type Rev = Set<members::rev>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `seq` field + pub struct seq(()); + ///Marker type for the `too_big` field + pub struct too_big(()); ///Marker type for the `rebase` field pub struct rebase(()); ///Marker type for the `repo` field pub struct repo(()); - ///Marker type for the `rev` field - pub struct rev(()); - ///Marker type for the `blobs` field - pub struct blobs(()); - ///Marker type for the `blocks` field - pub struct blocks(()); - ///Marker type for the `commit` field - pub struct commit(()); - ///Marker type for the `seq` field - pub struct seq(()); ///Marker type for the `time` field pub struct time(()); - ///Marker type for the `too_big` field - pub struct too_big(()); ///Marker type for the `ops` field pub struct ops(()); + ///Marker type for the `blocks` field + pub struct blocks(()); + ///Marker type for the `blobs` field + pub struct blobs(()); + ///Marker type for the `commit` field + pub struct commit(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -1559,16 +1559,16 @@ where impl<'a, S> CommitBuilder<'a, S> where S: commit_state::State, + S::Seq: commit_state::IsSet, + S::TooBig: commit_state::IsSet, S::Rebase: commit_state::IsSet, S::Repo: commit_state::IsSet, - S::Rev: commit_state::IsSet, - S::Blobs: commit_state::IsSet, - S::Blocks: commit_state::IsSet, - S::Commit: commit_state::IsSet, - S::Seq: commit_state::IsSet, S::Time: commit_state::IsSet, - S::TooBig: commit_state::IsSet, S::Ops: commit_state::IsSet, + S::Blocks: commit_state::IsSet, + S::Blobs: commit_state::IsSet, + S::Commit: commit_state::IsSet, + S::Rev: commit_state::IsSet, { /// Build the final struct pub fn build(self) -> Commit<'a> { @@ -1677,51 +1677,51 @@ pub mod identity_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Seq; - type Did; type Time; + type Did; + type Seq; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Seq = Unset; - type Did = Unset; type Time = Unset; + type Did = Unset; + type Seq = Unset; } - ///State transition - sets the `seq` field to Set - pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSeq<S> {} - impl<S: State> State for SetSeq<S> { - type Seq = Set<members::seq>; + ///State transition - sets the `time` field to Set + pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTime<S> {} + impl<S: State> State for SetTime<S> { + type Time = Set<members::time>; type Did = S::Did; - type Time = S::Time; + type Seq = S::Seq; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Seq = S::Seq; - type Did = Set<members::did>; type Time = S::Time; - } - ///State transition - sets the `time` field to Set - pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTime<S> {} - impl<S: State> State for SetTime<S> { + type Did = Set<members::did>; type Seq = S::Seq; + } + ///State transition - sets the `seq` field to Set + pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSeq<S> {} + impl<S: State> State for SetSeq<S> { + type Time = S::Time; type Did = S::Did; - type Time = Set<members::time>; + type Seq = Set<members::seq>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `seq` field - pub struct seq(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `time` field pub struct time(()); + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `seq` field + pub struct seq(()); } } @@ -1834,9 +1834,9 @@ where impl<'a, S> IdentityBuilder<'a, S> where S: identity_state::State, - S::Seq: identity_state::IsSet, - S::Did: identity_state::IsSet, S::Time: identity_state::IsSet, + S::Did: identity_state::IsSet, + S::Seq: identity_state::IsSet, { /// Build the final struct pub fn build(self) -> Identity<'a> { @@ -2580,84 +2580,84 @@ pub mod sync_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Seq; - type Rev; - type Blocks; - type Time; type Did; + type Time; + type Blocks; + type Rev; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Seq = Unset; - type Rev = Unset; - type Blocks = Unset; - type Time = Unset; type Did = Unset; + type Time = Unset; + type Blocks = Unset; + type Rev = Unset; } ///State transition - sets the `seq` field to Set pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSeq<S> {} impl<S: State> State for SetSeq<S> { type Seq = Set<members::seq>; - type Rev = S::Rev; - type Blocks = S::Blocks; - type Time = S::Time; type Did = S::Did; - } - ///State transition - sets the `rev` field to Set - pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev<S> {} - impl<S: State> State for SetRev<S> { - type Seq = S::Seq; - type Rev = Set<members::rev>; - type Blocks = S::Blocks; type Time = S::Time; - type Did = S::Did; + type Blocks = S::Blocks; + type Rev = S::Rev; } - ///State transition - sets the `blocks` field to Set - pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlocks<S> {} - impl<S: State> State for SetBlocks<S> { + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { type Seq = S::Seq; - type Rev = S::Rev; - type Blocks = Set<members::blocks>; + type Did = Set<members::did>; type Time = S::Time; - type Did = S::Did; + type Blocks = S::Blocks; + type Rev = S::Rev; } ///State transition - sets the `time` field to Set pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTime<S> {} impl<S: State> State for SetTime<S> { type Seq = S::Seq; - type Rev = S::Rev; - type Blocks = S::Blocks; - type Time = Set<members::time>; type Did = S::Did; + type Time = Set<members::time>; + type Blocks = S::Blocks; + type Rev = S::Rev; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { + ///State transition - sets the `blocks` field to Set + pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlocks<S> {} + impl<S: State> State for SetBlocks<S> { type Seq = S::Seq; + type Did = S::Did; + type Time = S::Time; + type Blocks = Set<members::blocks>; type Rev = S::Rev; - type Blocks = S::Blocks; + } + ///State transition - sets the `rev` field to Set + pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev<S> {} + impl<S: State> State for SetRev<S> { + type Seq = S::Seq; + type Did = S::Did; type Time = S::Time; - type Did = Set<members::did>; + type Blocks = S::Blocks; + type Rev = Set<members::rev>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `seq` field pub struct seq(()); - ///Marker type for the `rev` field - pub struct rev(()); - ///Marker type for the `blocks` field - pub struct blocks(()); - ///Marker type for the `time` field - pub struct time(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `time` field + pub struct time(()); + ///Marker type for the `blocks` field + pub struct blocks(()); + ///Marker type for the `rev` field + pub struct rev(()); } } @@ -2791,10 +2791,10 @@ impl<'a, S> SyncBuilder<'a, S> where S: sync_state::State, S::Seq: sync_state::IsSet, - S::Rev: sync_state::IsSet, - S::Blocks: sync_state::IsSet, - S::Time: sync_state::IsSet, S::Did: sync_state::IsSet, + S::Time: sync_state::IsSet, + S::Blocks: sync_state::IsSet, + S::Rev: sync_state::IsSet, { /// Build the final struct pub fn build(self) -> Sync<'a> { diff --git a/crates/jacquard-api/src/com_atprotofans/validate_supporter.rs b/crates/jacquard-api/src/com_atprotofans/validate_supporter.rs index fb110c73..341b8289 100644 --- a/crates/jacquard-api/src/com_atprotofans/validate_supporter.rs +++ b/crates/jacquard-api/src/com_atprotofans/validate_supporter.rs @@ -34,49 +34,49 @@ pub mod validate_supporter_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Signer; type Supporter; + type Signer; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Signer = Unset; type Supporter = Unset; + type Signer = Unset; type Subject = Unset; } - ///State transition - sets the `signer` field to Set - pub struct SetSigner<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSigner<S> {} - impl<S: State> State for SetSigner<S> { - type Signer = Set<members::signer>; - type Supporter = S::Supporter; - type Subject = S::Subject; - } ///State transition - sets the `supporter` field to Set pub struct SetSupporter<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSupporter<S> {} impl<S: State> State for SetSupporter<S> { - type Signer = S::Signer; type Supporter = Set<members::supporter>; + type Signer = S::Signer; + type Subject = S::Subject; + } + ///State transition - sets the `signer` field to Set + pub struct SetSigner<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSigner<S> {} + impl<S: State> State for SetSigner<S> { + type Supporter = S::Supporter; + type Signer = Set<members::signer>; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type Signer = S::Signer; type Supporter = S::Supporter; + type Signer = S::Signer; type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `signer` field - pub struct signer(()); ///Marker type for the `supporter` field pub struct supporter(()); + ///Marker type for the `signer` field + pub struct signer(()); ///Marker type for the `subject` field pub struct subject(()); } @@ -171,8 +171,8 @@ where impl<'a, S> ValidateSupporterBuilder<'a, S> where S: validate_supporter_state::State, - S::Signer: validate_supporter_state::IsSet, S::Supporter: validate_supporter_state::IsSet, + S::Signer: validate_supporter_state::IsSet, S::Subject: validate_supporter_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/com_crabdance/nandi/post.rs b/crates/jacquard-api/src/com_crabdance/nandi/post.rs index 967a9d69..bfb7ce56 100644 --- a/crates/jacquard-api/src/com_crabdance/nandi/post.rs +++ b/crates/jacquard-api/src/com_crabdance/nandi/post.rs @@ -49,51 +49,51 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Title; type Content; + type Title; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Title = Unset; type Content = Unset; + type Title = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Content = Set<members::content>; type Title = S::Title; - type Content = S::Content; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type CreatedAt = S::CreatedAt; - type Title = Set<members::title>; type Content = S::Content; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { + type Title = Set<members::title>; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Content = S::Content; type Title = S::Title; - type Content = Set<members::content>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `content` field pub struct content(()); + ///Marker type for the `title` field + pub struct title(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -257,9 +257,9 @@ impl<'a, S: post_state::State> PostBuilder<'a, S> { impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::CreatedAt: post_state::IsSet, - S::Title: post_state::IsSet, S::Content: post_state::IsSet, + S::Title: post_state::IsSet, + S::CreatedAt: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/com_shinolabs/pinksea/app_view_defs.rs b/crates/jacquard-api/src/com_shinolabs/pinksea/app_view_defs.rs index a6429fc6..c3c88e85 100644 --- a/crates/jacquard-api/src/com_shinolabs/pinksea/app_view_defs.rs +++ b/crates/jacquard-api/src/com_shinolabs/pinksea/app_view_defs.rs @@ -516,10 +516,10 @@ pub mod hydrated_oekaki_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; - type Nsfw; type Author; type At; + type Cid; + type Nsfw; type Image; type CreationTime; } @@ -527,43 +527,21 @@ pub mod hydrated_oekaki_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; - type Nsfw = Unset; type Author = Unset; type At = Unset; + type Cid = Unset; + type Nsfw = Unset; type Image = Unset; type CreationTime = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type Nsfw = S::Nsfw; - type Author = S::Author; - type At = S::At; - type Image = S::Image; - type CreationTime = S::CreationTime; - } - ///State transition - sets the `nsfw` field to Set - pub struct SetNsfw<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNsfw<S> {} - impl<S: State> State for SetNsfw<S> { - type Cid = S::Cid; - type Nsfw = Set<members::nsfw>; - type Author = S::Author; - type At = S::At; - type Image = S::Image; - type CreationTime = S::CreationTime; - } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Cid = S::Cid; - type Nsfw = S::Nsfw; type Author = Set<members::author>; type At = S::At; + type Cid = S::Cid; + type Nsfw = S::Nsfw; type Image = S::Image; type CreationTime = S::CreationTime; } @@ -571,10 +549,32 @@ pub mod hydrated_oekaki_state { pub struct SetAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAt<S> {} impl<S: State> State for SetAt<S> { + type Author = S::Author; + type At = Set<members::at>; type Cid = S::Cid; type Nsfw = S::Nsfw; + type Image = S::Image; + type CreationTime = S::CreationTime; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Author = S::Author; + type At = S::At; + type Cid = Set<members::cid>; + type Nsfw = S::Nsfw; + type Image = S::Image; + type CreationTime = S::CreationTime; + } + ///State transition - sets the `nsfw` field to Set + pub struct SetNsfw<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNsfw<S> {} + impl<S: State> State for SetNsfw<S> { type Author = S::Author; - type At = Set<members::at>; + type At = S::At; + type Cid = S::Cid; + type Nsfw = Set<members::nsfw>; type Image = S::Image; type CreationTime = S::CreationTime; } @@ -582,10 +582,10 @@ pub mod hydrated_oekaki_state { pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetImage<S> {} impl<S: State> State for SetImage<S> { - type Cid = S::Cid; - type Nsfw = S::Nsfw; type Author = S::Author; type At = S::At; + type Cid = S::Cid; + type Nsfw = S::Nsfw; type Image = Set<members::image>; type CreationTime = S::CreationTime; } @@ -593,24 +593,24 @@ pub mod hydrated_oekaki_state { pub struct SetCreationTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreationTime<S> {} impl<S: State> State for SetCreationTime<S> { - type Cid = S::Cid; - type Nsfw = S::Nsfw; type Author = S::Author; type At = S::At; + type Cid = S::Cid; + type Nsfw = S::Nsfw; type Image = S::Image; type CreationTime = Set<members::creation_time>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `nsfw` field - pub struct nsfw(()); ///Marker type for the `author` field pub struct author(()); ///Marker type for the `at` field pub struct at(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `nsfw` field + pub struct nsfw(()); ///Marker type for the `image` field pub struct image(()); ///Marker type for the `creation_time` field @@ -801,10 +801,10 @@ impl<'a, S: hydrated_oekaki_state::State> HydratedOekakiBuilder<'a, S> { impl<'a, S> HydratedOekakiBuilder<'a, S> where S: hydrated_oekaki_state::State, - S::Cid: hydrated_oekaki_state::IsSet, - S::Nsfw: hydrated_oekaki_state::IsSet, S::Author: hydrated_oekaki_state::IsSet, S::At: hydrated_oekaki_state::IsSet, + S::Cid: hydrated_oekaki_state::IsSet, + S::Nsfw: hydrated_oekaki_state::IsSet, S::Image: hydrated_oekaki_state::IsSet, S::CreationTime: hydrated_oekaki_state::IsSet, { diff --git a/crates/jacquard-api/src/com_shinolabs/pinksea/get_oekaki.rs b/crates/jacquard-api/src/com_shinolabs/pinksea/get_oekaki.rs index d2667b0c..2a1bcbe4 100644 --- a/crates/jacquard-api/src/com_shinolabs/pinksea/get_oekaki.rs +++ b/crates/jacquard-api/src/com_shinolabs/pinksea/get_oekaki.rs @@ -32,37 +32,37 @@ pub mod get_oekaki_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Did; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Did = Unset; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Rkey = Set<members::rkey>; - type Did = S::Did; + type Rkey = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Rkey = S::Rkey; type Did = Set<members::did>; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Did = S::Did; + type Rkey = Set<members::rkey>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetOekakiBuilder<'a, S> where S: get_oekaki_state::State, - S::Rkey: get_oekaki_state::IsSet, S::Did: get_oekaki_state::IsSet, + S::Rkey: get_oekaki_state::IsSet, { /// Build the final struct pub fn build(self) -> GetOekaki<'a> { diff --git a/crates/jacquard-api/src/com_shinolabs/pinksea/get_parent_for_reply.rs b/crates/jacquard-api/src/com_shinolabs/pinksea/get_parent_for_reply.rs index 68e5e6d8..7f1fa0be 100644 --- a/crates/jacquard-api/src/com_shinolabs/pinksea/get_parent_for_reply.rs +++ b/crates/jacquard-api/src/com_shinolabs/pinksea/get_parent_for_reply.rs @@ -32,37 +32,37 @@ pub mod get_parent_for_reply_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Did; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Did = Unset; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Rkey = Set<members::rkey>; - type Did = S::Did; + type Rkey = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Rkey = S::Rkey; type Did = Set<members::did>; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Did = S::Did; + type Rkey = Set<members::rkey>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetParentForReplyBuilder<'a, S> where S: get_parent_for_reply_state::State, - S::Rkey: get_parent_for_reply_state::IsSet, S::Did: get_parent_for_reply_state::IsSet, + S::Rkey: get_parent_for_reply_state::IsSet, { /// Build the final struct pub fn build(self) -> GetParentForReply<'a> { diff --git a/crates/jacquard-api/src/com_shinolabs/pinksea/profile.rs b/crates/jacquard-api/src/com_shinolabs/pinksea/profile.rs index f9852314..5fc96fb0 100644 --- a/crates/jacquard-api/src/com_shinolabs/pinksea/profile.rs +++ b/crates/jacquard-api/src/com_shinolabs/pinksea/profile.rs @@ -529,37 +529,37 @@ pub mod profile_link_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Link; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Link = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Link = S::Link; + type Name = Unset; } ///State transition - sets the `link` field to Set pub struct SetLink<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLink<S> {} impl<S: State> State for SetLink<S> { - type Name = S::Name; type Link = Set<members::link>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Link = S::Link; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `link` field pub struct link(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -632,8 +632,8 @@ where impl<'a, S> ProfileLinkBuilder<'a, S> where S: profile_link_state::State, - S::Name: profile_link_state::IsSet, S::Link: profile_link_state::IsSet, + S::Name: profile_link_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileLink<'a> { diff --git a/crates/jacquard-api/src/com_yuna0x0/guestbook/sign.rs b/crates/jacquard-api/src/com_yuna0x0/guestbook/sign.rs index be0e9c7a..92e2e638 100644 --- a/crates/jacquard-api/src/com_yuna0x0/guestbook/sign.rs +++ b/crates/jacquard-api/src/com_yuna0x0/guestbook/sign.rs @@ -35,49 +35,49 @@ pub mod sign_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Message; + type CreatedAt; type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Message = Unset; + type CreatedAt = Unset; type Subject = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Message = S::Message; - type Subject = S::Subject; - } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type CreatedAt = S::CreatedAt; type Message = Set<members::message>; + type CreatedAt = S::CreatedAt; + type Subject = S::Subject; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Message = S::Message; + type CreatedAt = Set<members::created_at>; type Subject = S::Subject; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Message = S::Message; + type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `message` field pub struct message(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); } @@ -172,8 +172,8 @@ where impl<'a, S> SignBuilder<'a, S> where S: sign_state::State, - S::CreatedAt: sign_state::IsSet, S::Message: sign_state::IsSet, + S::CreatedAt: sign_state::IsSet, S::Subject: sign_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/community_lexicon/bookmarks/bookmark.rs b/crates/jacquard-api/src/community_lexicon/bookmarks/bookmark.rs index 4260f495..3d0ad2d9 100644 --- a/crates/jacquard-api/src/community_lexicon/bookmarks/bookmark.rs +++ b/crates/jacquard-api/src/community_lexicon/bookmarks/bookmark.rs @@ -37,37 +37,37 @@ pub mod bookmark_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -160,8 +160,8 @@ impl<'a, S: bookmark_state::State> BookmarkBuilder<'a, S> { impl<'a, S> BookmarkBuilder<'a, S> where S: bookmark_state::State, - S::CreatedAt: bookmark_state::IsSet, S::Subject: bookmark_state::IsSet, + S::CreatedAt: bookmark_state::IsSet, { /// Build the final struct pub fn build(self) -> Bookmark<'a> { diff --git a/crates/jacquard-api/src/community_lexicon/calendar.rs b/crates/jacquard-api/src/community_lexicon/calendar.rs index 4c1704e0..94f66451 100644 --- a/crates/jacquard-api/src/community_lexicon/calendar.rs +++ b/crates/jacquard-api/src/community_lexicon/calendar.rs @@ -4,4 +4,6 @@ // Any manual changes will be overwritten on the next regeneration. pub mod event; -pub mod rsvp; \ No newline at end of file +pub mod get_event; +pub mod rsvp; +pub mod search_events; \ No newline at end of file diff --git a/crates/jacquard-api/src/community_lexicon/calendar/event.rs b/crates/jacquard-api/src/community_lexicon/calendar/event.rs index d162985b..cf859cf4 100644 --- a/crates/jacquard-api/src/community_lexicon/calendar/event.rs +++ b/crates/jacquard-api/src/community_lexicon/calendar/event.rs @@ -119,37 +119,37 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Name; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Name = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Name = S::Name; + type CreatedAt = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Name = S::Name; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -372,8 +372,8 @@ impl<'a, S: event_state::State> EventBuilder<'a, S> { impl<'a, S> EventBuilder<'a, S> where S: event_state::State, - S::CreatedAt: event_state::IsSet, S::Name: event_state::IsSet, + S::CreatedAt: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { diff --git a/crates/jacquard-api/src/community_lexicon/calendar/get_event.rs b/crates/jacquard-api/src/community_lexicon/calendar/get_event.rs new file mode 100644 index 00000000..f00a8794 --- /dev/null +++ b/crates/jacquard-api/src/community_lexicon/calendar/get_event.rs @@ -0,0 +1,649 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: community.lexicon.calendar.getEvent +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An event record with RSVP counts and URL. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct EventView<'a> { + /// Number of users who have RSVP'd as going. + pub count_going: i64, + /// Number of users who have RSVP'd as interested. + pub count_interested: i64, + /// Number of users who have RSVP'd as not going. + pub count_not_going: i64, + /// The canonical URL for this event on Smoke Signal. + #[serde(borrow)] + pub url: jacquard_common::types::string::Uri<'a>, +} + +pub mod event_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Url; + type CountNotGoing; + type CountInterested; + type CountGoing; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Url = Unset; + type CountNotGoing = Unset; + type CountInterested = Unset; + type CountGoing = Unset; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Url = Set<members::url>; + type CountNotGoing = S::CountNotGoing; + type CountInterested = S::CountInterested; + type CountGoing = S::CountGoing; + } + ///State transition - sets the `count_not_going` field to Set + pub struct SetCountNotGoing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountNotGoing<S> {} + impl<S: State> State for SetCountNotGoing<S> { + type Url = S::Url; + type CountNotGoing = Set<members::count_not_going>; + type CountInterested = S::CountInterested; + type CountGoing = S::CountGoing; + } + ///State transition - sets the `count_interested` field to Set + pub struct SetCountInterested<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountInterested<S> {} + impl<S: State> State for SetCountInterested<S> { + type Url = S::Url; + type CountNotGoing = S::CountNotGoing; + type CountInterested = Set<members::count_interested>; + type CountGoing = S::CountGoing; + } + ///State transition - sets the `count_going` field to Set + pub struct SetCountGoing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountGoing<S> {} + impl<S: State> State for SetCountGoing<S> { + type Url = S::Url; + type CountNotGoing = S::CountNotGoing; + type CountInterested = S::CountInterested; + type CountGoing = Set<members::count_going>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `url` field + pub struct url(()); + ///Marker type for the `count_not_going` field + pub struct count_not_going(()); + ///Marker type for the `count_interested` field + pub struct count_interested(()); + ///Marker type for the `count_going` field + pub struct count_going(()); + } +} + +/// Builder for constructing an instance of this type +pub struct EventViewBuilder<'a, S: event_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> EventView<'a> { + /// Create a new builder for this type + pub fn new() -> EventViewBuilder<'a, event_view_state::Empty> { + EventViewBuilder::new() + } +} + +impl<'a> EventViewBuilder<'a, event_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountGoing: event_view_state::IsUnset, +{ + /// Set the `countGoing` field (required) + pub fn count_going( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountGoing<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountInterested: event_view_state::IsUnset, +{ + /// Set the `countInterested` field (required) + pub fn count_interested( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountInterested<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountNotGoing: event_view_state::IsUnset, +{ + /// Set the `countNotGoing` field (required) + pub fn count_not_going( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountNotGoing<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::Url: event_view_state::IsUnset, +{ + /// Set the `url` field (required) + pub fn url( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> EventViewBuilder<'a, event_view_state::SetUrl<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::Url: event_view_state::IsSet, + S::CountNotGoing: event_view_state::IsSet, + S::CountInterested: event_view_state::IsSet, + S::CountGoing: event_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> EventView<'a> { + EventView { + count_going: self.__unsafe_private_named.0.unwrap(), + count_interested: self.__unsafe_private_named.1.unwrap(), + count_not_going: self.__unsafe_private_named.2.unwrap(), + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> EventView<'a> { + EventView { + count_going: self.__unsafe_private_named.0.unwrap(), + count_interested: self.__unsafe_private_named.1.unwrap(), + count_not_going: self.__unsafe_private_named.2.unwrap(), + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_community_lexicon_calendar_getEvent() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("community.lexicon.calendar.getEvent"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("eventView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "An event record with RSVP counts and URL.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("countGoing"), + ::jacquard_common::smol_str::SmolStr::new_static("countInterested"), + ::jacquard_common::smol_str::SmolStr::new_static("countNotGoing"), + ::jacquard_common::smol_str::SmolStr::new_static("url") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countGoing", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countInterested", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countNotGoing", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The canonical URL for this event on Smoke Signal.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { + description: None, + parameters: Some( + ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("repository"), + ::jacquard_common::smol_str::SmolStr::new_static("recordKey") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "recordKey", + ), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The record key (rkey) of the event.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(150usize), + min_graphemes: None, + max_graphemes: Some(150usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "repository", + ), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The DID of the repository containing the event.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ), + output: None, + errors: None, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EventView<'a> { + fn nsid() -> &'static str { + "community.lexicon.calendar.getEvent" + } + fn def_name() -> &'static str { + "eventView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_community_lexicon_calendar_getEvent() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetEvent<'a> { + #[serde(borrow)] + pub record_key: jacquard_common::CowStr<'a>, + #[serde(borrow)] + pub repository: jacquard_common::types::string::Did<'a>, +} + +pub mod get_event_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Repository; + type RecordKey; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Repository = Unset; + type RecordKey = Unset; + } + ///State transition - sets the `repository` field to Set + pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepository<S> {} + impl<S: State> State for SetRepository<S> { + type Repository = Set<members::repository>; + type RecordKey = S::RecordKey; + } + ///State transition - sets the `record_key` field to Set + pub struct SetRecordKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecordKey<S> {} + impl<S: State> State for SetRecordKey<S> { + type Repository = S::Repository; + type RecordKey = Set<members::record_key>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `repository` field + pub struct repository(()); + ///Marker type for the `record_key` field + pub struct record_key(()); + } +} + +/// Builder for constructing an instance of this type +pub struct GetEventBuilder<'a, S: get_event_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> GetEvent<'a> { + /// Create a new builder for this type + pub fn new() -> GetEventBuilder<'a, get_event_state::Empty> { + GetEventBuilder::new() + } +} + +impl<'a> GetEventBuilder<'a, get_event_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GetEventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GetEventBuilder<'a, S> +where + S: get_event_state::State, + S::RecordKey: get_event_state::IsUnset, +{ + /// Set the `recordKey` field (required) + pub fn record_key( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> GetEventBuilder<'a, get_event_state::SetRecordKey<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + GetEventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GetEventBuilder<'a, S> +where + S: get_event_state::State, + S::Repository: get_event_state::IsUnset, +{ + /// Set the `repository` field (required) + pub fn repository( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> GetEventBuilder<'a, get_event_state::SetRepository<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + GetEventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GetEventBuilder<'a, S> +where + S: get_event_state::State, + S::Repository: get_event_state::IsSet, + S::RecordKey: get_event_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> GetEvent<'a> { + GetEvent { + record_key: self.__unsafe_private_named.0.unwrap(), + repository: self.__unsafe_private_named.1.unwrap(), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetEventOutput<'a> { + #[serde(flatten)] + #[serde(borrow)] + pub value: jacquard_common::types::value::Data<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum GetEventError<'a> { + #[serde(rename = "NotFound")] + NotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for GetEventError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::NotFound(msg) => { + write!(f, "NotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///community.lexicon.calendar.getEvent +pub struct GetEventResponse; +impl jacquard_common::xrpc::XrpcResp for GetEventResponse { + const NSID: &'static str = "community.lexicon.calendar.getEvent"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = GetEventOutput<'de>; + type Err<'de> = GetEventError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for GetEvent<'a> { + const NSID: &'static str = "community.lexicon.calendar.getEvent"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Response = GetEventResponse; +} + +/// Endpoint type for +///community.lexicon.calendar.getEvent +pub struct GetEventRequest; +impl jacquard_common::xrpc::XrpcEndpoint for GetEventRequest { + const PATH: &'static str = "/xrpc/community.lexicon.calendar.getEvent"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Request<'de> = GetEvent<'de>; + type Response = GetEventResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/community_lexicon/calendar/search_events.rs b/crates/jacquard-api/src/community_lexicon/calendar/search_events.rs new file mode 100644 index 00000000..355c04e6 --- /dev/null +++ b/crates/jacquard-api/src/community_lexicon/calendar/search_events.rs @@ -0,0 +1,711 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: community.lexicon.calendar.searchEvents +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An event record with RSVP counts and URL. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct EventView<'a> { + /// Number of users who have RSVP'd as going. + pub count_going: i64, + /// Number of users who have RSVP'd as interested. + pub count_interested: i64, + /// Number of users who have RSVP'd as not going. + pub count_not_going: i64, + /// The canonical web URL for this event. + #[serde(borrow)] + pub url: jacquard_common::types::string::Uri<'a>, +} + +pub mod event_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CountGoing; + type CountInterested; + type CountNotGoing; + type Url; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CountGoing = Unset; + type CountInterested = Unset; + type CountNotGoing = Unset; + type Url = Unset; + } + ///State transition - sets the `count_going` field to Set + pub struct SetCountGoing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountGoing<S> {} + impl<S: State> State for SetCountGoing<S> { + type CountGoing = Set<members::count_going>; + type CountInterested = S::CountInterested; + type CountNotGoing = S::CountNotGoing; + type Url = S::Url; + } + ///State transition - sets the `count_interested` field to Set + pub struct SetCountInterested<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountInterested<S> {} + impl<S: State> State for SetCountInterested<S> { + type CountGoing = S::CountGoing; + type CountInterested = Set<members::count_interested>; + type CountNotGoing = S::CountNotGoing; + type Url = S::Url; + } + ///State transition - sets the `count_not_going` field to Set + pub struct SetCountNotGoing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCountNotGoing<S> {} + impl<S: State> State for SetCountNotGoing<S> { + type CountGoing = S::CountGoing; + type CountInterested = S::CountInterested; + type CountNotGoing = Set<members::count_not_going>; + type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type CountGoing = S::CountGoing; + type CountInterested = S::CountInterested; + type CountNotGoing = S::CountNotGoing; + type Url = Set<members::url>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `count_going` field + pub struct count_going(()); + ///Marker type for the `count_interested` field + pub struct count_interested(()); + ///Marker type for the `count_not_going` field + pub struct count_not_going(()); + ///Marker type for the `url` field + pub struct url(()); + } +} + +/// Builder for constructing an instance of this type +pub struct EventViewBuilder<'a, S: event_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> EventView<'a> { + /// Create a new builder for this type + pub fn new() -> EventViewBuilder<'a, event_view_state::Empty> { + EventViewBuilder::new() + } +} + +impl<'a> EventViewBuilder<'a, event_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountGoing: event_view_state::IsUnset, +{ + /// Set the `countGoing` field (required) + pub fn count_going( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountGoing<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountInterested: event_view_state::IsUnset, +{ + /// Set the `countInterested` field (required) + pub fn count_interested( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountInterested<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountNotGoing: event_view_state::IsUnset, +{ + /// Set the `countNotGoing` field (required) + pub fn count_not_going( + mut self, + value: impl Into<i64>, + ) -> EventViewBuilder<'a, event_view_state::SetCountNotGoing<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::Url: event_view_state::IsUnset, +{ + /// Set the `url` field (required) + pub fn url( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> EventViewBuilder<'a, event_view_state::SetUrl<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + EventViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventViewBuilder<'a, S> +where + S: event_view_state::State, + S::CountGoing: event_view_state::IsSet, + S::CountInterested: event_view_state::IsSet, + S::CountNotGoing: event_view_state::IsSet, + S::Url: event_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> EventView<'a> { + EventView { + count_going: self.__unsafe_private_named.0.unwrap(), + count_interested: self.__unsafe_private_named.1.unwrap(), + count_not_going: self.__unsafe_private_named.2.unwrap(), + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> EventView<'a> { + EventView { + count_going: self.__unsafe_private_named.0.unwrap(), + count_interested: self.__unsafe_private_named.1.unwrap(), + count_not_going: self.__unsafe_private_named.2.unwrap(), + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_community_lexicon_calendar_searchEvents() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "community.lexicon.calendar.searchEvents", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("eventView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "An event record with RSVP counts and URL.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("countGoing"), + ::jacquard_common::smol_str::SmolStr::new_static("countInterested"), + ::jacquard_common::smol_str::SmolStr::new_static("countNotGoing"), + ::jacquard_common::smol_str::SmolStr::new_static("url") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countGoing", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countInterested", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "countNotGoing", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The canonical web URL for this event.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { + description: None, + parameters: Some( + ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { + description: None, + required: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("limit"), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "location", + ), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Array(::jacquard_lexicon::lexicon::LexPrimitiveArray { + description: None, + items: ::jacquard_lexicon::lexicon::LexPrimitiveArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("query"), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Full-text search query.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(150usize), + min_graphemes: None, + max_graphemes: Some(150usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "repository", + ), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Filter events by DID.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ), + output: None, + errors: None, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for EventView<'a> { + fn nsid() -> &'static str { + "community.lexicon.calendar.searchEvents" + } + fn def_name() -> &'static str { + "eventView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_community_lexicon_calendar_searchEvents() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct SearchEvents<'a> { + ///(default: 10, min: 1, max: 100) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub limit: std::option::Option<i64>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub location: std::option::Option<Vec<jacquard_common::types::string::Cid<'a>>>, + ///(max length: 150) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub query: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub repository: std::option::Option<jacquard_common::types::string::Did<'a>>, +} + +pub mod search_events_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed {} + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty {} + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members {} +} + +/// Builder for constructing an instance of this type +pub struct SearchEventsBuilder<'a, S: search_events_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<i64>, + ::core::option::Option<Vec<jacquard_common::types::string::Cid<'a>>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> SearchEvents<'a> { + /// Create a new builder for this type + pub fn new() -> SearchEventsBuilder<'a, search_events_state::Empty> { + SearchEventsBuilder::new() + } +} + +impl<'a> SearchEventsBuilder<'a, search_events_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + SearchEventsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: search_events_state::State> SearchEventsBuilder<'a, S> { + /// Set the `limit` field (optional) + pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `limit` field to an Option value (optional) + pub fn maybe_limit(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: search_events_state::State> SearchEventsBuilder<'a, S> { + /// Set the `location` field (optional) + pub fn location( + mut self, + value: impl Into<Option<Vec<jacquard_common::types::string::Cid<'a>>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `location` field to an Option value (optional) + pub fn maybe_location( + mut self, + value: Option<Vec<jacquard_common::types::string::Cid<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: search_events_state::State> SearchEventsBuilder<'a, S> { + /// Set the `query` field (optional) + pub fn query( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `query` field to an Option value (optional) + pub fn maybe_query(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: search_events_state::State> SearchEventsBuilder<'a, S> { + /// Set the `repository` field (optional) + pub fn repository( + mut self, + value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `repository` field to an Option value (optional) + pub fn maybe_repository( + mut self, + value: Option<jacquard_common::types::string::Did<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> SearchEventsBuilder<'a, S> +where + S: search_events_state::State, +{ + /// Build the final struct + pub fn build(self) -> SearchEvents<'a> { + SearchEvents { + limit: self.__unsafe_private_named.0, + location: self.__unsafe_private_named.1, + query: self.__unsafe_private_named.2, + repository: self.__unsafe_private_named.3, + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct SearchEventsOutput<'a> { + #[serde(borrow)] + pub results: Vec<crate::community_lexicon::calendar::search_events::EventView<'a>>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum SearchEventsError<'a> { + #[serde(rename = "InvalidRepository")] + InvalidRepository(std::option::Option<jacquard_common::CowStr<'a>>), + #[serde(rename = "SearchUnavailable")] + SearchUnavailable(std::option::Option<jacquard_common::CowStr<'a>>), + #[serde(rename = "SearchError")] + SearchError(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for SearchEventsError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::InvalidRepository(msg) => { + write!(f, "InvalidRepository")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SearchUnavailable(msg) => { + write!(f, "SearchUnavailable")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SearchError(msg) => { + write!(f, "SearchError")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///community.lexicon.calendar.searchEvents +pub struct SearchEventsResponse; +impl jacquard_common::xrpc::XrpcResp for SearchEventsResponse { + const NSID: &'static str = "community.lexicon.calendar.searchEvents"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = SearchEventsOutput<'de>; + type Err<'de> = SearchEventsError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for SearchEvents<'a> { + const NSID: &'static str = "community.lexicon.calendar.searchEvents"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Response = SearchEventsResponse; +} + +/// Endpoint type for +///community.lexicon.calendar.searchEvents +pub struct SearchEventsRequest; +impl jacquard_common::xrpc::XrpcEndpoint for SearchEventsRequest { + const PATH: &'static str = "/xrpc/community.lexicon.calendar.searchEvents"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Request<'de> = SearchEvents<'de>; + type Response = SearchEventsResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/computer_aesthetic/mood.rs b/crates/jacquard-api/src/computer_aesthetic/mood.rs index 988f4d4f..65786167 100644 --- a/crates/jacquard-api/src/computer_aesthetic/mood.rs +++ b/crates/jacquard-api/src/computer_aesthetic/mood.rs @@ -38,49 +38,49 @@ pub mod mood_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Ref; type Mood; + type Ref; type When; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Ref = Unset; type Mood = Unset; + type Ref = Unset; type When = Unset; } - ///State transition - sets the `ref` field to Set - pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRef<S> {} - impl<S: State> State for SetRef<S> { - type Ref = Set<members::r#ref>; - type Mood = S::Mood; - type When = S::When; - } ///State transition - sets the `mood` field to Set pub struct SetMood<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMood<S> {} impl<S: State> State for SetMood<S> { - type Ref = S::Ref; type Mood = Set<members::mood>; + type Ref = S::Ref; + type When = S::When; + } + ///State transition - sets the `ref` field to Set + pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRef<S> {} + impl<S: State> State for SetRef<S> { + type Mood = S::Mood; + type Ref = Set<members::r#ref>; type When = S::When; } ///State transition - sets the `when` field to Set pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWhen<S> {} impl<S: State> State for SetWhen<S> { - type Ref = S::Ref; type Mood = S::Mood; + type Ref = S::Ref; type When = Set<members::when>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `ref` field - pub struct r#ref(()); ///Marker type for the `mood` field pub struct mood(()); + ///Marker type for the `ref` field + pub struct r#ref(()); ///Marker type for the `when` field pub struct when(()); } @@ -175,8 +175,8 @@ where impl<'a, S> MoodBuilder<'a, S> where S: mood_state::State, - S::Ref: mood_state::IsSet, S::Mood: mood_state::IsSet, + S::Ref: mood_state::IsSet, S::When: mood_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/computer_aesthetic/painting.rs b/crates/jacquard-api/src/computer_aesthetic/painting.rs index feb5665d..385b209e 100644 --- a/crates/jacquard-api/src/computer_aesthetic/painting.rs +++ b/crates/jacquard-api/src/computer_aesthetic/painting.rs @@ -52,85 +52,85 @@ pub mod painting_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Slug; - type When; + type Ref; type Code; + type When; type ImageUrl; - type Ref; + type Slug; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Slug = Unset; - type When = Unset; + type Ref = Unset; type Code = Unset; + type When = Unset; type ImageUrl = Unset; - type Ref = Unset; + type Slug = Unset; } - ///State transition - sets the `slug` field to Set - pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSlug<S> {} - impl<S: State> State for SetSlug<S> { - type Slug = Set<members::slug>; - type When = S::When; + ///State transition - sets the `ref` field to Set + pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRef<S> {} + impl<S: State> State for SetRef<S> { + type Ref = Set<members::r#ref>; type Code = S::Code; + type When = S::When; type ImageUrl = S::ImageUrl; - type Ref = S::Ref; - } - ///State transition - sets the `when` field to Set - pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWhen<S> {} - impl<S: State> State for SetWhen<S> { type Slug = S::Slug; - type When = Set<members::when>; - type Code = S::Code; - type ImageUrl = S::ImageUrl; - type Ref = S::Ref; } ///State transition - sets the `code` field to Set pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCode<S> {} impl<S: State> State for SetCode<S> { - type Slug = S::Slug; - type When = S::When; + type Ref = S::Ref; type Code = Set<members::code>; + type When = S::When; type ImageUrl = S::ImageUrl; + type Slug = S::Slug; + } + ///State transition - sets the `when` field to Set + pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWhen<S> {} + impl<S: State> State for SetWhen<S> { type Ref = S::Ref; + type Code = S::Code; + type When = Set<members::when>; + type ImageUrl = S::ImageUrl; + type Slug = S::Slug; } ///State transition - sets the `image_url` field to Set pub struct SetImageUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetImageUrl<S> {} impl<S: State> State for SetImageUrl<S> { - type Slug = S::Slug; - type When = S::When; + type Ref = S::Ref; type Code = S::Code; + type When = S::When; type ImageUrl = Set<members::image_url>; - type Ref = S::Ref; - } - ///State transition - sets the `ref` field to Set - pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRef<S> {} - impl<S: State> State for SetRef<S> { type Slug = S::Slug; - type When = S::When; + } + ///State transition - sets the `slug` field to Set + pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSlug<S> {} + impl<S: State> State for SetSlug<S> { + type Ref = S::Ref; type Code = S::Code; + type When = S::When; type ImageUrl = S::ImageUrl; - type Ref = Set<members::r#ref>; + type Slug = Set<members::slug>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `slug` field - pub struct slug(()); - ///Marker type for the `when` field - pub struct when(()); + ///Marker type for the `ref` field + pub struct r#ref(()); ///Marker type for the `code` field pub struct code(()); + ///Marker type for the `when` field + pub struct when(()); ///Marker type for the `image_url` field pub struct image_url(()); - ///Marker type for the `ref` field - pub struct r#ref(()); + ///Marker type for the `slug` field + pub struct slug(()); } } @@ -303,11 +303,11 @@ where impl<'a, S> PaintingBuilder<'a, S> where S: painting_state::State, - S::Slug: painting_state::IsSet, - S::When: painting_state::IsSet, + S::Ref: painting_state::IsSet, S::Code: painting_state::IsSet, + S::When: painting_state::IsSet, S::ImageUrl: painting_state::IsSet, - S::Ref: painting_state::IsSet, + S::Slug: painting_state::IsSet, { /// Build the final struct pub fn build(self) -> Painting<'a> { diff --git a/crates/jacquard-api/src/computer_aesthetic/piece.rs b/crates/jacquard-api/src/computer_aesthetic/piece.rs index 06bcea5b..a142acee 100644 --- a/crates/jacquard-api/src/computer_aesthetic/piece.rs +++ b/crates/jacquard-api/src/computer_aesthetic/piece.rs @@ -38,51 +38,51 @@ pub mod piece_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Ref; type Slug; type When; + type Ref; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Ref = Unset; type Slug = Unset; type When = Unset; - } - ///State transition - sets the `ref` field to Set - pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRef<S> {} - impl<S: State> State for SetRef<S> { - type Ref = Set<members::r#ref>; - type Slug = S::Slug; - type When = S::When; + type Ref = Unset; } ///State transition - sets the `slug` field to Set pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSlug<S> {} impl<S: State> State for SetSlug<S> { - type Ref = S::Ref; type Slug = Set<members::slug>; type When = S::When; + type Ref = S::Ref; } ///State transition - sets the `when` field to Set pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWhen<S> {} impl<S: State> State for SetWhen<S> { - type Ref = S::Ref; type Slug = S::Slug; type When = Set<members::when>; + type Ref = S::Ref; + } + ///State transition - sets the `ref` field to Set + pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRef<S> {} + impl<S: State> State for SetRef<S> { + type Slug = S::Slug; + type When = S::When; + type Ref = Set<members::r#ref>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `ref` field - pub struct r#ref(()); ///Marker type for the `slug` field pub struct slug(()); ///Marker type for the `when` field pub struct when(()); + ///Marker type for the `ref` field + pub struct r#ref(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> PieceBuilder<'a, S> where S: piece_state::State, - S::Ref: piece_state::IsSet, S::Slug: piece_state::IsSet, S::When: piece_state::IsSet, + S::Ref: piece_state::IsSet, { /// Build the final struct pub fn build(self) -> Piece<'a> { diff --git a/crates/jacquard-api/src/computer_aesthetic/tape.rs b/crates/jacquard-api/src/computer_aesthetic/tape.rs index 57627c48..a2105e14 100644 --- a/crates/jacquard-api/src/computer_aesthetic/tape.rs +++ b/crates/jacquard-api/src/computer_aesthetic/tape.rs @@ -58,50 +58,50 @@ pub mod tape_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type When; - type Slug; type Code; + type Slug; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type When = Unset; - type Slug = Unset; type Code = Unset; + type Slug = Unset; } ///State transition - sets the `when` field to Set pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWhen<S> {} impl<S: State> State for SetWhen<S> { type When = Set<members::when>; - type Slug = S::Slug; - type Code = S::Code; - } - ///State transition - sets the `slug` field to Set - pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSlug<S> {} - impl<S: State> State for SetSlug<S> { - type When = S::When; - type Slug = Set<members::slug>; type Code = S::Code; + type Slug = S::Slug; } ///State transition - sets the `code` field to Set pub struct SetCode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCode<S> {} impl<S: State> State for SetCode<S> { type When = S::When; - type Slug = S::Slug; type Code = Set<members::code>; + type Slug = S::Slug; + } + ///State transition - sets the `slug` field to Set + pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSlug<S> {} + impl<S: State> State for SetSlug<S> { + type When = S::When; + type Code = S::Code; + type Slug = Set<members::slug>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `when` field pub struct when(()); - ///Marker type for the `slug` field - pub struct slug(()); ///Marker type for the `code` field pub struct code(()); + ///Marker type for the `slug` field + pub struct slug(()); } } @@ -286,8 +286,8 @@ impl<'a, S> TapeBuilder<'a, S> where S: tape_state::State, S::When: tape_state::IsSet, - S::Slug: tape_state::IsSet, S::Code: tape_state::IsSet, + S::Slug: tape_state::IsSet, { /// Build the final struct pub fn build(self) -> Tape<'a> { diff --git a/crates/jacquard-api/src/dev_baileytownsend.rs b/crates/jacquard-api/src/dev_baileytownsend.rs index 3963dcbd..c4631ad9 100644 --- a/crates/jacquard-api/src/dev_baileytownsend.rs +++ b/crates/jacquard-api/src/dev_baileytownsend.rs @@ -3,4 +3,5 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +pub mod demo; pub mod health; \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_baileytownsend/demo.rs b/crates/jacquard-api/src/dev_baileytownsend/demo.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/dev_baileytownsend/demo.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_baileytownsend/demo/example.rs b/crates/jacquard-api/src/dev_baileytownsend/demo/example.rs new file mode 100644 index 00000000..16e16a87 --- /dev/null +++ b/crates/jacquard-api/src/dev_baileytownsend/demo/example.rs @@ -0,0 +1,365 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.baileytownsend.demo.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An example record for showing permissions ets +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// A name of something + #[serde(borrow)] + pub name: jacquard_common::CowStr<'a>, +} + +pub mod example_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Name; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Name = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type CreatedAt = S::CreatedAt; + type Name = Set<members::name>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `name` field + pub struct name(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ExampleBuilder<'a, S: example_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Example<'a> { + /// Create a new builder for this type + pub fn new() -> ExampleBuilder<'a, example_state::Empty> { + ExampleBuilder::new() + } +} + +impl<'a> ExampleBuilder<'a, example_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::CreatedAt: example_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ExampleBuilder<'a, example_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Name: example_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ExampleBuilder<'a, example_state::SetName<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::CreatedAt: example_state::IsSet, + S::Name: example_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Example<'a> { + Example { + created_at: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Example<'a> { + Example { + created_at: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "dev.baileytownsend.demo.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "dev.baileytownsend.demo.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "dev.baileytownsend.demo.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "dev.baileytownsend.demo.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_baileytownsend_demo_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.name; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 640usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 640usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 64usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_dev_baileytownsend_demo_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.baileytownsend.demo.example"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "An example record for showing permissions ets", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("A name of something"), + ), + format: None, + default: None, + min_length: Some(1usize), + max_length: Some(640usize), + min_graphemes: None, + max_graphemes: Some(64usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_baileytownsend/health/rings.rs b/crates/jacquard-api/src/dev_baileytownsend/health/rings.rs index 18e2cbb7..d430c62c 100644 --- a/crates/jacquard-api/src/dev_baileytownsend/health/rings.rs +++ b/crates/jacquard-api/src/dev_baileytownsend/health/rings.rs @@ -44,9 +44,9 @@ pub mod rings_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type MoveGoal; - type CreatedAt; type StandGoal; type StandHours; + type CreatedAt; type Move; type Exercise; type ExerciseGoal; @@ -56,9 +56,9 @@ pub mod rings_state { impl sealed::Sealed for Empty {} impl State for Empty { type MoveGoal = Unset; - type CreatedAt = Unset; type StandGoal = Unset; type StandHours = Unset; + type CreatedAt = Unset; type Move = Unset; type Exercise = Unset; type ExerciseGoal = Unset; @@ -68,21 +68,9 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetMoveGoal<S> {} impl<S: State> State for SetMoveGoal<S> { type MoveGoal = Set<members::move_goal>; - type CreatedAt = S::CreatedAt; - type StandGoal = S::StandGoal; - type StandHours = S::StandHours; - type Move = S::Move; - type Exercise = S::Exercise; - type ExerciseGoal = S::ExerciseGoal; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type MoveGoal = S::MoveGoal; - type CreatedAt = Set<members::created_at>; type StandGoal = S::StandGoal; type StandHours = S::StandHours; + type CreatedAt = S::CreatedAt; type Move = S::Move; type Exercise = S::Exercise; type ExerciseGoal = S::ExerciseGoal; @@ -92,9 +80,9 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetStandGoal<S> {} impl<S: State> State for SetStandGoal<S> { type MoveGoal = S::MoveGoal; - type CreatedAt = S::CreatedAt; type StandGoal = Set<members::stand_goal>; type StandHours = S::StandHours; + type CreatedAt = S::CreatedAt; type Move = S::Move; type Exercise = S::Exercise; type ExerciseGoal = S::ExerciseGoal; @@ -104,9 +92,21 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetStandHours<S> {} impl<S: State> State for SetStandHours<S> { type MoveGoal = S::MoveGoal; - type CreatedAt = S::CreatedAt; type StandGoal = S::StandGoal; type StandHours = Set<members::stand_hours>; + type CreatedAt = S::CreatedAt; + type Move = S::Move; + type Exercise = S::Exercise; + type ExerciseGoal = S::ExerciseGoal; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type MoveGoal = S::MoveGoal; + type StandGoal = S::StandGoal; + type StandHours = S::StandHours; + type CreatedAt = Set<members::created_at>; type Move = S::Move; type Exercise = S::Exercise; type ExerciseGoal = S::ExerciseGoal; @@ -116,9 +116,9 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetMove<S> {} impl<S: State> State for SetMove<S> { type MoveGoal = S::MoveGoal; - type CreatedAt = S::CreatedAt; type StandGoal = S::StandGoal; type StandHours = S::StandHours; + type CreatedAt = S::CreatedAt; type Move = Set<members::r#move>; type Exercise = S::Exercise; type ExerciseGoal = S::ExerciseGoal; @@ -128,9 +128,9 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetExercise<S> {} impl<S: State> State for SetExercise<S> { type MoveGoal = S::MoveGoal; - type CreatedAt = S::CreatedAt; type StandGoal = S::StandGoal; type StandHours = S::StandHours; + type CreatedAt = S::CreatedAt; type Move = S::Move; type Exercise = Set<members::exercise>; type ExerciseGoal = S::ExerciseGoal; @@ -140,9 +140,9 @@ pub mod rings_state { impl<S: State> sealed::Sealed for SetExerciseGoal<S> {} impl<S: State> State for SetExerciseGoal<S> { type MoveGoal = S::MoveGoal; - type CreatedAt = S::CreatedAt; type StandGoal = S::StandGoal; type StandHours = S::StandHours; + type CreatedAt = S::CreatedAt; type Move = S::Move; type Exercise = S::Exercise; type ExerciseGoal = Set<members::exercise_goal>; @@ -152,12 +152,12 @@ pub mod rings_state { pub mod members { ///Marker type for the `move_goal` field pub struct move_goal(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `stand_goal` field pub struct stand_goal(()); ///Marker type for the `stand_hours` field pub struct stand_hours(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `move` field pub struct r#move(()); ///Marker type for the `exercise` field @@ -337,9 +337,9 @@ impl<'a, S> RingsBuilder<'a, S> where S: rings_state::State, S::MoveGoal: rings_state::IsSet, - S::CreatedAt: rings_state::IsSet, S::StandGoal: rings_state::IsSet, S::StandHours: rings_state::IsSet, + S::CreatedAt: rings_state::IsSet, S::Move: rings_state::IsSet, S::Exercise: rings_state::IsSet, S::ExerciseGoal: rings_state::IsSet, diff --git a/crates/jacquard-api/src/dev_baileytownsend/health/steps.rs b/crates/jacquard-api/src/dev_baileytownsend/health/steps.rs index 71b28e4b..b7643c03 100644 --- a/crates/jacquard-api/src/dev_baileytownsend/health/steps.rs +++ b/crates/jacquard-api/src/dev_baileytownsend/health/steps.rs @@ -31,37 +31,37 @@ pub mod steps_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Steps; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Steps = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Steps = S::Steps; + type CreatedAt = Unset; } ///State transition - sets the `steps` field to Set pub struct SetSteps<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSteps<S> {} impl<S: State> State for SetSteps<S> { - type CreatedAt = S::CreatedAt; type Steps = Set<members::steps>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Steps = S::Steps; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `steps` field pub struct steps(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -134,8 +134,8 @@ where impl<'a, S> StepsBuilder<'a, S> where S: steps_state::State, - S::CreatedAt: steps_state::IsSet, S::Steps: steps_state::IsSet, + S::CreatedAt: steps_state::IsSet, { /// Build the final struct pub fn build(self) -> Steps<'a> { diff --git a/crates/jacquard-api/src/dev_baileytownsend/health/workout.rs b/crates/jacquard-api/src/dev_baileytownsend/health/workout.rs index ea0d20e4..4c37b1bf 100644 --- a/crates/jacquard-api/src/dev_baileytownsend/health/workout.rs +++ b/crates/jacquard-api/src/dev_baileytownsend/health/workout.rs @@ -44,105 +44,105 @@ pub mod workout_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type StartTime; - type CreatedAt; type Activity; - type CaloriesBurned; - type EndTime; + type CreatedAt; type Duration; + type StartTime; + type EndTime; + type CaloriesBurned; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type StartTime = Unset; - type CreatedAt = Unset; type Activity = Unset; - type CaloriesBurned = Unset; - type EndTime = Unset; + type CreatedAt = Unset; type Duration = Unset; + type StartTime = Unset; + type EndTime = Unset; + type CaloriesBurned = Unset; } - ///State transition - sets the `start_time` field to Set - pub struct SetStartTime<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStartTime<S> {} - impl<S: State> State for SetStartTime<S> { - type StartTime = Set<members::start_time>; + ///State transition - sets the `activity` field to Set + pub struct SetActivity<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActivity<S> {} + impl<S: State> State for SetActivity<S> { + type Activity = Set<members::activity>; type CreatedAt = S::CreatedAt; - type Activity = S::Activity; - type CaloriesBurned = S::CaloriesBurned; - type EndTime = S::EndTime; type Duration = S::Duration; + type StartTime = S::StartTime; + type EndTime = S::EndTime; + type CaloriesBurned = S::CaloriesBurned; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type StartTime = S::StartTime; - type CreatedAt = Set<members::created_at>; type Activity = S::Activity; - type CaloriesBurned = S::CaloriesBurned; - type EndTime = S::EndTime; + type CreatedAt = Set<members::created_at>; type Duration = S::Duration; - } - ///State transition - sets the `activity` field to Set - pub struct SetActivity<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetActivity<S> {} - impl<S: State> State for SetActivity<S> { type StartTime = S::StartTime; - type CreatedAt = S::CreatedAt; - type Activity = Set<members::activity>; - type CaloriesBurned = S::CaloriesBurned; type EndTime = S::EndTime; - type Duration = S::Duration; + type CaloriesBurned = S::CaloriesBurned; } - ///State transition - sets the `calories_burned` field to Set - pub struct SetCaloriesBurned<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCaloriesBurned<S> {} - impl<S: State> State for SetCaloriesBurned<S> { - type StartTime = S::StartTime; - type CreatedAt = S::CreatedAt; + ///State transition - sets the `duration` field to Set + pub struct SetDuration<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDuration<S> {} + impl<S: State> State for SetDuration<S> { type Activity = S::Activity; - type CaloriesBurned = Set<members::calories_burned>; + type CreatedAt = S::CreatedAt; + type Duration = Set<members::duration>; + type StartTime = S::StartTime; type EndTime = S::EndTime; + type CaloriesBurned = S::CaloriesBurned; + } + ///State transition - sets the `start_time` field to Set + pub struct SetStartTime<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStartTime<S> {} + impl<S: State> State for SetStartTime<S> { + type Activity = S::Activity; + type CreatedAt = S::CreatedAt; type Duration = S::Duration; + type StartTime = Set<members::start_time>; + type EndTime = S::EndTime; + type CaloriesBurned = S::CaloriesBurned; } ///State transition - sets the `end_time` field to Set pub struct SetEndTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEndTime<S> {} impl<S: State> State for SetEndTime<S> { - type StartTime = S::StartTime; - type CreatedAt = S::CreatedAt; type Activity = S::Activity; - type CaloriesBurned = S::CaloriesBurned; - type EndTime = Set<members::end_time>; + type CreatedAt = S::CreatedAt; type Duration = S::Duration; - } - ///State transition - sets the `duration` field to Set - pub struct SetDuration<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDuration<S> {} - impl<S: State> State for SetDuration<S> { type StartTime = S::StartTime; - type CreatedAt = S::CreatedAt; - type Activity = S::Activity; + type EndTime = Set<members::end_time>; type CaloriesBurned = S::CaloriesBurned; + } + ///State transition - sets the `calories_burned` field to Set + pub struct SetCaloriesBurned<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCaloriesBurned<S> {} + impl<S: State> State for SetCaloriesBurned<S> { + type Activity = S::Activity; + type CreatedAt = S::CreatedAt; + type Duration = S::Duration; + type StartTime = S::StartTime; type EndTime = S::EndTime; - type Duration = Set<members::duration>; + type CaloriesBurned = Set<members::calories_burned>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `start_time` field - pub struct start_time(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `activity` field pub struct activity(()); - ///Marker type for the `calories_burned` field - pub struct calories_burned(()); - ///Marker type for the `end_time` field - pub struct end_time(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `duration` field pub struct duration(()); + ///Marker type for the `start_time` field + pub struct start_time(()); + ///Marker type for the `end_time` field + pub struct end_time(()); + ///Marker type for the `calories_burned` field + pub struct calories_burned(()); } } @@ -312,12 +312,12 @@ where impl<'a, S> WorkoutBuilder<'a, S> where S: workout_state::State, - S::StartTime: workout_state::IsSet, - S::CreatedAt: workout_state::IsSet, S::Activity: workout_state::IsSet, - S::CaloriesBurned: workout_state::IsSet, - S::EndTime: workout_state::IsSet, + S::CreatedAt: workout_state::IsSet, S::Duration: workout_state::IsSet, + S::StartTime: workout_state::IsSet, + S::EndTime: workout_state::IsSet, + S::CaloriesBurned: workout_state::IsSet, { /// Build the final struct pub fn build(self) -> Workout<'a> { diff --git a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/post.rs b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/post.rs index 23bd5ea7..1c28363e 100644 --- a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/post.rs +++ b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/post.rs @@ -46,105 +46,105 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; + type Content; type Category; type Forum; - type Title; type Tags; - type Content; + type Title; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; + type Content = Unset; type Category = Unset; type Forum = Unset; - type Title = Unset; type Tags = Unset; - type Content = Unset; + type Title = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Content = Set<members::content>; type Category = S::Category; type Forum = S::Forum; - type Title = S::Title; type Tags = S::Tags; - type Content = S::Content; + type Title = S::Title; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `category` field to Set pub struct SetCategory<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCategory<S> {} impl<S: State> State for SetCategory<S> { - type CreatedAt = S::CreatedAt; + type Content = S::Content; type Category = Set<members::category>; type Forum = S::Forum; - type Title = S::Title; type Tags = S::Tags; - type Content = S::Content; + type Title = S::Title; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `forum` field to Set pub struct SetForum<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetForum<S> {} impl<S: State> State for SetForum<S> { - type CreatedAt = S::CreatedAt; + type Content = S::Content; type Category = S::Category; type Forum = Set<members::forum>; - type Title = S::Title; type Tags = S::Tags; - type Content = S::Content; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { + type Title = S::Title; type CreatedAt = S::CreatedAt; - type Category = S::Category; - type Forum = S::Forum; - type Title = Set<members::title>; - type Tags = S::Tags; - type Content = S::Content; } ///State transition - sets the `tags` field to Set pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTags<S> {} impl<S: State> State for SetTags<S> { - type CreatedAt = S::CreatedAt; + type Content = S::Content; type Category = S::Category; type Forum = S::Forum; - type Title = S::Title; type Tags = Set<members::tags>; - type Content = S::Content; + type Title = S::Title; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Content = S::Content; + type Category = S::Category; + type Forum = S::Forum; + type Tags = S::Tags; + type Title = Set<members::title>; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Content = S::Content; type Category = S::Category; type Forum = S::Forum; - type Title = S::Title; type Tags = S::Tags; - type Content = Set<members::content>; + type Title = S::Title; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); + ///Marker type for the `content` field + pub struct content(()); ///Marker type for the `category` field pub struct category(()); ///Marker type for the `forum` field pub struct forum(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `tags` field pub struct tags(()); - ///Marker type for the `content` field - pub struct content(()); + ///Marker type for the `title` field + pub struct title(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -337,12 +337,12 @@ impl<'a, S: post_state::State> PostBuilder<'a, S> { impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::CreatedAt: post_state::IsSet, + S::Content: post_state::IsSet, S::Category: post_state::IsSet, S::Forum: post_state::IsSet, - S::Title: post_state::IsSet, S::Tags: post_state::IsSet, - S::Content: post_state::IsSet, + S::Title: post_state::IsSet, + S::CreatedAt: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/question.rs b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/question.rs index 15908c99..43f61dac 100644 --- a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/question.rs +++ b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/question.rs @@ -42,105 +42,105 @@ pub mod question_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IsOpen; - type Content; type Title; - type CreatedAt; type Forum; type Tags; + type CreatedAt; + type IsOpen; + type Content; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IsOpen = Unset; - type Content = Unset; type Title = Unset; - type CreatedAt = Unset; type Forum = Unset; type Tags = Unset; - } - ///State transition - sets the `is_open` field to Set - pub struct SetIsOpen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIsOpen<S> {} - impl<S: State> State for SetIsOpen<S> { - type IsOpen = Set<members::is_open>; - type Content = S::Content; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - type Forum = S::Forum; - type Tags = S::Tags; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type IsOpen = S::IsOpen; - type Content = Set<members::content>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - type Forum = S::Forum; - type Tags = S::Tags; + type CreatedAt = Unset; + type IsOpen = Unset; + type Content = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type IsOpen = S::IsOpen; - type Content = S::Content; type Title = Set<members::title>; - type CreatedAt = S::CreatedAt; type Forum = S::Forum; type Tags = S::Tags; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = S::CreatedAt; type IsOpen = S::IsOpen; type Content = S::Content; - type Title = S::Title; - type CreatedAt = Set<members::created_at>; - type Forum = S::Forum; - type Tags = S::Tags; } ///State transition - sets the `forum` field to Set pub struct SetForum<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetForum<S> {} impl<S: State> State for SetForum<S> { - type IsOpen = S::IsOpen; - type Content = S::Content; type Title = S::Title; - type CreatedAt = S::CreatedAt; type Forum = Set<members::forum>; type Tags = S::Tags; + type CreatedAt = S::CreatedAt; + type IsOpen = S::IsOpen; + type Content = S::Content; } ///State transition - sets the `tags` field to Set pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTags<S> {} impl<S: State> State for SetTags<S> { + type Title = S::Title; + type Forum = S::Forum; + type Tags = Set<members::tags>; + type CreatedAt = S::CreatedAt; type IsOpen = S::IsOpen; type Content = S::Content; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Title = S::Title; + type Forum = S::Forum; + type Tags = S::Tags; + type CreatedAt = Set<members::created_at>; + type IsOpen = S::IsOpen; + type Content = S::Content; + } + ///State transition - sets the `is_open` field to Set + pub struct SetIsOpen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIsOpen<S> {} + impl<S: State> State for SetIsOpen<S> { + type Title = S::Title; + type Forum = S::Forum; + type Tags = S::Tags; type CreatedAt = S::CreatedAt; + type IsOpen = Set<members::is_open>; + type Content = S::Content; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Title = S::Title; type Forum = S::Forum; - type Tags = Set<members::tags>; + type Tags = S::Tags; + type CreatedAt = S::CreatedAt; + type IsOpen = S::IsOpen; + type Content = Set<members::content>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `is_open` field - pub struct is_open(()); - ///Marker type for the `content` field - pub struct content(()); ///Marker type for the `title` field pub struct title(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `forum` field pub struct forum(()); ///Marker type for the `tags` field pub struct tags(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `is_open` field + pub struct is_open(()); + ///Marker type for the `content` field + pub struct content(()); } } @@ -313,12 +313,12 @@ impl<'a, S: question_state::State> QuestionBuilder<'a, S> { impl<'a, S> QuestionBuilder<'a, S> where S: question_state::State, - S::IsOpen: question_state::IsSet, - S::Content: question_state::IsSet, S::Title: question_state::IsSet, - S::CreatedAt: question_state::IsSet, S::Forum: question_state::IsSet, S::Tags: question_state::IsSet, + S::CreatedAt: question_state::IsSet, + S::IsOpen: question_state::IsSet, + S::Content: question_state::IsSet, { /// Build the final struct pub fn build(self) -> Question<'a> { diff --git a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/reply.rs b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/reply.rs index d5393124..2d831117 100644 --- a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/reply.rs +++ b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/feed/reply.rs @@ -37,51 +37,51 @@ pub mod reply_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Content; type Root; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Content = Unset; type Root = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Content = S::Content; + type Root = S::Root; } ///State transition - sets the `content` field to Set pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetContent<S> {} impl<S: State> State for SetContent<S> { + type CreatedAt = S::CreatedAt; type Content = Set<members::content>; type Root = S::Root; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `root` field to Set pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRoot<S> {} impl<S: State> State for SetRoot<S> { - type Content = S::Content; - type Root = Set<members::root>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type Content = S::Content; - type Root = S::Root; - type CreatedAt = Set<members::created_at>; + type Root = Set<members::root>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `content` field pub struct content(()); ///Marker type for the `root` field pub struct root(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -194,9 +194,9 @@ impl<'a, S: reply_state::State> ReplyBuilder<'a, S> { impl<'a, S> ReplyBuilder<'a, S> where S: reply_state::State, + S::CreatedAt: reply_state::IsSet, S::Content: reply_state::IsSet, S::Root: reply_state::IsSet, - S::CreatedAt: reply_state::IsSet, { /// Build the final struct pub fn build(self) -> Reply<'a> { diff --git a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/forum/category.rs b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/forum/category.rs index 565f53ae..b35f030a 100644 --- a/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/forum/category.rs +++ b/crates/jacquard-api/src/dev_fudgeu/experimental/atforumv1/forum/category.rs @@ -39,51 +39,51 @@ pub mod category_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Group; type CategoryType; type Name; - type Group; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Group = Unset; type CategoryType = Unset; type Name = Unset; - type Group = Unset; + } + ///State transition - sets the `group` field to Set + pub struct SetGroup<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetGroup<S> {} + impl<S: State> State for SetGroup<S> { + type Group = Set<members::group>; + type CategoryType = S::CategoryType; + type Name = S::Name; } ///State transition - sets the `category_type` field to Set pub struct SetCategoryType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCategoryType<S> {} impl<S: State> State for SetCategoryType<S> { + type Group = S::Group; type CategoryType = Set<members::category_type>; type Name = S::Name; - type Group = S::Group; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CategoryType = S::CategoryType; - type Name = Set<members::name>; type Group = S::Group; - } - ///State transition - sets the `group` field to Set - pub struct SetGroup<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetGroup<S> {} - impl<S: State> State for SetGroup<S> { type CategoryType = S::CategoryType; - type Name = S::Name; - type Group = Set<members::group>; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `group` field + pub struct group(()); ///Marker type for the `category_type` field pub struct category_type(()); ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `group` field - pub struct group(()); } } @@ -196,9 +196,9 @@ where impl<'a, S> CategoryBuilder<'a, S> where S: category_state::State, + S::Group: category_state::IsSet, S::CategoryType: category_state::IsSet, S::Name: category_state::IsSet, - S::Group: category_state::IsSet, { /// Build the final struct pub fn build(self) -> Category<'a> { diff --git a/crates/jacquard-api/src/dev_ocbwoy3/blueboard/board.rs b/crates/jacquard-api/src/dev_ocbwoy3/blueboard/board.rs index 5ea86e76..e4b4b42c 100644 --- a/crates/jacquard-api/src/dev_ocbwoy3/blueboard/board.rs +++ b/crates/jacquard-api/src/dev_ocbwoy3/blueboard/board.rs @@ -39,67 +39,67 @@ pub mod board_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Nsfw; - type Description; type Title; type CreatedAt; + type Description; + type Nsfw; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Nsfw = Unset; - type Description = Unset; type Title = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `nsfw` field to Set - pub struct SetNsfw<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNsfw<S> {} - impl<S: State> State for SetNsfw<S> { - type Nsfw = Set<members::nsfw>; - type Description = S::Description; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { - type Nsfw = S::Nsfw; - type Description = Set<members::description>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; + type Description = Unset; + type Nsfw = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Nsfw = S::Nsfw; - type Description = S::Description; type Title = Set<members::title>; type CreatedAt = S::CreatedAt; + type Description = S::Description; + type Nsfw = S::Nsfw; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Nsfw = S::Nsfw; - type Description = S::Description; type Title = S::Title; type CreatedAt = Set<members::created_at>; + type Description = S::Description; + type Nsfw = S::Nsfw; + } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type Title = S::Title; + type CreatedAt = S::CreatedAt; + type Description = Set<members::description>; + type Nsfw = S::Nsfw; + } + ///State transition - sets the `nsfw` field to Set + pub struct SetNsfw<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNsfw<S> {} + impl<S: State> State for SetNsfw<S> { + type Title = S::Title; + type CreatedAt = S::CreatedAt; + type Description = S::Description; + type Nsfw = Set<members::nsfw>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `nsfw` field - pub struct nsfw(()); - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `nsfw` field + pub struct nsfw(()); } } @@ -212,10 +212,10 @@ where impl<'a, S> BoardBuilder<'a, S> where S: board_state::State, - S::Nsfw: board_state::IsSet, - S::Description: board_state::IsSet, S::Title: board_state::IsSet, S::CreatedAt: board_state::IsSet, + S::Description: board_state::IsSet, + S::Nsfw: board_state::IsSet, { /// Build the final struct pub fn build(self) -> Board<'a> { diff --git a/crates/jacquard-api/src/dev_ocbwoy3/blueboard/post.rs b/crates/jacquard-api/src/dev_ocbwoy3/blueboard/post.rs index c1c8b853..35f4596b 100644 --- a/crates/jacquard-api/src/dev_ocbwoy3/blueboard/post.rs +++ b/crates/jacquard-api/src/dev_ocbwoy3/blueboard/post.rs @@ -42,50 +42,50 @@ pub mod post_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Text; - type Parent; type CreatedAt; + type Parent; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Text = Unset; - type Parent = Unset; type CreatedAt = Unset; + type Parent = Unset; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { type Text = Set<members::text>; - type Parent = S::Parent; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `parent` field to Set - pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetParent<S> {} - impl<S: State> State for SetParent<S> { - type Text = S::Text; - type Parent = Set<members::parent>; type CreatedAt = S::CreatedAt; + type Parent = S::Parent; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Text = S::Text; - type Parent = S::Parent; type CreatedAt = Set<members::created_at>; + type Parent = S::Parent; + } + ///State transition - sets the `parent` field to Set + pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetParent<S> {} + impl<S: State> State for SetParent<S> { + type Text = S::Text; + type CreatedAt = S::CreatedAt; + type Parent = Set<members::parent>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `text` field pub struct text(()); - ///Marker type for the `parent` field - pub struct parent(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `parent` field + pub struct parent(()); } } @@ -199,8 +199,8 @@ impl<'a, S> PostBuilder<'a, S> where S: post_state::State, S::Text: post_state::IsSet, - S::Parent: post_state::IsSet, S::CreatedAt: post_state::IsSet, + S::Parent: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/dev_regnault/webfishing/savefile.rs b/crates/jacquard-api/src/dev_regnault/webfishing/savefile.rs index 75536d52..23218e6a 100644 --- a/crates/jacquard-api/src/dev_regnault/webfishing/savefile.rs +++ b/crates/jacquard-api/src/dev_regnault/webfishing/savefile.rs @@ -34,37 +34,37 @@ pub mod savefile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Name; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Name = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Name = S::Name; + type Uri = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Uri = S::Uri; type Name = Set<members::name>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Name = S::Name; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> SavefileBuilder<'a, S> where S: savefile_state::State, - S::Uri: savefile_state::IsSet, S::Name: savefile_state::IsSet, + S::Uri: savefile_state::IsSet, { /// Build the final struct pub fn build(self) -> Savefile<'a> { diff --git a/crates/jacquard-api/src/dev_tsunagite.rs b/crates/jacquard-api/src/dev_tsunagite.rs new file mode 100644 index 00000000..e6c84f71 --- /dev/null +++ b/crates/jacquard-api/src/dev_tsunagite.rs @@ -0,0 +1,9 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod difficulty; +pub mod game; +pub mod song; +pub mod types; \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_tsunagite/difficulty.rs b/crates/jacquard-api/src/dev_tsunagite/difficulty.rs new file mode 100644 index 00000000..7a34586d --- /dev/null +++ b/crates/jacquard-api/src/dev_tsunagite/difficulty.rs @@ -0,0 +1,298 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.tsunagite.difficulty +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A difficulty slot in a game hosting leaderboards via Tsunagite. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Difficulty<'a> { + /// The hex code color of the difficulty slot. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub color: std::option::Option<jacquard_common::CowStr<'a>>, + /// The human-readable name of the difficulty slot for use in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, +} + +pub mod difficulty_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Name; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Name = Unset; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Name = Set<members::name>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `name` field + pub struct name(()); + } +} + +/// Builder for constructing an instance of this type +pub struct DifficultyBuilder<'a, S: difficulty_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Difficulty<'a> { + /// Create a new builder for this type + pub fn new() -> DifficultyBuilder<'a, difficulty_state::Empty> { + DifficultyBuilder::new() + } +} + +impl<'a> DifficultyBuilder<'a, difficulty_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + DifficultyBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: difficulty_state::State> DifficultyBuilder<'a, S> { + /// Set the `color` field (optional) + pub fn color( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `color` field to an Option value (optional) + pub fn maybe_color(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> DifficultyBuilder<'a, S> +where + S: difficulty_state::State, + S::Name: difficulty_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> DifficultyBuilder<'a, difficulty_state::SetName<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + DifficultyBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DifficultyBuilder<'a, S> +where + S: difficulty_state::State, + S::Name: difficulty_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Difficulty<'a> { + Difficulty { + color: self.__unsafe_private_named.0, + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Difficulty<'a> { + Difficulty { + color: self.__unsafe_private_named.0, + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Difficulty<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, DifficultyRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DifficultyGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Difficulty<'a>, +} + +impl From<DifficultyGetRecordOutput<'_>> for Difficulty<'_> { + fn from(output: DifficultyGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Difficulty<'_> { + const NSID: &'static str = "dev.tsunagite.difficulty"; + type Record = DifficultyRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct DifficultyRecord; +impl jacquard_common::xrpc::XrpcResp for DifficultyRecord { + const NSID: &'static str = "dev.tsunagite.difficulty"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DifficultyGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for DifficultyRecord { + const NSID: &'static str = "dev.tsunagite.difficulty"; + type Record = DifficultyRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Difficulty<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.difficulty" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_difficulty() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_dev_tsunagite_difficulty() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.tsunagite.difficulty"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A difficulty slot in a game hosting leaderboards via Tsunagite.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("color"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The hex code color of the difficulty slot.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_tsunagite/game.rs b/crates/jacquard-api/src/dev_tsunagite/game.rs new file mode 100644 index 00000000..fb769d2e --- /dev/null +++ b/crates/jacquard-api/src/dev_tsunagite/game.rs @@ -0,0 +1,1880 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.tsunagite.game +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A closed set of indexable named values. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Enum<'a> { + /// The internal ID of this component, limited to the RecordKey characterset. + #[serde(borrow)] + pub id: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// The human-readable name of this component in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, + /// The allowed values for this enum to take. + #[serde(borrow)] + pub values: Vec<crate::dev_tsunagite::types::Indexable<'a>>, +} + +pub mod enum_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Values; + type Id; + type Name; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Values = Unset; + type Id = Unset; + type Name = Unset; + } + ///State transition - sets the `values` field to Set + pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValues<S> {} + impl<S: State> State for SetValues<S> { + type Values = Set<members::values>; + type Id = S::Id; + type Name = S::Name; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Values = S::Values; + type Id = Set<members::id>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Values = S::Values; + type Id = S::Id; + type Name = Set<members::name>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `values` field + pub struct values(()); + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `name` field + pub struct name(()); + } +} + +/// Builder for constructing an instance of this type +pub struct EnumBuilder<'a, S: enum_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<Vec<crate::dev_tsunagite::types::Indexable<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Enum<'a> { + /// Create a new builder for this type + pub fn new() -> EnumBuilder<'a, enum_state::Empty> { + EnumBuilder::new() + } +} + +impl<'a> EnumBuilder<'a, enum_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + EnumBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EnumBuilder<'a, S> +where + S: enum_state::State, + S::Id: enum_state::IsUnset, +{ + /// Set the `id` field (required) + pub fn id( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> EnumBuilder<'a, enum_state::SetId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + EnumBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EnumBuilder<'a, S> +where + S: enum_state::State, + S::Name: enum_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> EnumBuilder<'a, enum_state::SetName<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + EnumBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EnumBuilder<'a, S> +where + S: enum_state::State, + S::Values: enum_state::IsUnset, +{ + /// Set the `values` field (required) + pub fn values( + mut self, + value: impl Into<Vec<crate::dev_tsunagite::types::Indexable<'a>>>, + ) -> EnumBuilder<'a, enum_state::SetValues<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + EnumBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EnumBuilder<'a, S> +where + S: enum_state::State, + S::Values: enum_state::IsSet, + S::Id: enum_state::IsSet, + S::Name: enum_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Enum<'a> { + Enum { + id: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + values: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Enum<'a> { + Enum { + id: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + values: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_dev_tsunagite_game() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.tsunagite.game"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("enum"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A closed set of indexable named values.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_common::smol_str::SmolStr::new_static("values") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The internal ID of this component, limited to the RecordKey characterset.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: Some(1usize), + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("values"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "The allowed values for this enum to take.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.types#indexable", + ), + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A record describing a game hosting leaderboards via Tsunagite.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("judgments"), + ::jacquard_common::smol_str::SmolStr::new_static("scoreComponents"), + ::jacquard_common::smol_str::SmolStr::new_static("defaultComponent") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "defaultComponent", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The default component for leaderboard sorting.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "inputMethods", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "An array of usable input methods for the game. Optional if the game only has one input method or doesn't separate leaderboards by method.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Can be tokens or raw strings.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "judgments", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "The obtainable judgments during gameplay.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.types#indexable", + ), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("logo"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("modes"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "An array of playable game modes with different gameplay configurations. Optional if the game only has one mode.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Can be tokens or raw strings.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "scoreComponents", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "All the components of a score in the game, including grades, lamps, EX score, and whatever other constructs are used.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: None, + refs: vec![ + ::jacquard_common::CowStr::new_static("#enum"), + ::jacquard_common::CowStr::new_static("#points"), + ::jacquard_common::CowStr::new_static("#percentage"), + ::jacquard_common::CowStr::new_static("#text") + ], + closed: None, + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("percentage"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A percentage score with customizable precision.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_common::smol_str::SmolStr::new_static("maximum"), + ::jacquard_common::smol_str::SmolStr::new_static("precision") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The internal ID of this component, limited to the RecordKey characterset.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: Some(1usize), + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("maximum"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "precision", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("points"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "An integer point score, with or without a cap.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("id") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The internal ID of this component, limited to the RecordKey characterset.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: Some(1usize), + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("maximum"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A fallback component for displaying arbitrary text.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("id") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The internal ID of this component, limited to the RecordKey characterset.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: Some(1usize), + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Enum<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.game" + } + fn def_name() -> &'static str { + "enum" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_game() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +/// A record describing a game hosting leaderboards via Tsunagite. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Game<'a> { + /// The default component for leaderboard sorting. + #[serde(borrow)] + pub default_component: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// An array of usable input methods for the game. Optional if the game only has one input method or doesn't separate leaderboards by method. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub input_methods: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// The obtainable judgments during gameplay. + #[serde(borrow)] + pub judgments: Vec<crate::dev_tsunagite::types::Indexable<'a>>, + /// The logo of the game, for display in UI. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub logo: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// An array of playable game modes with different gameplay configurations. Optional if the game only has one mode. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub modes: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// The human-readable name of the game, for display in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, + /// All the components of a score in the game, including grades, lamps, EX score, and whatever other constructs are used. + #[serde(borrow)] + pub score_components: Vec<GameScoreComponentsItem<'a>>, +} + +pub mod game_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type DefaultComponent; + type Name; + type Judgments; + type ScoreComponents; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type DefaultComponent = Unset; + type Name = Unset; + type Judgments = Unset; + type ScoreComponents = Unset; + } + ///State transition - sets the `default_component` field to Set + pub struct SetDefaultComponent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDefaultComponent<S> {} + impl<S: State> State for SetDefaultComponent<S> { + type DefaultComponent = Set<members::default_component>; + type Name = S::Name; + type Judgments = S::Judgments; + type ScoreComponents = S::ScoreComponents; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type DefaultComponent = S::DefaultComponent; + type Name = Set<members::name>; + type Judgments = S::Judgments; + type ScoreComponents = S::ScoreComponents; + } + ///State transition - sets the `judgments` field to Set + pub struct SetJudgments<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetJudgments<S> {} + impl<S: State> State for SetJudgments<S> { + type DefaultComponent = S::DefaultComponent; + type Name = S::Name; + type Judgments = Set<members::judgments>; + type ScoreComponents = S::ScoreComponents; + } + ///State transition - sets the `score_components` field to Set + pub struct SetScoreComponents<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetScoreComponents<S> {} + impl<S: State> State for SetScoreComponents<S> { + type DefaultComponent = S::DefaultComponent; + type Name = S::Name; + type Judgments = S::Judgments; + type ScoreComponents = Set<members::score_components>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `default_component` field + pub struct default_component(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `judgments` field + pub struct judgments(()); + ///Marker type for the `score_components` field + pub struct score_components(()); + } +} + +/// Builder for constructing an instance of this type +pub struct GameBuilder<'a, S: game_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<Vec<crate::dev_tsunagite::types::Indexable<'a>>>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<Vec<GameScoreComponentsItem<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Game<'a> { + /// Create a new builder for this type + pub fn new() -> GameBuilder<'a, game_state::Empty> { + GameBuilder::new() + } +} + +impl<'a> GameBuilder<'a, game_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GameBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GameBuilder<'a, S> +where + S: game_state::State, + S::DefaultComponent: game_state::IsUnset, +{ + /// Set the `defaultComponent` field (required) + pub fn default_component( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> GameBuilder<'a, game_state::SetDefaultComponent<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + GameBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: game_state::State> GameBuilder<'a, S> { + /// Set the `inputMethods` field (optional) + pub fn input_methods( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `inputMethods` field to an Option value (optional) + pub fn maybe_input_methods( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> GameBuilder<'a, S> +where + S: game_state::State, + S::Judgments: game_state::IsUnset, +{ + /// Set the `judgments` field (required) + pub fn judgments( + mut self, + value: impl Into<Vec<crate::dev_tsunagite::types::Indexable<'a>>>, + ) -> GameBuilder<'a, game_state::SetJudgments<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + GameBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: game_state::State> GameBuilder<'a, S> { + /// Set the `logo` field (optional) + pub fn logo( + mut self, + value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `logo` field to an Option value (optional) + pub fn maybe_logo( + mut self, + value: Option<jacquard_common::types::blob::BlobRef<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: game_state::State> GameBuilder<'a, S> { + /// Set the `modes` field (optional) + pub fn modes( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `modes` field to an Option value (optional) + pub fn maybe_modes( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S> GameBuilder<'a, S> +where + S: game_state::State, + S::Name: game_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> GameBuilder<'a, game_state::SetName<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + GameBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GameBuilder<'a, S> +where + S: game_state::State, + S::ScoreComponents: game_state::IsUnset, +{ + /// Set the `scoreComponents` field (required) + pub fn score_components( + mut self, + value: impl Into<Vec<GameScoreComponentsItem<'a>>>, + ) -> GameBuilder<'a, game_state::SetScoreComponents<S>> { + self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); + GameBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GameBuilder<'a, S> +where + S: game_state::State, + S::DefaultComponent: game_state::IsSet, + S::Name: game_state::IsSet, + S::Judgments: game_state::IsSet, + S::ScoreComponents: game_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Game<'a> { + Game { + default_component: self.__unsafe_private_named.0.unwrap(), + input_methods: self.__unsafe_private_named.1, + judgments: self.__unsafe_private_named.2.unwrap(), + logo: self.__unsafe_private_named.3, + modes: self.__unsafe_private_named.4, + name: self.__unsafe_private_named.5.unwrap(), + score_components: self.__unsafe_private_named.6.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Game<'a> { + Game { + default_component: self.__unsafe_private_named.0.unwrap(), + input_methods: self.__unsafe_private_named.1, + judgments: self.__unsafe_private_named.2.unwrap(), + logo: self.__unsafe_private_named.3, + modes: self.__unsafe_private_named.4, + name: self.__unsafe_private_named.5.unwrap(), + score_components: self.__unsafe_private_named.6.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Game<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, GameRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(tag = "$type")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum GameScoreComponentsItem<'a> { + #[serde(rename = "dev.tsunagite.game#enum")] + Enum(Box<crate::dev_tsunagite::game::Enum<'a>>), + #[serde(rename = "dev.tsunagite.game#points")] + Points(Box<crate::dev_tsunagite::game::Points<'a>>), + #[serde(rename = "dev.tsunagite.game#percentage")] + Percentage(Box<crate::dev_tsunagite::game::Percentage<'a>>), + #[serde(rename = "dev.tsunagite.game#text")] + Text(Box<crate::dev_tsunagite::game::Text<'a>>), +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GameGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Game<'a>, +} + +impl From<GameGetRecordOutput<'_>> for Game<'_> { + fn from(output: GameGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Game<'_> { + const NSID: &'static str = "dev.tsunagite.game"; + type Record = GameRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GameRecord; +impl jacquard_common::xrpc::XrpcResp for GameRecord { + const NSID: &'static str = "dev.tsunagite.game"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = GameGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for GameRecord { + const NSID: &'static str = "dev.tsunagite.game"; + type Record = GameRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Game<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.game" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_game() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/// A percentage score with customizable precision. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Percentage<'a> { + /// The internal ID of this component, limited to the RecordKey characterset. + #[serde(borrow)] + pub id: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// The maximum allowed percentage for this score. + pub maximum: i64, + /// The human-readable name of this component in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, + /// The number of decimal places to include in the percentage. + pub precision: i64, +} + +pub mod percentage_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Name; + type Id; + type Precision; + type Maximum; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Name = Unset; + type Id = Unset; + type Precision = Unset; + type Maximum = Unset; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Name = Set<members::name>; + type Id = S::Id; + type Precision = S::Precision; + type Maximum = S::Maximum; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Name = S::Name; + type Id = Set<members::id>; + type Precision = S::Precision; + type Maximum = S::Maximum; + } + ///State transition - sets the `precision` field to Set + pub struct SetPrecision<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPrecision<S> {} + impl<S: State> State for SetPrecision<S> { + type Name = S::Name; + type Id = S::Id; + type Precision = Set<members::precision>; + type Maximum = S::Maximum; + } + ///State transition - sets the `maximum` field to Set + pub struct SetMaximum<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMaximum<S> {} + impl<S: State> State for SetMaximum<S> { + type Name = S::Name; + type Id = S::Id; + type Precision = S::Precision; + type Maximum = Set<members::maximum>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `precision` field + pub struct precision(()); + ///Marker type for the `maximum` field + pub struct maximum(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PercentageBuilder<'a, S: percentage_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<i64>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Percentage<'a> { + /// Create a new builder for this type + pub fn new() -> PercentageBuilder<'a, percentage_state::Empty> { + PercentageBuilder::new() + } +} + +impl<'a> PercentageBuilder<'a, percentage_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PercentageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PercentageBuilder<'a, S> +where + S: percentage_state::State, + S::Id: percentage_state::IsUnset, +{ + /// Set the `id` field (required) + pub fn id( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> PercentageBuilder<'a, percentage_state::SetId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PercentageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PercentageBuilder<'a, S> +where + S: percentage_state::State, + S::Maximum: percentage_state::IsUnset, +{ + /// Set the `maximum` field (required) + pub fn maximum( + mut self, + value: impl Into<i64>, + ) -> PercentageBuilder<'a, percentage_state::SetMaximum<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + PercentageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PercentageBuilder<'a, S> +where + S: percentage_state::State, + S::Name: percentage_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> PercentageBuilder<'a, percentage_state::SetName<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PercentageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PercentageBuilder<'a, S> +where + S: percentage_state::State, + S::Precision: percentage_state::IsUnset, +{ + /// Set the `precision` field (required) + pub fn precision( + mut self, + value: impl Into<i64>, + ) -> PercentageBuilder<'a, percentage_state::SetPrecision<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + PercentageBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PercentageBuilder<'a, S> +where + S: percentage_state::State, + S::Name: percentage_state::IsSet, + S::Id: percentage_state::IsSet, + S::Precision: percentage_state::IsSet, + S::Maximum: percentage_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Percentage<'a> { + Percentage { + id: self.__unsafe_private_named.0.unwrap(), + maximum: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2.unwrap(), + precision: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Percentage<'a> { + Percentage { + id: self.__unsafe_private_named.0.unwrap(), + maximum: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2.unwrap(), + precision: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Percentage<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.game" + } + fn def_name() -> &'static str { + "percentage" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_game() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +/// An integer point score, with or without a cap. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Points<'a> { + /// The internal ID of this component, limited to the RecordKey characterset. + #[serde(borrow)] + pub id: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// The maximum allowed value for this score. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub maximum: std::option::Option<i64>, + /// The human-readable name of this component in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, +} + +pub mod points_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Id; + type Name; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Id = Unset; + type Name = Unset; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Id = Set<members::id>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Id = S::Id; + type Name = Set<members::name>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `name` field + pub struct name(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PointsBuilder<'a, S: points_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Points<'a> { + /// Create a new builder for this type + pub fn new() -> PointsBuilder<'a, points_state::Empty> { + PointsBuilder::new() + } +} + +impl<'a> PointsBuilder<'a, points_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PointsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PointsBuilder<'a, S> +where + S: points_state::State, + S::Id: points_state::IsUnset, +{ + /// Set the `id` field (required) + pub fn id( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> PointsBuilder<'a, points_state::SetId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PointsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: points_state::State> PointsBuilder<'a, S> { + /// Set the `maximum` field (optional) + pub fn maximum(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `maximum` field to an Option value (optional) + pub fn maybe_maximum(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> PointsBuilder<'a, S> +where + S: points_state::State, + S::Name: points_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> PointsBuilder<'a, points_state::SetName<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PointsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PointsBuilder<'a, S> +where + S: points_state::State, + S::Id: points_state::IsSet, + S::Name: points_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Points<'a> { + Points { + id: self.__unsafe_private_named.0.unwrap(), + maximum: self.__unsafe_private_named.1, + name: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Points<'a> { + Points { + id: self.__unsafe_private_named.0.unwrap(), + maximum: self.__unsafe_private_named.1, + name: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Points<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.game" + } + fn def_name() -> &'static str { + "points" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_game() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +/// A fallback component for displaying arbitrary text. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Text<'a> { + /// The internal ID of this component, limited to the RecordKey characterset. + #[serde(borrow)] + pub id: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// The human-readable name of this component in UI. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, +} + +pub mod text_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Id; + type Name; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Id = Unset; + type Name = Unset; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Id = Set<members::id>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Id = S::Id; + type Name = Set<members::name>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `name` field + pub struct name(()); + } +} + +/// Builder for constructing an instance of this type +pub struct TextBuilder<'a, S: text_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Text<'a> { + /// Create a new builder for this type + pub fn new() -> TextBuilder<'a, text_state::Empty> { + TextBuilder::new() + } +} + +impl<'a> TextBuilder<'a, text_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + TextBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TextBuilder<'a, S> +where + S: text_state::State, + S::Id: text_state::IsUnset, +{ + /// Set the `id` field (required) + pub fn id( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> TextBuilder<'a, text_state::SetId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + TextBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TextBuilder<'a, S> +where + S: text_state::State, + S::Name: text_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> TextBuilder<'a, text_state::SetName<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + TextBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TextBuilder<'a, S> +where + S: text_state::State, + S::Id: text_state::IsSet, + S::Name: text_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Text<'a> { + Text { + id: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Text<'a> { + Text { + id: self.__unsafe_private_named.0.unwrap(), + name: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Text<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.game" + } + fn def_name() -> &'static str { + "text" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_game() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_tsunagite/song.rs b/crates/jacquard-api/src/dev_tsunagite/song.rs new file mode 100644 index 00000000..218f1c8c --- /dev/null +++ b/crates/jacquard-api/src/dev_tsunagite/song.rs @@ -0,0 +1,553 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.tsunagite.song +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A song included in a game hosting leaderboards via Tsunagite. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Song<'a> { + /// The name of the composer of this song. Translations will typically be listed alongside the default. + #[serde(borrow)] + pub composer: jacquard_common::types::value::Data<'a>, + /// The game(s) this song is included in. + #[serde(borrow)] + pub game: Vec<jacquard_common::types::string::AtUri<'a>>, + /// The genre this song belongs to. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub genre: std::option::Option<jacquard_common::types::value::Data<'a>>, + /// The jacket or banner art of this song, for display in UI. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub jacket: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// The name of the jacket artist for this song. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub jacket_artist: std::option::Option<jacquard_common::types::value::Data<'a>>, + /// The source this song is from - an album, competition, other game, etc. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub source: std::option::Option<jacquard_common::types::value::Data<'a>>, + /// The human-readable subtitle of this song. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub subtitle: std::option::Option<jacquard_common::types::value::Data<'a>>, + /// The human-readable title of this song in UI. Translations will typically be listed alongside the default. + #[serde(borrow)] + pub title: jacquard_common::types::value::Data<'a>, +} + +pub mod song_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Title; + type Composer; + type Game; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Title = Unset; + type Composer = Unset; + type Game = Unset; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; + type Composer = S::Composer; + type Game = S::Game; + } + ///State transition - sets the `composer` field to Set + pub struct SetComposer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetComposer<S> {} + impl<S: State> State for SetComposer<S> { + type Title = S::Title; + type Composer = Set<members::composer>; + type Game = S::Game; + } + ///State transition - sets the `game` field to Set + pub struct SetGame<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetGame<S> {} + impl<S: State> State for SetGame<S> { + type Title = S::Title; + type Composer = S::Composer; + type Game = Set<members::game>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `title` field + pub struct title(()); + ///Marker type for the `composer` field + pub struct composer(()); + ///Marker type for the `game` field + pub struct game(()); + } +} + +/// Builder for constructing an instance of this type +pub struct SongBuilder<'a, S: song_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Song<'a> { + /// Create a new builder for this type + pub fn new() -> SongBuilder<'a, song_state::Empty> { + SongBuilder::new() + } +} + +impl<'a> SongBuilder<'a, song_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + SongBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> SongBuilder<'a, S> +where + S: song_state::State, + S::Composer: song_state::IsUnset, +{ + /// Set the `composer` field (required) + pub fn composer( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> SongBuilder<'a, song_state::SetComposer<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + SongBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> SongBuilder<'a, S> +where + S: song_state::State, + S::Game: song_state::IsUnset, +{ + /// Set the `game` field (required) + pub fn game( + mut self, + value: impl Into<Vec<jacquard_common::types::string::AtUri<'a>>>, + ) -> SongBuilder<'a, song_state::SetGame<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + SongBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: song_state::State> SongBuilder<'a, S> { + /// Set the `genre` field (optional) + pub fn genre( + mut self, + value: impl Into<Option<jacquard_common::types::value::Data<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `genre` field to an Option value (optional) + pub fn maybe_genre( + mut self, + value: Option<jacquard_common::types::value::Data<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: song_state::State> SongBuilder<'a, S> { + /// Set the `jacket` field (optional) + pub fn jacket( + mut self, + value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `jacket` field to an Option value (optional) + pub fn maybe_jacket( + mut self, + value: Option<jacquard_common::types::blob::BlobRef<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: song_state::State> SongBuilder<'a, S> { + /// Set the `jacketArtist` field (optional) + pub fn jacket_artist( + mut self, + value: impl Into<Option<jacquard_common::types::value::Data<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `jacketArtist` field to an Option value (optional) + pub fn maybe_jacket_artist( + mut self, + value: Option<jacquard_common::types::value::Data<'a>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: song_state::State> SongBuilder<'a, S> { + /// Set the `source` field (optional) + pub fn source( + mut self, + value: impl Into<Option<jacquard_common::types::value::Data<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `source` field to an Option value (optional) + pub fn maybe_source( + mut self, + value: Option<jacquard_common::types::value::Data<'a>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: song_state::State> SongBuilder<'a, S> { + /// Set the `subtitle` field (optional) + pub fn subtitle( + mut self, + value: impl Into<Option<jacquard_common::types::value::Data<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `subtitle` field to an Option value (optional) + pub fn maybe_subtitle( + mut self, + value: Option<jacquard_common::types::value::Data<'a>>, + ) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S> SongBuilder<'a, S> +where + S: song_state::State, + S::Title: song_state::IsUnset, +{ + /// Set the `title` field (required) + pub fn title( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> SongBuilder<'a, song_state::SetTitle<S>> { + self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); + SongBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> SongBuilder<'a, S> +where + S: song_state::State, + S::Title: song_state::IsSet, + S::Composer: song_state::IsSet, + S::Game: song_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Song<'a> { + Song { + composer: self.__unsafe_private_named.0.unwrap(), + game: self.__unsafe_private_named.1.unwrap(), + genre: self.__unsafe_private_named.2, + jacket: self.__unsafe_private_named.3, + jacket_artist: self.__unsafe_private_named.4, + source: self.__unsafe_private_named.5, + subtitle: self.__unsafe_private_named.6, + title: self.__unsafe_private_named.7.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Song<'a> { + Song { + composer: self.__unsafe_private_named.0.unwrap(), + game: self.__unsafe_private_named.1.unwrap(), + genre: self.__unsafe_private_named.2, + jacket: self.__unsafe_private_named.3, + jacket_artist: self.__unsafe_private_named.4, + source: self.__unsafe_private_named.5, + subtitle: self.__unsafe_private_named.6, + title: self.__unsafe_private_named.7.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Song<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, SongRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct SongGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Song<'a>, +} + +impl From<SongGetRecordOutput<'_>> for Song<'_> { + fn from(output: SongGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Song<'_> { + const NSID: &'static str = "dev.tsunagite.song"; + type Record = SongRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct SongRecord; +impl jacquard_common::xrpc::XrpcResp for SongRecord { + const NSID: &'static str = "dev.tsunagite.song"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = SongGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for SongRecord { + const NSID: &'static str = "dev.tsunagite.song"; + type Record = SongRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Song<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.song" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_song() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_dev_tsunagite_song() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.tsunagite.song"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A song included in a game hosting leaderboards via Tsunagite.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("game"), + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_common::smol_str::SmolStr::new_static("composer") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "composer", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("game"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "The game(s) this song is included in.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "All URIs must point to records of type `dev.tsunagite.game`.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("genre"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("jacket"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "jacketArtist", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("source"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "subtitle", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_tsunagite/types.rs b/crates/jacquard-api/src/dev_tsunagite/types.rs new file mode 100644 index 00000000..163a9713 --- /dev/null +++ b/crates/jacquard-api/src/dev_tsunagite/types.rs @@ -0,0 +1,442 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.tsunagite.types +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A named value with a numeric index for sorting. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Indexable<'a> { + /// The internal ID for the value, limited to the RecordKey character set. + #[serde(borrow)] + pub id: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + /// The numeric index used for sorting. + pub index: i64, + /// The human-readable name of the value for displaying in UIs. + #[serde(borrow)] + pub name: jacquard_common::types::value::Data<'a>, +} + +pub mod indexable_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Id; + type Name; + type Index; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Id = Unset; + type Name = Unset; + type Index = Unset; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Id = Set<members::id>; + type Name = S::Name; + type Index = S::Index; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Id = S::Id; + type Name = Set<members::name>; + type Index = S::Index; + } + ///State transition - sets the `index` field to Set + pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndex<S> {} + impl<S: State> State for SetIndex<S> { + type Id = S::Id; + type Name = S::Name; + type Index = Set<members::index>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `index` field + pub struct index(()); + } +} + +/// Builder for constructing an instance of this type +pub struct IndexableBuilder<'a, S: indexable_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Indexable<'a> { + /// Create a new builder for this type + pub fn new() -> IndexableBuilder<'a, indexable_state::Empty> { + IndexableBuilder::new() + } +} + +impl<'a> IndexableBuilder<'a, indexable_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + IndexableBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> IndexableBuilder<'a, S> +where + S: indexable_state::State, + S::Id: indexable_state::IsUnset, +{ + /// Set the `id` field (required) + pub fn id( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> IndexableBuilder<'a, indexable_state::SetId<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + IndexableBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> IndexableBuilder<'a, S> +where + S: indexable_state::State, + S::Index: indexable_state::IsUnset, +{ + /// Set the `index` field (required) + pub fn index( + mut self, + value: impl Into<i64>, + ) -> IndexableBuilder<'a, indexable_state::SetIndex<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + IndexableBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> IndexableBuilder<'a, S> +where + S: indexable_state::State, + S::Name: indexable_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> IndexableBuilder<'a, indexable_state::SetName<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + IndexableBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> IndexableBuilder<'a, S> +where + S: indexable_state::State, + S::Id: indexable_state::IsSet, + S::Name: indexable_state::IsSet, + S::Index: indexable_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Indexable<'a> { + Indexable { + id: self.__unsafe_private_named.0.unwrap(), + index: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Indexable<'a> { + Indexable { + id: self.__unsafe_private_named.0.unwrap(), + index: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_dev_tsunagite_types() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.tsunagite.types"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("indexable"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A named value with a numeric index for sorting.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("index") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("id"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The internal ID for the value, limited to the RecordKey character set.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: Some(1usize), + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("index"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "dev.tsunagite.translatable", + ), + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("typedRef"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A typed record reference that does not require a CID hash.", + ), + ), + required: None, + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("ref"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The AT URI of the record this object references.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("type"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The type of the record this object references.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::RecordKey, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Indexable<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.types" + } + fn def_name() -> &'static str { + "indexable" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_types() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.id; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "id", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +/// A typed record reference that does not require a CID hash. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct TypedRef<'a> { + /// The AT URI of the record this object references. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub r#ref: std::option::Option<jacquard_common::types::string::AtUri<'a>>, + /// The type of the record this object references. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub r#type: std::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TypedRef<'a> { + fn nsid() -> &'static str { + "dev.tsunagite.types" + } + fn def_name() -> &'static str { + "typedRef" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_tsunagite_types() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_vielle.rs b/crates/jacquard-api/src/dev_vielle.rs new file mode 100644 index 00000000..92a591c3 --- /dev/null +++ b/crates/jacquard-api/src/dev_vielle.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod guestbook; \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_vielle/guestbook.rs b/crates/jacquard-api/src/dev_vielle/guestbook.rs new file mode 100644 index 00000000..591c9bbb --- /dev/null +++ b/crates/jacquard-api/src/dev_vielle/guestbook.rs @@ -0,0 +1,7 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod book; +pub mod entry; \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_vielle/guestbook/book.rs b/crates/jacquard-api/src/dev_vielle/guestbook/book.rs new file mode 100644 index 00000000..535ca130 --- /dev/null +++ b/crates/jacquard-api/src/dev_vielle/guestbook/book.rs @@ -0,0 +1,295 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.vielle.guestbook.book +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Book<'a> { + #[serde(borrow)] + pub site: jacquard_common::types::string::Uri<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub title: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod book_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Site; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Site = Unset; + } + ///State transition - sets the `site` field to Set + pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSite<S> {} + impl<S: State> State for SetSite<S> { + type Site = Set<members::site>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `site` field + pub struct site(()); + } +} + +/// Builder for constructing an instance of this type +pub struct BookBuilder<'a, S: book_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Book<'a> { + /// Create a new builder for this type + pub fn new() -> BookBuilder<'a, book_state::Empty> { + BookBuilder::new() + } +} + +impl<'a> BookBuilder<'a, book_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + BookBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> BookBuilder<'a, S> +where + S: book_state::State, + S::Site: book_state::IsUnset, +{ + /// Set the `site` field (required) + pub fn site( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> BookBuilder<'a, book_state::SetSite<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + BookBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: book_state::State> BookBuilder<'a, S> { + /// Set the `title` field (optional) + pub fn title( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `title` field to an Option value (optional) + pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> BookBuilder<'a, S> +where + S: book_state::State, + S::Site: book_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Book<'a> { + Book { + site: self.__unsafe_private_named.0.unwrap(), + title: self.__unsafe_private_named.1, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Book<'a> { + Book { + site: self.__unsafe_private_named.0.unwrap(), + title: self.__unsafe_private_named.1, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Book<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, BookRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct BookGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Book<'a>, +} + +impl From<BookGetRecordOutput<'_>> for Book<'_> { + fn from(output: BookGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Book<'_> { + const NSID: &'static str = "dev.vielle.guestbook.book"; + type Record = BookRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct BookRecord; +impl jacquard_common::xrpc::XrpcResp for BookRecord { + const NSID: &'static str = "dev.vielle.guestbook.book"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = BookGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for BookRecord { + const NSID: &'static str = "dev.vielle.guestbook.book"; + type Record = BookRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Book<'a> { + fn nsid() -> &'static str { + "dev.vielle.guestbook.book" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_vielle_guestbook_book() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_dev_vielle_guestbook_book() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.vielle.guestbook.book"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("nsid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("site") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("site"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/dev_vielle/guestbook/entry.rs b/crates/jacquard-api/src/dev_vielle/guestbook/entry.rs new file mode 100644 index 00000000..6802f179 --- /dev/null +++ b/crates/jacquard-api/src/dev_vielle/guestbook/entry.rs @@ -0,0 +1,313 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: dev.vielle.guestbook.entry +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Entry<'a> { + #[serde(borrow)] + pub book: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub contents: jacquard_common::CowStr<'a>, +} + +pub mod entry_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Book; + type Contents; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Book = Unset; + type Contents = Unset; + } + ///State transition - sets the `book` field to Set + pub struct SetBook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBook<S> {} + impl<S: State> State for SetBook<S> { + type Book = Set<members::book>; + type Contents = S::Contents; + } + ///State transition - sets the `contents` field to Set + pub struct SetContents<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContents<S> {} + impl<S: State> State for SetContents<S> { + type Book = S::Book; + type Contents = Set<members::contents>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `book` field + pub struct book(()); + ///Marker type for the `contents` field + pub struct contents(()); + } +} + +/// Builder for constructing an instance of this type +pub struct EntryBuilder<'a, S: entry_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Entry<'a> { + /// Create a new builder for this type + pub fn new() -> EntryBuilder<'a, entry_state::Empty> { + EntryBuilder::new() + } +} + +impl<'a> EntryBuilder<'a, entry_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + EntryBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EntryBuilder<'a, S> +where + S: entry_state::State, + S::Book: entry_state::IsUnset, +{ + /// Set the `book` field (required) + pub fn book( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> EntryBuilder<'a, entry_state::SetBook<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + EntryBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EntryBuilder<'a, S> +where + S: entry_state::State, + S::Contents: entry_state::IsUnset, +{ + /// Set the `contents` field (required) + pub fn contents( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> EntryBuilder<'a, entry_state::SetContents<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + EntryBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EntryBuilder<'a, S> +where + S: entry_state::State, + S::Book: entry_state::IsSet, + S::Contents: entry_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Entry<'a> { + Entry { + book: self.__unsafe_private_named.0.unwrap(), + contents: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Entry<'a> { + Entry { + book: self.__unsafe_private_named.0.unwrap(), + contents: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Entry<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, EntryRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct EntryGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Entry<'a>, +} + +impl From<EntryGetRecordOutput<'_>> for Entry<'_> { + fn from(output: EntryGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Entry<'_> { + const NSID: &'static str = "dev.vielle.guestbook.entry"; + type Record = EntryRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct EntryRecord; +impl jacquard_common::xrpc::XrpcResp for EntryRecord { + const NSID: &'static str = "dev.vielle.guestbook.entry"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = EntryGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for EntryRecord { + const NSID: &'static str = "dev.vielle.guestbook.entry"; + type Record = EntryRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entry<'a> { + fn nsid() -> &'static str { + "dev.vielle.guestbook.entry" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_dev_vielle_guestbook_entry() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_dev_vielle_guestbook_entry() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("dev.vielle.guestbook.entry"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("nsid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("book"), + ::jacquard_common::smol_str::SmolStr::new_static("contents") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("book"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "contents", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/events_smokesignal.rs b/crates/jacquard-api/src/events_smokesignal.rs index 3eb0a881..81c02594 100644 --- a/crates/jacquard-api/src/events_smokesignal.rs +++ b/crates/jacquard-api/src/events_smokesignal.rs @@ -3,4 +3,6 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. -pub mod automation; \ No newline at end of file +pub mod calendar; +pub mod lfg; +pub mod profile; \ No newline at end of file diff --git a/crates/jacquard-api/src/events_smokesignal/calendar.rs b/crates/jacquard-api/src/events_smokesignal/calendar.rs new file mode 100644 index 00000000..bd1ae84e --- /dev/null +++ b/crates/jacquard-api/src/events_smokesignal/calendar.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod acceptance; \ No newline at end of file diff --git a/crates/jacquard-api/src/events_smokesignal/calendar/acceptance.rs b/crates/jacquard-api/src/events_smokesignal/calendar/acceptance.rs new file mode 100644 index 00000000..ebf3daa9 --- /dev/null +++ b/crates/jacquard-api/src/events_smokesignal/calendar/acceptance.rs @@ -0,0 +1,268 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: events.smokesignal.calendar.acceptance +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A cryptographic proof record that contains RSVP acceptance data. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Acceptance<'a> { + /// The CID (Content Identifier) of the rsvp that this proof validates. + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, +} + +pub mod acceptance_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Cid; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Cid = Unset; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `cid` field + pub struct cid(()); + } +} + +/// Builder for constructing an instance of this type +pub struct AcceptanceBuilder<'a, S: acceptance_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Acceptance<'a> { + /// Create a new builder for this type + pub fn new() -> AcceptanceBuilder<'a, acceptance_state::Empty> { + AcceptanceBuilder::new() + } +} + +impl<'a> AcceptanceBuilder<'a, acceptance_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + AcceptanceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AcceptanceBuilder<'a, S> +where + S: acceptance_state::State, + S::Cid: acceptance_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> AcceptanceBuilder<'a, acceptance_state::SetCid<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + AcceptanceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AcceptanceBuilder<'a, S> +where + S: acceptance_state::State, + S::Cid: acceptance_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Acceptance<'a> { + Acceptance { + cid: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Acceptance<'a> { + Acceptance { + cid: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Acceptance<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, AcceptanceRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct AcceptanceGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Acceptance<'a>, +} + +impl From<AcceptanceGetRecordOutput<'_>> for Acceptance<'_> { + fn from(output: AcceptanceGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Acceptance<'_> { + const NSID: &'static str = "events.smokesignal.calendar.acceptance"; + type Record = AcceptanceRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct AcceptanceRecord; +impl jacquard_common::xrpc::XrpcResp for AcceptanceRecord { + const NSID: &'static str = "events.smokesignal.calendar.acceptance"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = AcceptanceGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for AcceptanceRecord { + const NSID: &'static str = "events.smokesignal.calendar.acceptance"; + type Record = AcceptanceRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Acceptance<'a> { + fn nsid() -> &'static str { + "events.smokesignal.calendar.acceptance" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_events_smokesignal_calendar_acceptance() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_events_smokesignal_calendar_acceptance() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "events.smokesignal.calendar.acceptance", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A cryptographic proof record that contains RSVP acceptance data.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("cid")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The CID (Content Identifier) of the rsvp that this proof validates.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/events_smokesignal/lfg.rs b/crates/jacquard-api/src/events_smokesignal/lfg.rs new file mode 100644 index 00000000..ae426e43 --- /dev/null +++ b/crates/jacquard-api/src/events_smokesignal/lfg.rs @@ -0,0 +1,594 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: events.smokesignal.lfg +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A Looking For Group record that broadcasts interest in finding activity partners within a geographic area. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Lfg<'a> { + /// Whether the LFG is currently active and visible to others. + pub active: bool, + /// Record creation timestamp. + pub created_at: jacquard_common::types::string::Datetime, + /// When the LFG expires and is no longer visible. + pub ends_at: jacquard_common::types::string::Datetime, + /// The geographic location for activity partner matching. + #[serde(borrow)] + pub location: jacquard_common::types::value::Data<'a>, + /// When the LFG becomes active. + pub starts_at: jacquard_common::types::string::Datetime, + /// Interest tags for matching with events and other users. + #[serde(borrow)] + pub tags: Vec<jacquard_common::CowStr<'a>>, +} + +pub mod lfg_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Tags; + type Active; + type Location; + type StartsAt; + type EndsAt; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Tags = Unset; + type Active = Unset; + type Location = Unset; + type StartsAt = Unset; + type EndsAt = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `tags` field to Set + pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTags<S> {} + impl<S: State> State for SetTags<S> { + type Tags = Set<members::tags>; + type Active = S::Active; + type Location = S::Location; + type StartsAt = S::StartsAt; + type EndsAt = S::EndsAt; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `active` field to Set + pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActive<S> {} + impl<S: State> State for SetActive<S> { + type Tags = S::Tags; + type Active = Set<members::active>; + type Location = S::Location; + type StartsAt = S::StartsAt; + type EndsAt = S::EndsAt; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `location` field to Set + pub struct SetLocation<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLocation<S> {} + impl<S: State> State for SetLocation<S> { + type Tags = S::Tags; + type Active = S::Active; + type Location = Set<members::location>; + type StartsAt = S::StartsAt; + type EndsAt = S::EndsAt; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `starts_at` field to Set + pub struct SetStartsAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStartsAt<S> {} + impl<S: State> State for SetStartsAt<S> { + type Tags = S::Tags; + type Active = S::Active; + type Location = S::Location; + type StartsAt = Set<members::starts_at>; + type EndsAt = S::EndsAt; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `ends_at` field to Set + pub struct SetEndsAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEndsAt<S> {} + impl<S: State> State for SetEndsAt<S> { + type Tags = S::Tags; + type Active = S::Active; + type Location = S::Location; + type StartsAt = S::StartsAt; + type EndsAt = Set<members::ends_at>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Tags = S::Tags; + type Active = S::Active; + type Location = S::Location; + type StartsAt = S::StartsAt; + type EndsAt = S::EndsAt; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `tags` field + pub struct tags(()); + ///Marker type for the `active` field + pub struct active(()); + ///Marker type for the `location` field + pub struct location(()); + ///Marker type for the `starts_at` field + pub struct starts_at(()); + ///Marker type for the `ends_at` field + pub struct ends_at(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct LfgBuilder<'a, S: lfg_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<bool>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Lfg<'a> { + /// Create a new builder for this type + pub fn new() -> LfgBuilder<'a, lfg_state::Empty> { + LfgBuilder::new() + } +} + +impl<'a> LfgBuilder<'a, lfg_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::Active: lfg_state::IsUnset, +{ + /// Set the `active` field (required) + pub fn active( + mut self, + value: impl Into<bool>, + ) -> LfgBuilder<'a, lfg_state::SetActive<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::CreatedAt: lfg_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> LfgBuilder<'a, lfg_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::EndsAt: lfg_state::IsUnset, +{ + /// Set the `endsAt` field (required) + pub fn ends_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> LfgBuilder<'a, lfg_state::SetEndsAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::Location: lfg_state::IsUnset, +{ + /// Set the `location` field (required) + pub fn location( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> LfgBuilder<'a, lfg_state::SetLocation<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::StartsAt: lfg_state::IsUnset, +{ + /// Set the `startsAt` field (required) + pub fn starts_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> LfgBuilder<'a, lfg_state::SetStartsAt<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::Tags: lfg_state::IsUnset, +{ + /// Set the `tags` field (required) + pub fn tags( + mut self, + value: impl Into<Vec<jacquard_common::CowStr<'a>>>, + ) -> LfgBuilder<'a, lfg_state::SetTags<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + LfgBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> LfgBuilder<'a, S> +where + S: lfg_state::State, + S::Tags: lfg_state::IsSet, + S::Active: lfg_state::IsSet, + S::Location: lfg_state::IsSet, + S::StartsAt: lfg_state::IsSet, + S::EndsAt: lfg_state::IsSet, + S::CreatedAt: lfg_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Lfg<'a> { + Lfg { + active: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + ends_at: self.__unsafe_private_named.2.unwrap(), + location: self.__unsafe_private_named.3.unwrap(), + starts_at: self.__unsafe_private_named.4.unwrap(), + tags: self.__unsafe_private_named.5.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Lfg<'a> { + Lfg { + active: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + ends_at: self.__unsafe_private_named.2.unwrap(), + location: self.__unsafe_private_named.3.unwrap(), + starts_at: self.__unsafe_private_named.4.unwrap(), + tags: self.__unsafe_private_named.5.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Lfg<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, LfgRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct LfgGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Lfg<'a>, +} + +impl From<LfgGetRecordOutput<'_>> for Lfg<'_> { + fn from(output: LfgGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Lfg<'_> { + const NSID: &'static str = "events.smokesignal.lfg"; + type Record = LfgRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct LfgRecord; +impl jacquard_common::xrpc::XrpcResp for LfgRecord { + const NSID: &'static str = "events.smokesignal.lfg"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = LfgGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for LfgRecord { + const NSID: &'static str = "events.smokesignal.lfg"; + type Record = LfgRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Lfg<'a> { + fn nsid() -> &'static str { + "events.smokesignal.lfg" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_events_smokesignal_lfg() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.tags; + #[allow(unused_comparisons)] + if value.len() > 10usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 10usize, + actual: value.len(), + }); + } + } + { + let value = &self.tags; + #[allow(unused_comparisons)] + if value.len() < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + min: 1usize, + actual: value.len(), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_events_smokesignal_lfg() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("events.smokesignal.lfg"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A Looking For Group record that broadcasts interest in finding activity partners within a geographic area.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("location"), + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_common::smol_str::SmolStr::new_static("startsAt"), + ::jacquard_common::smol_str::SmolStr::new_static("endsAt"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt"), + ::jacquard_common::smol_str::SmolStr::new_static("active") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("active"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Record creation timestamp.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("endsAt"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "When the LFG expires and is no longer visible.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "location", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "community.lexicon.location#geo", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "startsAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "When the LFG becomes active.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Interest tags for matching with events and other users.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: Some(64usize), + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: Some(1usize), + max_length: Some(10usize), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/events_smokesignal/profile.rs b/crates/jacquard-api/src/events_smokesignal/profile.rs new file mode 100644 index 00000000..e1bf3dd4 --- /dev/null +++ b/crates/jacquard-api/src/events_smokesignal/profile.rs @@ -0,0 +1,688 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: events.smokesignal.profile +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Indicates the identity is available for hire +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + Hash, + jacquard_derive::IntoStatic +)] +pub struct Forhire; +impl std::fmt::Display for Forhire { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "forhire") + } +} + +/// Indicates the identity is actively hiring +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + Hash, + jacquard_derive::IntoStatic +)] +pub struct Hiring; +impl std::fmt::Display for Hiring { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "hiring") + } +} + +/// A user profile for Smoke Signal +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Profile<'a> { + /// Small image to be displayed next to events. AKA, 'profile picture' + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub avatar: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// Larger horizontal image to display behind profile view. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub banner: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// A free text description of the identity. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// The display name of the identity. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub display_name: std::option::Option<jacquard_common::CowStr<'a>>, + /// Annotations of text (mentions, URLs, hashtags, etc) in the description. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub facets: std::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, + /// The format used for profile links + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub profile_host: std::option::Option<ProfileProfileHost<'a>>, +} + +pub mod profile_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed {} + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty {} + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members {} +} + +/// Builder for constructing an instance of this type +pub struct ProfileBuilder<'a, S: profile_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, + ::core::option::Option<ProfileProfileHost<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Profile<'a> { + /// Create a new builder for this type + pub fn new() -> ProfileBuilder<'a, profile_state::Empty> { + ProfileBuilder::new() + } +} + +impl<'a> ProfileBuilder<'a, profile_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `avatar` field (optional) + pub fn avatar( + mut self, + value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `avatar` field to an Option value (optional) + pub fn maybe_avatar( + mut self, + value: Option<jacquard_common::types::blob::BlobRef<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `banner` field (optional) + pub fn banner( + mut self, + value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `banner` field to an Option value (optional) + pub fn maybe_banner( + mut self, + value: Option<jacquard_common::types::blob::BlobRef<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `displayName` field (optional) + pub fn display_name( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `displayName` field to an Option value (optional) + pub fn maybe_display_name( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `facets` field (optional) + pub fn facets( + mut self, + value: impl Into<Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `facets` field to an Option value (optional) + pub fn maybe_facets( + mut self, + value: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `profileHost` field (optional) + pub fn profile_host( + mut self, + value: impl Into<Option<ProfileProfileHost<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `profileHost` field to an Option value (optional) + pub fn maybe_profile_host(mut self, value: Option<ProfileProfileHost<'a>>) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, +{ + /// Build the final struct + pub fn build(self) -> Profile<'a> { + Profile { + avatar: self.__unsafe_private_named.0, + banner: self.__unsafe_private_named.1, + description: self.__unsafe_private_named.2, + display_name: self.__unsafe_private_named.3, + facets: self.__unsafe_private_named.4, + profile_host: self.__unsafe_private_named.5, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Profile<'a> { + Profile { + avatar: self.__unsafe_private_named.0, + banner: self.__unsafe_private_named.1, + description: self.__unsafe_private_named.2, + display_name: self.__unsafe_private_named.3, + facets: self.__unsafe_private_named.4, + profile_host: self.__unsafe_private_named.5, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Profile<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ProfileRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// The format used for profile links +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ProfileProfileHost<'a> { + BskyApp, + BlackskyCommunity, + Aturi, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ProfileProfileHost<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::BskyApp => "bsky.app", + Self::BlackskyCommunity => "blacksky.community", + Self::Aturi => "aturi", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ProfileProfileHost<'a> { + fn from(s: &'a str) -> Self { + match s { + "bsky.app" => Self::BskyApp, + "blacksky.community" => Self::BlackskyCommunity, + "aturi" => Self::Aturi, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From<String> for ProfileProfileHost<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "bsky.app" => Self::BskyApp, + "blacksky.community" => Self::BlackskyCommunity, + "aturi" => Self::Aturi, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ProfileProfileHost<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef<str> for ProfileProfileHost<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ProfileProfileHost<'a> { + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ProfileProfileHost<'a> +where + 'de: 'a, +{ + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ProfileProfileHost<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ProfileProfileHost<'_> { + type Output = ProfileProfileHost<'static>; + fn into_static(self) -> Self::Output { + match self { + ProfileProfileHost::BskyApp => ProfileProfileHost::BskyApp, + ProfileProfileHost::BlackskyCommunity => { + ProfileProfileHost::BlackskyCommunity + } + ProfileProfileHost::Aturi => ProfileProfileHost::Aturi, + ProfileProfileHost::Other(v) => ProfileProfileHost::Other(v.into_static()), + } + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ProfileGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Profile<'a>, +} + +impl From<ProfileGetRecordOutput<'_>> for Profile<'_> { + fn from(output: ProfileGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Profile<'_> { + const NSID: &'static str = "events.smokesignal.profile"; + type Record = ProfileRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ProfileRecord; +impl jacquard_common::xrpc::XrpcResp for ProfileRecord { + const NSID: &'static str = "events.smokesignal.profile"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ProfileGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ProfileRecord { + const NSID: &'static str = "events.smokesignal.profile"; + type Record = ProfileRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { + fn nsid() -> &'static str { + "events.smokesignal.profile" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_events_smokesignal_profile() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 2000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 2000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 2000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 2000usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.display_name { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 200usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "display_name", + ), + max: 200usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.display_name { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 200usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "display_name", + ), + max: 200usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.profile_host { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 60usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "profile_host", + ), + max: 60usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.profile_host { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 60usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "profile_host", + ), + max: 60usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_events_smokesignal_profile() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("events.smokesignal.profile"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("forhire"), + ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { + description: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("hiring"), + ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { + description: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A user profile for Smoke Signal", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("literal:self")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: None, + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("avatar"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("banner"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "A free text description of the identity.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(2000usize), + min_graphemes: None, + max_graphemes: Some(2000usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "displayName", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The display name of the identity.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(200usize), + min_graphemes: None, + max_graphemes: Some(200usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("facets"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Annotations of text (mentions, URLs, hashtags, etc) in the description.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.richtext.facet", + ), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "profileHost", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The format used for profile links", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(60usize), + min_graphemes: None, + max_graphemes: Some(60usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/fm_teal/alpha/stats.rs b/crates/jacquard-api/src/fm_teal/alpha/stats.rs index edf7d27f..79884c8e 100644 --- a/crates/jacquard-api/src/fm_teal/alpha/stats.rs +++ b/crates/jacquard-api/src/fm_teal/alpha/stats.rs @@ -480,51 +480,51 @@ pub mod recording_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Mbid; type PlayCount; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Mbid = Unset; type PlayCount = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Mbid = S::Mbid; - type PlayCount = S::PlayCount; + type Name = Unset; } ///State transition - sets the `mbid` field to Set pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMbid<S> {} impl<S: State> State for SetMbid<S> { - type Name = S::Name; type Mbid = Set<members::mbid>; type PlayCount = S::PlayCount; + type Name = S::Name; } ///State transition - sets the `play_count` field to Set pub struct SetPlayCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPlayCount<S> {} impl<S: State> State for SetPlayCount<S> { - type Name = S::Name; type Mbid = S::Mbid; type PlayCount = Set<members::play_count>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Mbid = S::Mbid; + type PlayCount = S::PlayCount; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `mbid` field pub struct mbid(()); ///Marker type for the `play_count` field pub struct play_count(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -617,9 +617,9 @@ where impl<'a, S> RecordingViewBuilder<'a, S> where S: recording_view_state::State, - S::Name: recording_view_state::IsSet, S::Mbid: recording_view_state::IsSet, S::PlayCount: recording_view_state::IsSet, + S::Name: recording_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RecordingView<'a> { @@ -696,51 +696,51 @@ pub mod release_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Mbid; type Name; type PlayCount; - type Mbid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Mbid = Unset; type Name = Unset; type PlayCount = Unset; - type Mbid = Unset; + } + ///State transition - sets the `mbid` field to Set + pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMbid<S> {} + impl<S: State> State for SetMbid<S> { + type Mbid = Set<members::mbid>; + type Name = S::Name; + type PlayCount = S::PlayCount; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type Mbid = S::Mbid; type Name = Set<members::name>; type PlayCount = S::PlayCount; - type Mbid = S::Mbid; } ///State transition - sets the `play_count` field to Set pub struct SetPlayCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPlayCount<S> {} impl<S: State> State for SetPlayCount<S> { - type Name = S::Name; - type PlayCount = Set<members::play_count>; type Mbid = S::Mbid; - } - ///State transition - sets the `mbid` field to Set - pub struct SetMbid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMbid<S> {} - impl<S: State> State for SetMbid<S> { type Name = S::Name; - type PlayCount = S::PlayCount; - type Mbid = Set<members::mbid>; + type PlayCount = Set<members::play_count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `mbid` field + pub struct mbid(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `play_count` field pub struct play_count(()); - ///Marker type for the `mbid` field - pub struct mbid(()); } } @@ -833,9 +833,9 @@ where impl<'a, S> ReleaseViewBuilder<'a, S> where S: release_view_state::State, + S::Mbid: release_view_state::IsSet, S::Name: release_view_state::IsSet, S::PlayCount: release_view_state::IsSet, - S::Mbid: release_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ReleaseView<'a> { diff --git a/crates/jacquard-api/src/fyi_frontpage/feed/comment.rs b/crates/jacquard-api/src/fyi_frontpage/feed/comment.rs index 24d328dc..d1f63f02 100644 --- a/crates/jacquard-api/src/fyi_frontpage/feed/comment.rs +++ b/crates/jacquard-api/src/fyi_frontpage/feed/comment.rs @@ -40,49 +40,49 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Blocks; type CreatedAt; + type Blocks; type Post; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Blocks = Unset; type CreatedAt = Unset; + type Blocks = Unset; type Post = Unset; } - ///State transition - sets the `blocks` field to Set - pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlocks<S> {} - impl<S: State> State for SetBlocks<S> { - type Blocks = Set<members::blocks>; - type CreatedAt = S::CreatedAt; - type Post = S::Post; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Blocks = S::Blocks; type CreatedAt = Set<members::created_at>; + type Blocks = S::Blocks; + type Post = S::Post; + } + ///State transition - sets the `blocks` field to Set + pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlocks<S> {} + impl<S: State> State for SetBlocks<S> { + type CreatedAt = S::CreatedAt; + type Blocks = Set<members::blocks>; type Post = S::Post; } ///State transition - sets the `post` field to Set pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPost<S> {} impl<S: State> State for SetPost<S> { - type Blocks = S::Blocks; type CreatedAt = S::CreatedAt; + type Blocks = S::Blocks; type Post = Set<members::post>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `blocks` field - pub struct blocks(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `blocks` field + pub struct blocks(()); ///Marker type for the `post` field pub struct post(()); } @@ -197,8 +197,8 @@ where impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::Blocks: comment_state::IsSet, S::CreatedAt: comment_state::IsSet, + S::Blocks: comment_state::IsSet, S::Post: comment_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/fyi_frontpage/feed/post.rs b/crates/jacquard-api/src/fyi_frontpage/feed/post.rs index e81c7080..b5e79493 100644 --- a/crates/jacquard-api/src/fyi_frontpage/feed/post.rs +++ b/crates/jacquard-api/src/fyi_frontpage/feed/post.rs @@ -39,50 +39,50 @@ pub mod post_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Subject; - type Title; type CreatedAt; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Subject = Unset; - type Title = Unset; type CreatedAt = Unset; + type Title = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { type Subject = Set<members::subject>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Subject = S::Subject; - type Title = Set<members::title>; type CreatedAt = S::CreatedAt; + type Title = S::Title; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Subject = S::Subject; - type Title = S::Title; type CreatedAt = Set<members::created_at>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Subject = S::Subject; + type CreatedAt = S::CreatedAt; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subject` field pub struct subject(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -176,8 +176,8 @@ impl<'a, S> PostBuilder<'a, S> where S: post_state::State, S::Subject: post_state::IsSet, - S::Title: post_state::IsSet, S::CreatedAt: post_state::IsSet, + S::Title: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/fyi_questionable/actor/profile.rs b/crates/jacquard-api/src/fyi_questionable/actor/profile.rs index e3fdaee9..cf9d5eee 100644 --- a/crates/jacquard-api/src/fyi_questionable/actor/profile.rs +++ b/crates/jacquard-api/src/fyi_questionable/actor/profile.rs @@ -22,6 +22,9 @@ pub struct Profile<'a> { pub created_at: std::option::Option<jacquard_common::types::string::Datetime>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] pub display_name: std::option::Option<jacquard_common::CowStr<'a>>, } @@ -50,6 +53,7 @@ pub struct ProfileBuilder<'a, S: profile_state::State> { __unsafe_private_named: ( ::core::option::Option<jacquard_common::types::string::Datetime>, ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } @@ -66,7 +70,7 @@ impl<'a> ProfileBuilder<'a, profile_state::Empty> { pub fn new() -> Self { ProfileBuilder { _phantom_state: ::core::marker::PhantomData, - __unsafe_private_named: (None, None), + __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } @@ -91,13 +95,32 @@ impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { } } +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { /// Set the `displayName` field (optional) pub fn display_name( mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>, ) -> Self { - self.__unsafe_private_named.1 = value.into(); + self.__unsafe_private_named.2 = value.into(); self } /// Set the `displayName` field to an Option value (optional) @@ -105,7 +128,7 @@ impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { mut self, value: Option<jacquard_common::CowStr<'a>>, ) -> Self { - self.__unsafe_private_named.1 = value; + self.__unsafe_private_named.2 = value; self } } @@ -118,7 +141,8 @@ where pub fn build(self) -> Profile<'a> { Profile { created_at: self.__unsafe_private_named.0, - display_name: self.__unsafe_private_named.1, + description: self.__unsafe_private_named.1, + display_name: self.__unsafe_private_named.2, extra_data: Default::default(), } } @@ -132,7 +156,8 @@ where ) -> Profile<'a> { Profile { created_at: self.__unsafe_private_named.0, - display_name: self.__unsafe_private_named.1, + description: self.__unsafe_private_named.1, + display_name: self.__unsafe_private_named.2, extra_data: Some(extra_data), } } @@ -212,6 +237,36 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 2560usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 2560usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 256usize, + actual: count, + }); + } + } + } if let Some(ref value) = self.display_name { #[allow(unused_comparisons)] if <str>::len(value.as_ref()) > 640usize { @@ -291,6 +346,23 @@ fn lexicon_doc_fyi_questionable_actor_profile() -> ::jacquard_lexicon::lexicon:: known_values: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(2560usize), + min_graphemes: None, + max_graphemes: Some(256usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "displayName", diff --git a/crates/jacquard-api/src/fyi_questionable/question.rs b/crates/jacquard-api/src/fyi_questionable/question.rs index 6f59ec73..b27a6f57 100644 --- a/crates/jacquard-api/src/fyi_questionable/question.rs +++ b/crates/jacquard-api/src/fyi_questionable/question.rs @@ -51,51 +51,51 @@ pub mod question_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Text; type CreatedAt; type Summary; - type Text; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Text = Unset; type CreatedAt = Unset; type Summary = Unset; - type Text = Unset; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type Text = Set<members::text>; + type CreatedAt = S::CreatedAt; + type Summary = S::Summary; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Text = S::Text; type CreatedAt = Set<members::created_at>; type Summary = S::Summary; - type Text = S::Text; } ///State transition - sets the `summary` field to Set pub struct SetSummary<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSummary<S> {} impl<S: State> State for SetSummary<S> { - type CreatedAt = S::CreatedAt; - type Summary = Set<members::summary>; type Text = S::Text; - } - ///State transition - sets the `text` field to Set - pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetText<S> {} - impl<S: State> State for SetText<S> { type CreatedAt = S::CreatedAt; - type Summary = S::Summary; - type Text = Set<members::text>; + type Summary = Set<members::summary>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `text` field + pub struct text(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `summary` field pub struct summary(()); - ///Marker type for the `text` field - pub struct text(()); } } @@ -250,9 +250,9 @@ where impl<'a, S> QuestionBuilder<'a, S> where S: question_state::State, + S::Text: question_state::IsSet, S::CreatedAt: question_state::IsSet, S::Summary: question_state::IsSet, - S::Text: question_state::IsSet, { /// Build the final struct pub fn build(self) -> Question<'a> { diff --git a/crates/jacquard-api/src/fyi_unravel/frontpage/comment.rs b/crates/jacquard-api/src/fyi_unravel/frontpage/comment.rs index 9b52c13e..2871e50d 100644 --- a/crates/jacquard-api/src/fyi_unravel/frontpage/comment.rs +++ b/crates/jacquard-api/src/fyi_unravel/frontpage/comment.rs @@ -41,50 +41,50 @@ pub mod comment_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Post; - type Content; type CreatedAt; + type Content; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Post = Unset; - type Content = Unset; type CreatedAt = Unset; + type Content = Unset; } ///State transition - sets the `post` field to Set pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPost<S> {} impl<S: State> State for SetPost<S> { type Post = Set<members::post>; - type Content = S::Content; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type Post = S::Post; - type Content = Set<members::content>; type CreatedAt = S::CreatedAt; + type Content = S::Content; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Post = S::Post; - type Content = S::Content; type CreatedAt = Set<members::created_at>; + type Content = S::Content; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Post = S::Post; + type CreatedAt = S::CreatedAt; + type Content = Set<members::content>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `post` field pub struct post(()); - ///Marker type for the `content` field - pub struct content(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `content` field + pub struct content(()); } } @@ -198,8 +198,8 @@ impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, S::Post: comment_state::IsSet, - S::Content: comment_state::IsSet, S::CreatedAt: comment_state::IsSet, + S::Content: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { diff --git a/crates/jacquard-api/src/fyi_unravel/frontpage/post.rs b/crates/jacquard-api/src/fyi_unravel/frontpage/post.rs index 0917ceac..7dbe2052 100644 --- a/crates/jacquard-api/src/fyi_unravel/frontpage/post.rs +++ b/crates/jacquard-api/src/fyi_unravel/frontpage/post.rs @@ -38,51 +38,51 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Title; type Url; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Title = Unset; type Url = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Title = S::Title; - type Url = S::Url; + type CreatedAt = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type CreatedAt = S::CreatedAt; type Title = Set<members::title>; type Url = S::Url; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type CreatedAt = S::CreatedAt; type Title = S::Title; type Url = Set<members::url>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Title = S::Title; + type Url = S::Url; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::CreatedAt: post_state::IsSet, S::Title: post_state::IsSet, S::Url: post_state::IsSet, + S::CreatedAt: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/fyi_unravel/frontpage/vote.rs b/crates/jacquard-api/src/fyi_unravel/frontpage/vote.rs index 76fed3a8..e8a5449e 100644 --- a/crates/jacquard-api/src/fyi_unravel/frontpage/vote.rs +++ b/crates/jacquard-api/src/fyi_unravel/frontpage/vote.rs @@ -34,37 +34,37 @@ pub mod vote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> VoteBuilder<'a, S> where S: vote_state::State, - S::CreatedAt: vote_state::IsSet, S::Subject: vote_state::IsSet, + S::CreatedAt: vote_state::IsSet, { /// Build the final struct pub fn build(self) -> Vote<'a> { diff --git a/crates/jacquard-api/src/games_firehose/barklesheep/place_sheeps.rs b/crates/jacquard-api/src/games_firehose/barklesheep/place_sheeps.rs index 3f3484e2..7b4d3432 100644 --- a/crates/jacquard-api/src/games_firehose/barklesheep/place_sheeps.rs +++ b/crates/jacquard-api/src/games_firehose/barklesheep/place_sheeps.rs @@ -244,49 +244,49 @@ pub mod sheep_placement_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Type; type Start; + type Type; type Horizontal; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Type = Unset; type Start = Unset; + type Type = Unset; type Horizontal = Unset; } - ///State transition - sets the `type` field to Set - pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetType<S> {} - impl<S: State> State for SetType<S> { - type Type = Set<members::r#type>; - type Start = S::Start; - type Horizontal = S::Horizontal; - } ///State transition - sets the `start` field to Set pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStart<S> {} impl<S: State> State for SetStart<S> { - type Type = S::Type; type Start = Set<members::start>; + type Type = S::Type; + type Horizontal = S::Horizontal; + } + ///State transition - sets the `type` field to Set + pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetType<S> {} + impl<S: State> State for SetType<S> { + type Start = S::Start; + type Type = Set<members::r#type>; type Horizontal = S::Horizontal; } ///State transition - sets the `horizontal` field to Set pub struct SetHorizontal<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHorizontal<S> {} impl<S: State> State for SetHorizontal<S> { - type Type = S::Type; type Start = S::Start; + type Type = S::Type; type Horizontal = Set<members::horizontal>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `type` field - pub struct r#type(()); ///Marker type for the `start` field pub struct start(()); + ///Marker type for the `type` field + pub struct r#type(()); ///Marker type for the `horizontal` field pub struct horizontal(()); } @@ -381,8 +381,8 @@ where impl<'a, S> SheepPlacementBuilder<'a, S> where S: sheep_placement_state::State, - S::Type: sheep_placement_state::IsSet, S::Start: sheep_placement_state::IsSet, + S::Type: sheep_placement_state::IsSet, S::Horizontal: sheep_placement_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/garden_lexicon.rs b/crates/jacquard-api/src/garden_lexicon.rs index 9f9a3ae0..ec663cea 100644 --- a/crates/jacquard-api/src/garden_lexicon.rs +++ b/crates/jacquard-api/src/garden_lexicon.rs @@ -3,4 +3,11 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. -pub mod ngerakines; \ No newline at end of file +pub mod conquering_wolfhound; +pub mod example; +pub mod joyous_grackle; +pub mod lawyerlike_deangelo; +pub mod ngerakines; +pub mod service; +pub mod stunning_leafcutter; +pub mod unconquered_modesto; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound.rs b/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound/example.rs b/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound/example.rs new file mode 100644 index 00000000..6865258c --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/conquering_wolfhound/example.rs @@ -0,0 +1,135 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.conquering-wolfhound.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// The Conquering Wolfhound!!!!!! +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> {} +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.conquering-wolfhound.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.conquering-wolfhound.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.conquering-wolfhound.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.conquering-wolfhound.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_conquering_wolfhound_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_conquering_wolfhound_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "garden.lexicon.conquering-wolfhound.example", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "The Conquering Wolfhound!!!!!!", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some(vec![]), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/example.rs b/crates/jacquard-api/src/garden_lexicon/example.rs new file mode 100644 index 00000000..53903bb0 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/example.rs @@ -0,0 +1,423 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An example value for a lexicon schema +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> { + /// The user-supplied date and time the example was created. + pub created_at: jacquard_common::types::string::Datetime, + /// A description of the example. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// The NSID that the example is of. + #[serde(borrow)] + pub lexicon: jacquard_common::types::string::Nsid<'a>, + /// The example itself. + #[serde(borrow)] + pub value: jacquard_common::types::value::Data<'a>, +} + +pub mod example_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Lexicon; + type Value; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Lexicon = Unset; + type Value = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `lexicon` field to Set + pub struct SetLexicon<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLexicon<S> {} + impl<S: State> State for SetLexicon<S> { + type Lexicon = Set<members::lexicon>; + type Value = S::Value; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `value` field to Set + pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValue<S> {} + impl<S: State> State for SetValue<S> { + type Lexicon = S::Lexicon; + type Value = Set<members::value>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Lexicon = S::Lexicon; + type Value = S::Value; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `lexicon` field + pub struct lexicon(()); + ///Marker type for the `value` field + pub struct value(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ExampleBuilder<'a, S: example_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Nsid<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Example<'a> { + /// Create a new builder for this type + pub fn new() -> ExampleBuilder<'a, example_state::Empty> { + ExampleBuilder::new() + } +} + +impl<'a> ExampleBuilder<'a, example_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::CreatedAt: example_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ExampleBuilder<'a, example_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: example_state::State> ExampleBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Lexicon: example_state::IsUnset, +{ + /// Set the `lexicon` field (required) + pub fn lexicon( + mut self, + value: impl Into<jacquard_common::types::string::Nsid<'a>>, + ) -> ExampleBuilder<'a, example_state::SetLexicon<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Value: example_state::IsUnset, +{ + /// Set the `value` field (required) + pub fn value( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> ExampleBuilder<'a, example_state::SetValue<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Lexicon: example_state::IsSet, + S::Value: example_state::IsSet, + S::CreatedAt: example_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Example<'a> { + Example { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + lexicon: self.__unsafe_private_named.2.unwrap(), + value: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Example<'a> { + Example { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + lexicon: self.__unsafe_private_named.2.unwrap(), + value: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("garden.lexicon.example"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "An example value for a lexicon schema", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("lexicon"), + ::jacquard_common::smol_str::SmolStr::new_static("value"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The user-supplied date and time the example was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "A description of the example.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("lexicon"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The NSID that the example is of.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Nsid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("value"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { + description: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/joyous_grackle.rs b/crates/jacquard-api/src/garden_lexicon/joyous_grackle.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/joyous_grackle.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/joyous_grackle/example.rs b/crates/jacquard-api/src/garden_lexicon/joyous_grackle/example.rs new file mode 100644 index 00000000..4df68dcd --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/joyous_grackle/example.rs @@ -0,0 +1,133 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.joyous-grackle.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// My lexicon description +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> {} +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.joyous-grackle.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.joyous-grackle.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.joyous-grackle.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.joyous-grackle.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_joyous_grackle_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_joyous_grackle_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "garden.lexicon.joyous-grackle.example", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("My lexicon description"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some(vec![]), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo.rs b/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo/example.rs b/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo/example.rs new file mode 100644 index 00000000..5c19af5d --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/lawyerlike_deangelo/example.rs @@ -0,0 +1,133 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.lawyerlike-deangelo.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// My lexicon description +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> {} +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.lawyerlike-deangelo.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.lawyerlike-deangelo.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.lawyerlike-deangelo.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.lawyerlike-deangelo.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_lawyerlike_deangelo_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_lawyerlike_deangelo_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "garden.lexicon.lawyerlike-deangelo.example", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("My lexicon description"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some(vec![]), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/service.rs b/crates/jacquard-api/src/garden_lexicon/service.rs new file mode 100644 index 00000000..619d9394 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/service.rs @@ -0,0 +1,835 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.service +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Declares XRPC methods available on a DID document service. The rkey is the service fragment ID without the # prefix (e.g., 'atproto_pds' for '#atproto_pds'). +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Service<'a> { + /// Description of what this service provides. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// Methods available on this service. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub methods: std::option::Option<Vec<crate::garden_lexicon::service::Method<'a>>>, + /// The type of service being declared. + #[serde(borrow)] + pub service_type: jacquard_common::CowStr<'a>, + /// URL templates for constructing web URLs from AT-URIs or record data. Useful for linking to web views of records. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub url_templates: std::option::Option< + Vec<crate::garden_lexicon::service::UrlTemplate<'a>>, + >, +} + +pub mod service_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type ServiceType; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type ServiceType = Unset; + } + ///State transition - sets the `service_type` field to Set + pub struct SetServiceType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetServiceType<S> {} + impl<S: State> State for SetServiceType<S> { + type ServiceType = Set<members::service_type>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `service_type` field + pub struct service_type(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ServiceBuilder<'a, S: service_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<Vec<crate::garden_lexicon::service::Method<'a>>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<Vec<crate::garden_lexicon::service::UrlTemplate<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Service<'a> { + /// Create a new builder for this type + pub fn new() -> ServiceBuilder<'a, service_state::Empty> { + ServiceBuilder::new() + } +} + +impl<'a> ServiceBuilder<'a, service_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ServiceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: service_state::State> ServiceBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: service_state::State> ServiceBuilder<'a, S> { + /// Set the `methods` field (optional) + pub fn methods( + mut self, + value: impl Into<Option<Vec<crate::garden_lexicon::service::Method<'a>>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `methods` field to an Option value (optional) + pub fn maybe_methods( + mut self, + value: Option<Vec<crate::garden_lexicon::service::Method<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> ServiceBuilder<'a, S> +where + S: service_state::State, + S::ServiceType: service_state::IsUnset, +{ + /// Set the `serviceType` field (required) + pub fn service_type( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ServiceBuilder<'a, service_state::SetServiceType<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + ServiceBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: service_state::State> ServiceBuilder<'a, S> { + /// Set the `urlTemplates` field (optional) + pub fn url_templates( + mut self, + value: impl Into<Option<Vec<crate::garden_lexicon::service::UrlTemplate<'a>>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `urlTemplates` field to an Option value (optional) + pub fn maybe_url_templates( + mut self, + value: Option<Vec<crate::garden_lexicon::service::UrlTemplate<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> ServiceBuilder<'a, S> +where + S: service_state::State, + S::ServiceType: service_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Service<'a> { + Service { + description: self.__unsafe_private_named.0, + methods: self.__unsafe_private_named.1, + service_type: self.__unsafe_private_named.2.unwrap(), + url_templates: self.__unsafe_private_named.3, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Service<'a> { + Service { + description: self.__unsafe_private_named.0, + methods: self.__unsafe_private_named.1, + service_type: self.__unsafe_private_named.2.unwrap(), + url_templates: self.__unsafe_private_named.3, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Service<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ServiceRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ServiceGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Service<'a>, +} + +impl From<ServiceGetRecordOutput<'_>> for Service<'_> { + fn from(output: ServiceGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Service<'_> { + const NSID: &'static str = "garden.lexicon.service"; + type Record = ServiceRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ServiceRecord; +impl jacquard_common::xrpc::XrpcResp for ServiceRecord { + const NSID: &'static str = "garden.lexicon.service"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ServiceGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ServiceRecord { + const NSID: &'static str = "garden.lexicon.service"; + type Record = ServiceRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Service<'a> { + fn nsid() -> &'static str { + "garden.lexicon.service" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_service() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.service_type; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "service_type", + ), + max: 100usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_service() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("garden.lexicon.service"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Declares XRPC methods available on a DID document service. The rkey is the service fragment ID without the # prefix (e.g., 'atproto_pds' for '#atproto_pds').", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("serviceType") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of what this service provides.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("methods"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Methods available on this service.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#method"), + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "serviceType", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The type of service being declared.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "urlTemplates", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "URL templates for constructing web URLs from AT-URIs or record data. Useful for linking to web views of records.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#urlTemplate"), + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("method"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("lexicon")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "authMethods", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Authentication methods supported by this method.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(50usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "deprecated", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("lexicon"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI pointing to a lexicon schema that defines this method.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("urlTemplate"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("url")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "collections", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "NSIDs of collections this URL template applies to.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Nsid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of what this URL template is for.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "URI template with placeholders for record data", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(2000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Method<'a> { + /// Authentication methods supported by this method. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub auth_methods: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Whether this method is deprecated and should no longer be used. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub deprecated: std::option::Option<bool>, + /// AT-URI pointing to a lexicon schema that defines this method. + #[serde(borrow)] + pub lexicon: jacquard_common::types::string::AtUri<'a>, +} + +pub mod method_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Lexicon; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Lexicon = Unset; + } + ///State transition - sets the `lexicon` field to Set + pub struct SetLexicon<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLexicon<S> {} + impl<S: State> State for SetLexicon<S> { + type Lexicon = Set<members::lexicon>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `lexicon` field + pub struct lexicon(()); + } +} + +/// Builder for constructing an instance of this type +pub struct MethodBuilder<'a, S: method_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<bool>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Method<'a> { + /// Create a new builder for this type + pub fn new() -> MethodBuilder<'a, method_state::Empty> { + MethodBuilder::new() + } +} + +impl<'a> MethodBuilder<'a, method_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + MethodBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: method_state::State> MethodBuilder<'a, S> { + /// Set the `authMethods` field (optional) + pub fn auth_methods( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `authMethods` field to an Option value (optional) + pub fn maybe_auth_methods( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: method_state::State> MethodBuilder<'a, S> { + /// Set the `deprecated` field (optional) + pub fn deprecated(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `deprecated` field to an Option value (optional) + pub fn maybe_deprecated(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> MethodBuilder<'a, S> +where + S: method_state::State, + S::Lexicon: method_state::IsUnset, +{ + /// Set the `lexicon` field (required) + pub fn lexicon( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> MethodBuilder<'a, method_state::SetLexicon<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + MethodBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> MethodBuilder<'a, S> +where + S: method_state::State, + S::Lexicon: method_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Method<'a> { + Method { + auth_methods: self.__unsafe_private_named.0, + deprecated: self.__unsafe_private_named.1, + lexicon: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Method<'a> { + Method { + auth_methods: self.__unsafe_private_named.0, + deprecated: self.__unsafe_private_named.1, + lexicon: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Method<'a> { + fn nsid() -> &'static str { + "garden.lexicon.service" + } + fn def_name() -> &'static str { + "method" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_service() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct UrlTemplate<'a> { + /// NSIDs of collections this URL template applies to. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub collections: std::option::Option<Vec<jacquard_common::types::string::Nsid<'a>>>, + /// Description of what this URL template is for. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// URI template with placeholders for record data + #[serde(borrow)] + pub url: jacquard_common::CowStr<'a>, +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for UrlTemplate<'a> { + fn nsid() -> &'static str { + "garden.lexicon.service" + } + fn def_name() -> &'static str { + "urlTemplate" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_service() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.url; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 2000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "url", + ), + max: 2000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter.rs b/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter/example.rs b/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter/example.rs new file mode 100644 index 00000000..414839dd --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/stunning_leafcutter/example.rs @@ -0,0 +1,133 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.stunning-leafcutter.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// My lexicon description +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> {} +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.stunning-leafcutter.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.stunning-leafcutter.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.stunning-leafcutter.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.stunning-leafcutter.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_stunning_leafcutter_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_stunning_leafcutter_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "garden.lexicon.stunning-leafcutter.example", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("My lexicon description"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some(vec![]), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/unconquered_modesto.rs b/crates/jacquard-api/src/garden_lexicon/unconquered_modesto.rs new file mode 100644 index 00000000..908d8db3 --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/unconquered_modesto.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod example; \ No newline at end of file diff --git a/crates/jacquard-api/src/garden_lexicon/unconquered_modesto/example.rs b/crates/jacquard-api/src/garden_lexicon/unconquered_modesto/example.rs new file mode 100644 index 00000000..e1e6208a --- /dev/null +++ b/crates/jacquard-api/src/garden_lexicon/unconquered_modesto/example.rs @@ -0,0 +1,261 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: garden.lexicon.unconquered-modesto.example +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// My lexicon description +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Example<'a> { + #[serde(borrow)] + pub message2: jacquard_common::CowStr<'a>, +} + +pub mod example_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Message2; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Message2 = Unset; + } + ///State transition - sets the `message2` field to Set + pub struct SetMessage2<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage2<S> {} + impl<S: State> State for SetMessage2<S> { + type Message2 = Set<members::message2>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `message2` field + pub struct message2(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ExampleBuilder<'a, S: example_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: (::core::option::Option<jacquard_common::CowStr<'a>>,), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Example<'a> { + /// Create a new builder for this type + pub fn new() -> ExampleBuilder<'a, example_state::Empty> { + ExampleBuilder::new() + } +} + +impl<'a> ExampleBuilder<'a, example_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Message2: example_state::IsUnset, +{ + /// Set the `message2` field (required) + pub fn message2( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ExampleBuilder<'a, example_state::SetMessage2<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ExampleBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ExampleBuilder<'a, S> +where + S: example_state::State, + S::Message2: example_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Example<'a> { + Example { + message2: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Example<'a> { + Example { + message2: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Example<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExampleRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExampleGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Example<'a>, +} + +impl From<ExampleGetRecordOutput<'_>> for Example<'_> { + fn from(output: ExampleGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Example<'_> { + const NSID: &'static str = "garden.lexicon.unconquered-modesto.example"; + type Record = ExampleRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExampleRecord; +impl jacquard_common::xrpc::XrpcResp for ExampleRecord { + const NSID: &'static str = "garden.lexicon.unconquered-modesto.example"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExampleGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExampleRecord { + const NSID: &'static str = "garden.lexicon.unconquered-modesto.example"; + type Record = ExampleRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Example<'a> { + fn nsid() -> &'static str { + "garden.lexicon.unconquered-modesto.example" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_garden_lexicon_unconquered_modesto_example() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_garden_lexicon_unconquered_modesto_example() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "garden.lexicon.unconquered-modesto.example", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("My lexicon description"), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("message2") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "message2", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/io_atcr/hold.rs b/crates/jacquard-api/src/io_atcr/hold.rs index a9a5e004..969296fe 100644 --- a/crates/jacquard-api/src/io_atcr/hold.rs +++ b/crates/jacquard-api/src/io_atcr/hold.rs @@ -5,4 +5,5 @@ pub mod captain; pub mod crew; -pub mod layer; \ No newline at end of file +pub mod layer; +pub mod stats; \ No newline at end of file diff --git a/crates/jacquard-api/src/io_atcr/hold/captain.rs b/crates/jacquard-api/src/io_atcr/hold/captain.rs index e384c727..d373e1d5 100644 --- a/crates/jacquard-api/src/io_atcr/hold/captain.rs +++ b/crates/jacquard-api/src/io_atcr/hold/captain.rs @@ -49,85 +49,85 @@ pub mod captain_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Public; - type DeployedAt; - type AllowAllCrew; type Owner; type EnableBlueskyPosts; + type Public; + type AllowAllCrew; + type DeployedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Public = Unset; - type DeployedAt = Unset; - type AllowAllCrew = Unset; type Owner = Unset; type EnableBlueskyPosts = Unset; + type Public = Unset; + type AllowAllCrew = Unset; + type DeployedAt = Unset; + } + ///State transition - sets the `owner` field to Set + pub struct SetOwner<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOwner<S> {} + impl<S: State> State for SetOwner<S> { + type Owner = Set<members::owner>; + type EnableBlueskyPosts = S::EnableBlueskyPosts; + type Public = S::Public; + type AllowAllCrew = S::AllowAllCrew; + type DeployedAt = S::DeployedAt; + } + ///State transition - sets the `enable_bluesky_posts` field to Set + pub struct SetEnableBlueskyPosts<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEnableBlueskyPosts<S> {} + impl<S: State> State for SetEnableBlueskyPosts<S> { + type Owner = S::Owner; + type EnableBlueskyPosts = Set<members::enable_bluesky_posts>; + type Public = S::Public; + type AllowAllCrew = S::AllowAllCrew; + type DeployedAt = S::DeployedAt; } ///State transition - sets the `public` field to Set pub struct SetPublic<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPublic<S> {} impl<S: State> State for SetPublic<S> { - type Public = Set<members::public>; - type DeployedAt = S::DeployedAt; - type AllowAllCrew = S::AllowAllCrew; type Owner = S::Owner; type EnableBlueskyPosts = S::EnableBlueskyPosts; - } - ///State transition - sets the `deployed_at` field to Set - pub struct SetDeployedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDeployedAt<S> {} - impl<S: State> State for SetDeployedAt<S> { - type Public = S::Public; - type DeployedAt = Set<members::deployed_at>; + type Public = Set<members::public>; type AllowAllCrew = S::AllowAllCrew; - type Owner = S::Owner; - type EnableBlueskyPosts = S::EnableBlueskyPosts; + type DeployedAt = S::DeployedAt; } ///State transition - sets the `allow_all_crew` field to Set pub struct SetAllowAllCrew<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAllowAllCrew<S> {} impl<S: State> State for SetAllowAllCrew<S> { - type Public = S::Public; - type DeployedAt = S::DeployedAt; - type AllowAllCrew = Set<members::allow_all_crew>; type Owner = S::Owner; type EnableBlueskyPosts = S::EnableBlueskyPosts; - } - ///State transition - sets the `owner` field to Set - pub struct SetOwner<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetOwner<S> {} - impl<S: State> State for SetOwner<S> { type Public = S::Public; + type AllowAllCrew = Set<members::allow_all_crew>; type DeployedAt = S::DeployedAt; - type AllowAllCrew = S::AllowAllCrew; - type Owner = Set<members::owner>; - type EnableBlueskyPosts = S::EnableBlueskyPosts; } - ///State transition - sets the `enable_bluesky_posts` field to Set - pub struct SetEnableBlueskyPosts<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEnableBlueskyPosts<S> {} - impl<S: State> State for SetEnableBlueskyPosts<S> { + ///State transition - sets the `deployed_at` field to Set + pub struct SetDeployedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDeployedAt<S> {} + impl<S: State> State for SetDeployedAt<S> { + type Owner = S::Owner; + type EnableBlueskyPosts = S::EnableBlueskyPosts; type Public = S::Public; - type DeployedAt = S::DeployedAt; type AllowAllCrew = S::AllowAllCrew; - type Owner = S::Owner; - type EnableBlueskyPosts = Set<members::enable_bluesky_posts>; + type DeployedAt = Set<members::deployed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `public` field - pub struct public(()); - ///Marker type for the `deployed_at` field - pub struct deployed_at(()); - ///Marker type for the `allow_all_crew` field - pub struct allow_all_crew(()); ///Marker type for the `owner` field pub struct owner(()); ///Marker type for the `enable_bluesky_posts` field pub struct enable_bluesky_posts(()); + ///Marker type for the `public` field + pub struct public(()); + ///Marker type for the `allow_all_crew` field + pub struct allow_all_crew(()); + ///Marker type for the `deployed_at` field + pub struct deployed_at(()); } } @@ -294,11 +294,11 @@ impl<'a, S: captain_state::State> CaptainBuilder<'a, S> { impl<'a, S> CaptainBuilder<'a, S> where S: captain_state::State, - S::Public: captain_state::IsSet, - S::DeployedAt: captain_state::IsSet, - S::AllowAllCrew: captain_state::IsSet, S::Owner: captain_state::IsSet, S::EnableBlueskyPosts: captain_state::IsSet, + S::Public: captain_state::IsSet, + S::AllowAllCrew: captain_state::IsSet, + S::DeployedAt: captain_state::IsSet, { /// Build the final struct pub fn build(self) -> Captain<'a> { diff --git a/crates/jacquard-api/src/io_atcr/hold/crew.rs b/crates/jacquard-api/src/io_atcr/hold/crew.rs index 71546702..43d9017f 100644 --- a/crates/jacquard-api/src/io_atcr/hold/crew.rs +++ b/crates/jacquard-api/src/io_atcr/hold/crew.rs @@ -42,66 +42,66 @@ pub mod crew_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Role; + type AddedAt; type Permissions; type Member; - type AddedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Role = Unset; + type AddedAt = Unset; type Permissions = Unset; type Member = Unset; - type AddedAt = Unset; } ///State transition - sets the `role` field to Set pub struct SetRole<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRole<S> {} impl<S: State> State for SetRole<S> { type Role = Set<members::role>; + type AddedAt = S::AddedAt; + type Permissions = S::Permissions; + type Member = S::Member; + } + ///State transition - sets the `added_at` field to Set + pub struct SetAddedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAddedAt<S> {} + impl<S: State> State for SetAddedAt<S> { + type Role = S::Role; + type AddedAt = Set<members::added_at>; type Permissions = S::Permissions; type Member = S::Member; - type AddedAt = S::AddedAt; } ///State transition - sets the `permissions` field to Set pub struct SetPermissions<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPermissions<S> {} impl<S: State> State for SetPermissions<S> { type Role = S::Role; + type AddedAt = S::AddedAt; type Permissions = Set<members::permissions>; type Member = S::Member; - type AddedAt = S::AddedAt; } ///State transition - sets the `member` field to Set pub struct SetMember<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMember<S> {} impl<S: State> State for SetMember<S> { type Role = S::Role; - type Permissions = S::Permissions; - type Member = Set<members::member>; type AddedAt = S::AddedAt; - } - ///State transition - sets the `added_at` field to Set - pub struct SetAddedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAddedAt<S> {} - impl<S: State> State for SetAddedAt<S> { - type Role = S::Role; type Permissions = S::Permissions; - type Member = S::Member; - type AddedAt = Set<members::added_at>; + type Member = Set<members::member>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `role` field pub struct role(()); + ///Marker type for the `added_at` field + pub struct added_at(()); ///Marker type for the `permissions` field pub struct permissions(()); ///Marker type for the `member` field pub struct member(()); - ///Marker type for the `added_at` field - pub struct added_at(()); } } @@ -215,9 +215,9 @@ impl<'a, S> CrewBuilder<'a, S> where S: crew_state::State, S::Role: crew_state::IsSet, + S::AddedAt: crew_state::IsSet, S::Permissions: crew_state::IsSet, S::Member: crew_state::IsSet, - S::AddedAt: crew_state::IsSet, { /// Build the final struct pub fn build(self) -> Crew<'a> { diff --git a/crates/jacquard-api/src/io_atcr/hold/layer.rs b/crates/jacquard-api/src/io_atcr/hold/layer.rs index b8cb3fdf..4664a99e 100644 --- a/crates/jacquard-api/src/io_atcr/hold/layer.rs +++ b/crates/jacquard-api/src/io_atcr/hold/layer.rs @@ -49,127 +49,127 @@ pub mod layer_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UserDid; - type Size; - type UserHandle; type Digest; - type MediaType; type CreatedAt; + type Size; + type MediaType; + type UserDid; type Repository; + type UserHandle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UserDid = Unset; - type Size = Unset; - type UserHandle = Unset; type Digest = Unset; - type MediaType = Unset; type CreatedAt = Unset; + type Size = Unset; + type MediaType = Unset; + type UserDid = Unset; type Repository = Unset; + type UserHandle = Unset; } - ///State transition - sets the `user_did` field to Set - pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUserDid<S> {} - impl<S: State> State for SetUserDid<S> { - type UserDid = Set<members::user_did>; + ///State transition - sets the `digest` field to Set + pub struct SetDigest<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDigest<S> {} + impl<S: State> State for SetDigest<S> { + type Digest = Set<members::digest>; + type CreatedAt = S::CreatedAt; type Size = S::Size; + type MediaType = S::MediaType; + type UserDid = S::UserDid; + type Repository = S::Repository; type UserHandle = S::UserHandle; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Digest = S::Digest; + type CreatedAt = Set<members::created_at>; + type Size = S::Size; type MediaType = S::MediaType; - type CreatedAt = S::CreatedAt; + type UserDid = S::UserDid; type Repository = S::Repository; + type UserHandle = S::UserHandle; } ///State transition - sets the `size` field to Set pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSize<S> {} impl<S: State> State for SetSize<S> { - type UserDid = S::UserDid; - type Size = Set<members::size>; - type UserHandle = S::UserHandle; type Digest = S::Digest; - type MediaType = S::MediaType; type CreatedAt = S::CreatedAt; - type Repository = S::Repository; - } - ///State transition - sets the `user_handle` field to Set - pub struct SetUserHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUserHandle<S> {} - impl<S: State> State for SetUserHandle<S> { - type UserDid = S::UserDid; - type Size = S::Size; - type UserHandle = Set<members::user_handle>; - type Digest = S::Digest; + type Size = Set<members::size>; type MediaType = S::MediaType; - type CreatedAt = S::CreatedAt; - type Repository = S::Repository; - } - ///State transition - sets the `digest` field to Set - pub struct SetDigest<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDigest<S> {} - impl<S: State> State for SetDigest<S> { type UserDid = S::UserDid; - type Size = S::Size; - type UserHandle = S::UserHandle; - type Digest = Set<members::digest>; - type MediaType = S::MediaType; - type CreatedAt = S::CreatedAt; type Repository = S::Repository; + type UserHandle = S::UserHandle; } ///State transition - sets the `media_type` field to Set pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMediaType<S> {} impl<S: State> State for SetMediaType<S> { - type UserDid = S::UserDid; - type Size = S::Size; - type UserHandle = S::UserHandle; type Digest = S::Digest; - type MediaType = Set<members::media_type>; type CreatedAt = S::CreatedAt; - type Repository = S::Repository; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type UserDid = S::UserDid; type Size = S::Size; + type MediaType = Set<members::media_type>; + type UserDid = S::UserDid; + type Repository = S::Repository; type UserHandle = S::UserHandle; + } + ///State transition - sets the `user_did` field to Set + pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUserDid<S> {} + impl<S: State> State for SetUserDid<S> { type Digest = S::Digest; + type CreatedAt = S::CreatedAt; + type Size = S::Size; type MediaType = S::MediaType; - type CreatedAt = Set<members::created_at>; + type UserDid = Set<members::user_did>; type Repository = S::Repository; + type UserHandle = S::UserHandle; } ///State transition - sets the `repository` field to Set pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepository<S> {} impl<S: State> State for SetRepository<S> { - type UserDid = S::UserDid; + type Digest = S::Digest; + type CreatedAt = S::CreatedAt; type Size = S::Size; + type MediaType = S::MediaType; + type UserDid = S::UserDid; + type Repository = Set<members::repository>; type UserHandle = S::UserHandle; + } + ///State transition - sets the `user_handle` field to Set + pub struct SetUserHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUserHandle<S> {} + impl<S: State> State for SetUserHandle<S> { type Digest = S::Digest; - type MediaType = S::MediaType; type CreatedAt = S::CreatedAt; - type Repository = Set<members::repository>; + type Size = S::Size; + type MediaType = S::MediaType; + type UserDid = S::UserDid; + type Repository = S::Repository; + type UserHandle = Set<members::user_handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `user_did` field - pub struct user_did(()); - ///Marker type for the `size` field - pub struct size(()); - ///Marker type for the `user_handle` field - pub struct user_handle(()); ///Marker type for the `digest` field pub struct digest(()); - ///Marker type for the `media_type` field - pub struct media_type(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `size` field + pub struct size(()); + ///Marker type for the `media_type` field + pub struct media_type(()); + ///Marker type for the `user_did` field + pub struct user_did(()); ///Marker type for the `repository` field pub struct repository(()); + ///Marker type for the `user_handle` field + pub struct user_handle(()); } } @@ -342,13 +342,13 @@ where impl<'a, S> LayerBuilder<'a, S> where S: layer_state::State, - S::UserDid: layer_state::IsSet, - S::Size: layer_state::IsSet, - S::UserHandle: layer_state::IsSet, S::Digest: layer_state::IsSet, - S::MediaType: layer_state::IsSet, S::CreatedAt: layer_state::IsSet, + S::Size: layer_state::IsSet, + S::MediaType: layer_state::IsSet, + S::UserDid: layer_state::IsSet, S::Repository: layer_state::IsSet, + S::UserHandle: layer_state::IsSet, { /// Build the final struct pub fn build(self) -> Layer<'a> { diff --git a/crates/jacquard-api/src/io_atcr/hold/stats.rs b/crates/jacquard-api/src/io_atcr/hold/stats.rs new file mode 100644 index 00000000..d6f9fdff --- /dev/null +++ b/crates/jacquard-api/src/io_atcr/hold/stats.rs @@ -0,0 +1,636 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: io.atcr.hold.stats +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Repository statistics stored in the hold's embedded PDS. Tracks pull/push counts per owner+repository combination. Record key is deterministic: base32(sha256(ownerDID + "/" + repository)[:16]). +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Stats<'a> { + /// RFC3339 timestamp of last pull + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub last_pull: std::option::Option<jacquard_common::types::string::Datetime>, + /// RFC3339 timestamp of last push + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub last_push: std::option::Option<jacquard_common::types::string::Datetime>, + /// DID of the image owner (e.g., did:plc:xyz123) + #[serde(borrow)] + pub owner_did: jacquard_common::types::string::Did<'a>, + /// Number of manifest downloads + pub pull_count: i64, + /// Number of manifest uploads + pub push_count: i64, + /// Repository name (e.g., myapp) + #[serde(borrow)] + pub repository: jacquard_common::CowStr<'a>, + /// RFC3339 timestamp of when this record was last updated + pub updated_at: jacquard_common::types::string::Datetime, +} + +pub mod stats_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type OwnerDid; + type UpdatedAt; + type Repository; + type PullCount; + type PushCount; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type OwnerDid = Unset; + type UpdatedAt = Unset; + type Repository = Unset; + type PullCount = Unset; + type PushCount = Unset; + } + ///State transition - sets the `owner_did` field to Set + pub struct SetOwnerDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOwnerDid<S> {} + impl<S: State> State for SetOwnerDid<S> { + type OwnerDid = Set<members::owner_did>; + type UpdatedAt = S::UpdatedAt; + type Repository = S::Repository; + type PullCount = S::PullCount; + type PushCount = S::PushCount; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type OwnerDid = S::OwnerDid; + type UpdatedAt = Set<members::updated_at>; + type Repository = S::Repository; + type PullCount = S::PullCount; + type PushCount = S::PushCount; + } + ///State transition - sets the `repository` field to Set + pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepository<S> {} + impl<S: State> State for SetRepository<S> { + type OwnerDid = S::OwnerDid; + type UpdatedAt = S::UpdatedAt; + type Repository = Set<members::repository>; + type PullCount = S::PullCount; + type PushCount = S::PushCount; + } + ///State transition - sets the `pull_count` field to Set + pub struct SetPullCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPullCount<S> {} + impl<S: State> State for SetPullCount<S> { + type OwnerDid = S::OwnerDid; + type UpdatedAt = S::UpdatedAt; + type Repository = S::Repository; + type PullCount = Set<members::pull_count>; + type PushCount = S::PushCount; + } + ///State transition - sets the `push_count` field to Set + pub struct SetPushCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPushCount<S> {} + impl<S: State> State for SetPushCount<S> { + type OwnerDid = S::OwnerDid; + type UpdatedAt = S::UpdatedAt; + type Repository = S::Repository; + type PullCount = S::PullCount; + type PushCount = Set<members::push_count>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `owner_did` field + pub struct owner_did(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); + ///Marker type for the `repository` field + pub struct repository(()); + ///Marker type for the `pull_count` field + pub struct pull_count(()); + ///Marker type for the `push_count` field + pub struct push_count(()); + } +} + +/// Builder for constructing an instance of this type +pub struct StatsBuilder<'a, S: stats_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Stats<'a> { + /// Create a new builder for this type + pub fn new() -> StatsBuilder<'a, stats_state::Empty> { + StatsBuilder::new() + } +} + +impl<'a> StatsBuilder<'a, stats_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: stats_state::State> StatsBuilder<'a, S> { + /// Set the `lastPull` field (optional) + pub fn last_pull( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `lastPull` field to an Option value (optional) + pub fn maybe_last_pull( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: stats_state::State> StatsBuilder<'a, S> { + /// Set the `lastPush` field (optional) + pub fn last_push( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `lastPush` field to an Option value (optional) + pub fn maybe_last_push( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::OwnerDid: stats_state::IsUnset, +{ + /// Set the `ownerDid` field (required) + pub fn owner_did( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> StatsBuilder<'a, stats_state::SetOwnerDid<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::PullCount: stats_state::IsUnset, +{ + /// Set the `pullCount` field (required) + pub fn pull_count( + mut self, + value: impl Into<i64>, + ) -> StatsBuilder<'a, stats_state::SetPullCount<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::PushCount: stats_state::IsUnset, +{ + /// Set the `pushCount` field (required) + pub fn push_count( + mut self, + value: impl Into<i64>, + ) -> StatsBuilder<'a, stats_state::SetPushCount<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::Repository: stats_state::IsUnset, +{ + /// Set the `repository` field (required) + pub fn repository( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> StatsBuilder<'a, stats_state::SetRepository<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::UpdatedAt: stats_state::IsUnset, +{ + /// Set the `updatedAt` field (required) + pub fn updated_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> StatsBuilder<'a, stats_state::SetUpdatedAt<S>> { + self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); + StatsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StatsBuilder<'a, S> +where + S: stats_state::State, + S::OwnerDid: stats_state::IsSet, + S::UpdatedAt: stats_state::IsSet, + S::Repository: stats_state::IsSet, + S::PullCount: stats_state::IsSet, + S::PushCount: stats_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Stats<'a> { + Stats { + last_pull: self.__unsafe_private_named.0, + last_push: self.__unsafe_private_named.1, + owner_did: self.__unsafe_private_named.2.unwrap(), + pull_count: self.__unsafe_private_named.3.unwrap(), + push_count: self.__unsafe_private_named.4.unwrap(), + repository: self.__unsafe_private_named.5.unwrap(), + updated_at: self.__unsafe_private_named.6.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Stats<'a> { + Stats { + last_pull: self.__unsafe_private_named.0, + last_push: self.__unsafe_private_named.1, + owner_did: self.__unsafe_private_named.2.unwrap(), + pull_count: self.__unsafe_private_named.3.unwrap(), + push_count: self.__unsafe_private_named.4.unwrap(), + repository: self.__unsafe_private_named.5.unwrap(), + updated_at: self.__unsafe_private_named.6.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Stats<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, StatsRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct StatsGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Stats<'a>, +} + +impl From<StatsGetRecordOutput<'_>> for Stats<'_> { + fn from(output: StatsGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Stats<'_> { + const NSID: &'static str = "io.atcr.hold.stats"; + type Record = StatsRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct StatsRecord; +impl jacquard_common::xrpc::XrpcResp for StatsRecord { + const NSID: &'static str = "io.atcr.hold.stats"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = StatsGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for StatsRecord { + const NSID: &'static str = "io.atcr.hold.stats"; + type Record = StatsRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Stats<'a> { + fn nsid() -> &'static str { + "io.atcr.hold.stats" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_io_atcr_hold_stats() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.pull_count; + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "pull_count", + ), + min: 0i64, + actual: *value, + }); + } + } + { + let value = &self.push_count; + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "push_count", + ), + min: 0i64, + actual: *value, + }); + } + } + { + let value = &self.repository; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "repository", + ), + max: 256usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_io_atcr_hold_stats() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("io.atcr.hold.stats"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Repository statistics stored in the hold's embedded PDS. Tracks pull/push counts per owner+repository combination. Record key is deterministic: base32(sha256(ownerDID + \"/\" + repository)[:16]).", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("ownerDid"), + ::jacquard_common::smol_str::SmolStr::new_static("repository"), + ::jacquard_common::smol_str::SmolStr::new_static("pullCount"), + ::jacquard_common::smol_str::SmolStr::new_static("pushCount"), + ::jacquard_common::smol_str::SmolStr::new_static("updatedAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "lastPull", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "RFC3339 timestamp of last pull", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "lastPush", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "RFC3339 timestamp of last push", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "ownerDid", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "DID of the image owner (e.g., did:plc:xyz123)", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "pullCount", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "pushCount", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "repository", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Repository name (e.g., myapp)", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(256usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "updatedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "RFC3339 timestamp of when this record was last updated", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/io_atcr/manifest.rs b/crates/jacquard-api/src/io_atcr/manifest.rs index 308e88e2..260ecaed 100644 --- a/crates/jacquard-api/src/io_atcr/manifest.rs +++ b/crates/jacquard-api/src/io_atcr/manifest.rs @@ -46,49 +46,49 @@ pub mod blob_reference_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type MediaType; type Size; + type MediaType; type Digest; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type MediaType = Unset; type Size = Unset; + type MediaType = Unset; type Digest = Unset; } - ///State transition - sets the `media_type` field to Set - pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMediaType<S> {} - impl<S: State> State for SetMediaType<S> { - type MediaType = Set<members::media_type>; - type Size = S::Size; - type Digest = S::Digest; - } ///State transition - sets the `size` field to Set pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSize<S> {} impl<S: State> State for SetSize<S> { - type MediaType = S::MediaType; type Size = Set<members::size>; + type MediaType = S::MediaType; + type Digest = S::Digest; + } + ///State transition - sets the `media_type` field to Set + pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMediaType<S> {} + impl<S: State> State for SetMediaType<S> { + type Size = S::Size; + type MediaType = Set<members::media_type>; type Digest = S::Digest; } ///State transition - sets the `digest` field to Set pub struct SetDigest<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDigest<S> {} impl<S: State> State for SetDigest<S> { - type MediaType = S::MediaType; type Size = S::Size; + type MediaType = S::MediaType; type Digest = Set<members::digest>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `media_type` field - pub struct media_type(()); ///Marker type for the `size` field pub struct size(()); + ///Marker type for the `media_type` field + pub struct media_type(()); ///Marker type for the `digest` field pub struct digest(()); } @@ -223,8 +223,8 @@ impl<'a, S: blob_reference_state::State> BlobReferenceBuilder<'a, S> { impl<'a, S> BlobReferenceBuilder<'a, S> where S: blob_reference_state::State, - S::MediaType: blob_reference_state::IsSet, S::Size: blob_reference_state::IsSet, + S::MediaType: blob_reference_state::IsSet, S::Digest: blob_reference_state::IsSet, { /// Build the final struct @@ -951,84 +951,84 @@ pub mod manifest_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type MediaType; - type SchemaVersion; + type Repository; type CreatedAt; type Digest; - type Repository; + type SchemaVersion; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type MediaType = Unset; - type SchemaVersion = Unset; + type Repository = Unset; type CreatedAt = Unset; type Digest = Unset; - type Repository = Unset; + type SchemaVersion = Unset; } ///State transition - sets the `media_type` field to Set pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMediaType<S> {} impl<S: State> State for SetMediaType<S> { type MediaType = Set<members::media_type>; - type SchemaVersion = S::SchemaVersion; + type Repository = S::Repository; type CreatedAt = S::CreatedAt; type Digest = S::Digest; - type Repository = S::Repository; + type SchemaVersion = S::SchemaVersion; } - ///State transition - sets the `schema_version` field to Set - pub struct SetSchemaVersion<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSchemaVersion<S> {} - impl<S: State> State for SetSchemaVersion<S> { + ///State transition - sets the `repository` field to Set + pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepository<S> {} + impl<S: State> State for SetRepository<S> { type MediaType = S::MediaType; - type SchemaVersion = Set<members::schema_version>; + type Repository = Set<members::repository>; type CreatedAt = S::CreatedAt; type Digest = S::Digest; - type Repository = S::Repository; + type SchemaVersion = S::SchemaVersion; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type MediaType = S::MediaType; - type SchemaVersion = S::SchemaVersion; + type Repository = S::Repository; type CreatedAt = Set<members::created_at>; type Digest = S::Digest; - type Repository = S::Repository; + type SchemaVersion = S::SchemaVersion; } ///State transition - sets the `digest` field to Set pub struct SetDigest<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDigest<S> {} impl<S: State> State for SetDigest<S> { type MediaType = S::MediaType; - type SchemaVersion = S::SchemaVersion; + type Repository = S::Repository; type CreatedAt = S::CreatedAt; type Digest = Set<members::digest>; - type Repository = S::Repository; + type SchemaVersion = S::SchemaVersion; } - ///State transition - sets the `repository` field to Set - pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepository<S> {} - impl<S: State> State for SetRepository<S> { + ///State transition - sets the `schema_version` field to Set + pub struct SetSchemaVersion<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSchemaVersion<S> {} + impl<S: State> State for SetSchemaVersion<S> { type MediaType = S::MediaType; - type SchemaVersion = S::SchemaVersion; + type Repository = S::Repository; type CreatedAt = S::CreatedAt; type Digest = S::Digest; - type Repository = Set<members::repository>; + type SchemaVersion = Set<members::schema_version>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `media_type` field pub struct media_type(()); - ///Marker type for the `schema_version` field - pub struct schema_version(()); + ///Marker type for the `repository` field + pub struct repository(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `digest` field pub struct digest(()); - ///Marker type for the `repository` field - pub struct repository(()); + ///Marker type for the `schema_version` field + pub struct schema_version(()); } } @@ -1336,10 +1336,10 @@ impl<'a, S> ManifestBuilder<'a, S> where S: manifest_state::State, S::MediaType: manifest_state::IsSet, - S::SchemaVersion: manifest_state::IsSet, + S::Repository: manifest_state::IsSet, S::CreatedAt: manifest_state::IsSet, S::Digest: manifest_state::IsSet, - S::Repository: manifest_state::IsSet, + S::SchemaVersion: manifest_state::IsSet, { /// Build the final struct pub fn build(self) -> Manifest<'a> { @@ -1676,51 +1676,51 @@ pub mod manifest_reference_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type MediaType; type Size; type Digest; - type MediaType; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type MediaType = Unset; type Size = Unset; type Digest = Unset; - type MediaType = Unset; + } + ///State transition - sets the `media_type` field to Set + pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMediaType<S> {} + impl<S: State> State for SetMediaType<S> { + type MediaType = Set<members::media_type>; + type Size = S::Size; + type Digest = S::Digest; } ///State transition - sets the `size` field to Set pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSize<S> {} impl<S: State> State for SetSize<S> { + type MediaType = S::MediaType; type Size = Set<members::size>; type Digest = S::Digest; - type MediaType = S::MediaType; } ///State transition - sets the `digest` field to Set pub struct SetDigest<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDigest<S> {} impl<S: State> State for SetDigest<S> { - type Size = S::Size; - type Digest = Set<members::digest>; type MediaType = S::MediaType; - } - ///State transition - sets the `media_type` field to Set - pub struct SetMediaType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMediaType<S> {} - impl<S: State> State for SetMediaType<S> { type Size = S::Size; - type Digest = S::Digest; - type MediaType = Set<members::media_type>; + type Digest = Set<members::digest>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `media_type` field + pub struct media_type(()); ///Marker type for the `size` field pub struct size(()); ///Marker type for the `digest` field pub struct digest(()); - ///Marker type for the `media_type` field - pub struct media_type(()); } } @@ -1853,9 +1853,9 @@ where impl<'a, S> ManifestReferenceBuilder<'a, S> where S: manifest_reference_state::State, + S::MediaType: manifest_reference_state::IsSet, S::Size: manifest_reference_state::IsSet, S::Digest: manifest_reference_state::IsSet, - S::MediaType: manifest_reference_state::IsSet, { /// Build the final struct pub fn build(self) -> ManifestReference<'a> { diff --git a/crates/jacquard-api/src/io_atcr/repo/page.rs b/crates/jacquard-api/src/io_atcr/repo/page.rs index 99052cdc..02942e55 100644 --- a/crates/jacquard-api/src/io_atcr/repo/page.rs +++ b/crates/jacquard-api/src/io_atcr/repo/page.rs @@ -45,51 +45,51 @@ pub mod page_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Repository; type CreatedAt; type UpdatedAt; - type Repository; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Repository = Unset; type CreatedAt = Unset; type UpdatedAt = Unset; - type Repository = Unset; + } + ///State transition - sets the `repository` field to Set + pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepository<S> {} + impl<S: State> State for SetRepository<S> { + type Repository = Set<members::repository>; + type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Repository = S::Repository; type CreatedAt = Set<members::created_at>; type UpdatedAt = S::UpdatedAt; - type Repository = S::Repository; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} impl<S: State> State for SetUpdatedAt<S> { - type CreatedAt = S::CreatedAt; - type UpdatedAt = Set<members::updated_at>; type Repository = S::Repository; - } - ///State transition - sets the `repository` field to Set - pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepository<S> {} - impl<S: State> State for SetRepository<S> { type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; - type Repository = Set<members::repository>; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `repository` field + pub struct repository(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `updated_at` field pub struct updated_at(()); - ///Marker type for the `repository` field - pub struct repository(()); } } @@ -222,9 +222,9 @@ where impl<'a, S> PageBuilder<'a, S> where S: page_state::State, + S::Repository: page_state::IsSet, S::CreatedAt: page_state::IsSet, S::UpdatedAt: page_state::IsSet, - S::Repository: page_state::IsSet, { /// Build the final struct pub fn build(self) -> Page<'a> { diff --git a/crates/jacquard-api/src/io_atcr/sailor/star.rs b/crates/jacquard-api/src/io_atcr/sailor/star.rs index 911038c8..81a6329f 100644 --- a/crates/jacquard-api/src/io_atcr/sailor/star.rs +++ b/crates/jacquard-api/src/io_atcr/sailor/star.rs @@ -409,37 +409,37 @@ pub mod subject_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Repository; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Repository = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Repository = S::Repository; + type Did = Unset; } ///State transition - sets the `repository` field to Set pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepository<S> {} impl<S: State> State for SetRepository<S> { - type Did = S::Did; type Repository = Set<members::repository>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Repository = S::Repository; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `repository` field pub struct repository(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -512,8 +512,8 @@ where impl<'a, S> SubjectBuilder<'a, S> where S: subject_state::State, - S::Did: subject_state::IsSet, S::Repository: subject_state::IsSet, + S::Did: subject_state::IsSet, { /// Build the final struct pub fn build(self) -> Subject<'a> { diff --git a/crates/jacquard-api/src/io_atcr/tag.rs b/crates/jacquard-api/src/io_atcr/tag.rs index 171b4978..952f08ff 100644 --- a/crates/jacquard-api/src/io_atcr/tag.rs +++ b/crates/jacquard-api/src/io_atcr/tag.rs @@ -46,51 +46,51 @@ pub mod tag_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; type Repository; type Tag; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; type Repository = Unset; type Tag = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Repository = S::Repository; + type Tag = S::Tag; } ///State transition - sets the `repository` field to Set pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepository<S> {} impl<S: State> State for SetRepository<S> { + type CreatedAt = S::CreatedAt; type Repository = Set<members::repository>; type Tag = S::Tag; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `tag` field to Set pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTag<S> {} impl<S: State> State for SetTag<S> { - type Repository = S::Repository; - type Tag = Set<members::tag>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type Repository = S::Repository; - type Tag = S::Tag; - type CreatedAt = Set<members::created_at>; + type Tag = Set<members::tag>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `repository` field pub struct repository(()); ///Marker type for the `tag` field pub struct tag(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -223,9 +223,9 @@ where impl<'a, S> TagBuilder<'a, S> where S: tag_state::State, + S::CreatedAt: tag_state::IsSet, S::Repository: tag_state::IsSet, S::Tag: tag_state::IsSet, - S::CreatedAt: tag_state::IsSet, { /// Build the final struct pub fn build(self) -> Tag<'a> { diff --git a/crates/jacquard-api/src/io_whiteley.rs b/crates/jacquard-api/src/io_whiteley.rs index 0c363e54..20eb16f2 100644 --- a/crates/jacquard-api/src/io_whiteley.rs +++ b/crates/jacquard-api/src/io_whiteley.rs @@ -3,4 +3,5 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +pub mod ATlas; pub mod luke; \ No newline at end of file diff --git a/crates/jacquard-api/src/io_whiteley/ATlas.rs b/crates/jacquard-api/src/io_whiteley/ATlas.rs new file mode 100644 index 00000000..3edfce2d --- /dev/null +++ b/crates/jacquard-api/src/io_whiteley/ATlas.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod pin; \ No newline at end of file diff --git a/crates/jacquard-api/src/io_whiteley/ATlas/pin.rs b/crates/jacquard-api/src/io_whiteley/ATlas/pin.rs new file mode 100644 index 00000000..8960d593 --- /dev/null +++ b/crates/jacquard-api/src/io_whiteley/ATlas/pin.rs @@ -0,0 +1,584 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: io.whiteley.ATlas.pin +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A user's geographical pin on the atlas +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Pin<'a> { + #[serde(borrow)] + pub description: jacquard_common::CowStr<'a>, + #[serde(borrow)] + pub did: jacquard_common::types::string::Did<'a>, + #[serde(borrow)] + pub latitude: jacquard_common::CowStr<'a>, + #[serde(borrow)] + pub longitude: jacquard_common::CowStr<'a>, + pub placed_at: jacquard_common::types::string::Datetime, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub website: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod pin_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Did; + type Latitude; + type Longitude; + type Description; + type PlacedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Did = Unset; + type Latitude = Unset; + type Longitude = Unset; + type Description = Unset; + type PlacedAt = Unset; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Did = Set<members::did>; + type Latitude = S::Latitude; + type Longitude = S::Longitude; + type Description = S::Description; + type PlacedAt = S::PlacedAt; + } + ///State transition - sets the `latitude` field to Set + pub struct SetLatitude<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLatitude<S> {} + impl<S: State> State for SetLatitude<S> { + type Did = S::Did; + type Latitude = Set<members::latitude>; + type Longitude = S::Longitude; + type Description = S::Description; + type PlacedAt = S::PlacedAt; + } + ///State transition - sets the `longitude` field to Set + pub struct SetLongitude<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLongitude<S> {} + impl<S: State> State for SetLongitude<S> { + type Did = S::Did; + type Latitude = S::Latitude; + type Longitude = Set<members::longitude>; + type Description = S::Description; + type PlacedAt = S::PlacedAt; + } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type Did = S::Did; + type Latitude = S::Latitude; + type Longitude = S::Longitude; + type Description = Set<members::description>; + type PlacedAt = S::PlacedAt; + } + ///State transition - sets the `placed_at` field to Set + pub struct SetPlacedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlacedAt<S> {} + impl<S: State> State for SetPlacedAt<S> { + type Did = S::Did; + type Latitude = S::Latitude; + type Longitude = S::Longitude; + type Description = S::Description; + type PlacedAt = Set<members::placed_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `did` field + pub struct did(()); + ///Marker type for the `latitude` field + pub struct latitude(()); + ///Marker type for the `longitude` field + pub struct longitude(()); + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `placed_at` field + pub struct placed_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PinBuilder<'a, S: pin_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Pin<'a> { + /// Create a new builder for this type + pub fn new() -> PinBuilder<'a, pin_state::Empty> { + PinBuilder::new() + } +} + +impl<'a> PinBuilder<'a, pin_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::Description: pin_state::IsUnset, +{ + /// Set the `description` field (required) + pub fn description( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> PinBuilder<'a, pin_state::SetDescription<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::Did: pin_state::IsUnset, +{ + /// Set the `did` field (required) + pub fn did( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> PinBuilder<'a, pin_state::SetDid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::Latitude: pin_state::IsUnset, +{ + /// Set the `latitude` field (required) + pub fn latitude( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> PinBuilder<'a, pin_state::SetLatitude<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::Longitude: pin_state::IsUnset, +{ + /// Set the `longitude` field (required) + pub fn longitude( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> PinBuilder<'a, pin_state::SetLongitude<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::PlacedAt: pin_state::IsUnset, +{ + /// Set the `placedAt` field (required) + pub fn placed_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> PinBuilder<'a, pin_state::SetPlacedAt<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + PinBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: pin_state::State> PinBuilder<'a, S> { + /// Set the `website` field (optional) + pub fn website( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `website` field to an Option value (optional) + pub fn maybe_website(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S> PinBuilder<'a, S> +where + S: pin_state::State, + S::Did: pin_state::IsSet, + S::Latitude: pin_state::IsSet, + S::Longitude: pin_state::IsSet, + S::Description: pin_state::IsSet, + S::PlacedAt: pin_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Pin<'a> { + Pin { + description: self.__unsafe_private_named.0.unwrap(), + did: self.__unsafe_private_named.1.unwrap(), + latitude: self.__unsafe_private_named.2.unwrap(), + longitude: self.__unsafe_private_named.3.unwrap(), + placed_at: self.__unsafe_private_named.4.unwrap(), + website: self.__unsafe_private_named.5, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Pin<'a> { + Pin { + description: self.__unsafe_private_named.0.unwrap(), + did: self.__unsafe_private_named.1.unwrap(), + latitude: self.__unsafe_private_named.2.unwrap(), + longitude: self.__unsafe_private_named.3.unwrap(), + placed_at: self.__unsafe_private_named.4.unwrap(), + website: self.__unsafe_private_named.5, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Pin<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, PinRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PinGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Pin<'a>, +} + +impl From<PinGetRecordOutput<'_>> for Pin<'_> { + fn from(output: PinGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Pin<'_> { + const NSID: &'static str = "io.whiteley.ATlas.pin"; + type Record = PinRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct PinRecord; +impl jacquard_common::xrpc::XrpcResp for PinRecord { + const NSID: &'static str = "io.whiteley.ATlas.pin"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = PinGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for PinRecord { + const NSID: &'static str = "io.whiteley.ATlas.pin"; + type Record = PinRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Pin<'a> { + fn nsid() -> &'static str { + "io.whiteley.ATlas.pin" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_io_whiteley_ATlas_pin() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.description; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 256usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.latitude; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "latitude", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.longitude; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 32usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "longitude", + ), + max: 32usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.website { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "website", + ), + max: 256usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_io_whiteley_ATlas_pin() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("io.whiteley.ATlas.pin"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A user's geographical pin on the atlas", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("literal:self")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("did"), + ::jacquard_common::smol_str::SmolStr::new_static("longitude"), + ::jacquard_common::smol_str::SmolStr::new_static("latitude"), + ::jacquard_common::smol_str::SmolStr::new_static("description"), + ::jacquard_common::smol_str::SmolStr::new_static("placedAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(256usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("did"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "latitude", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "longitude", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(32usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "placedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("website"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(256usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/io_whiteley/luke/ATlas/pin.rs b/crates/jacquard-api/src/io_whiteley/luke/ATlas/pin.rs index 4fa1c7e6..8aa99275 100644 --- a/crates/jacquard-api/src/io_whiteley/luke/ATlas/pin.rs +++ b/crates/jacquard-api/src/io_whiteley/luke/ATlas/pin.rs @@ -43,84 +43,84 @@ pub mod pin_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type PlacedAt; - type Longitude; - type Description; type Latitude; type Did; + type Description; + type Longitude; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type PlacedAt = Unset; - type Longitude = Unset; - type Description = Unset; type Latitude = Unset; type Did = Unset; + type Description = Unset; + type Longitude = Unset; } ///State transition - sets the `placed_at` field to Set pub struct SetPlacedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPlacedAt<S> {} impl<S: State> State for SetPlacedAt<S> { type PlacedAt = Set<members::placed_at>; - type Longitude = S::Longitude; - type Description = S::Description; type Latitude = S::Latitude; type Did = S::Did; - } - ///State transition - sets the `longitude` field to Set - pub struct SetLongitude<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLongitude<S> {} - impl<S: State> State for SetLongitude<S> { - type PlacedAt = S::PlacedAt; - type Longitude = Set<members::longitude>; type Description = S::Description; - type Latitude = S::Latitude; - type Did = S::Did; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { - type PlacedAt = S::PlacedAt; type Longitude = S::Longitude; - type Description = Set<members::description>; - type Latitude = S::Latitude; - type Did = S::Did; } ///State transition - sets the `latitude` field to Set pub struct SetLatitude<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLatitude<S> {} impl<S: State> State for SetLatitude<S> { type PlacedAt = S::PlacedAt; - type Longitude = S::Longitude; - type Description = S::Description; type Latitude = Set<members::latitude>; type Did = S::Did; + type Description = S::Description; + type Longitude = S::Longitude; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type PlacedAt = S::PlacedAt; - type Longitude = S::Longitude; - type Description = S::Description; type Latitude = S::Latitude; type Did = Set<members::did>; + type Description = S::Description; + type Longitude = S::Longitude; + } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type PlacedAt = S::PlacedAt; + type Latitude = S::Latitude; + type Did = S::Did; + type Description = Set<members::description>; + type Longitude = S::Longitude; + } + ///State transition - sets the `longitude` field to Set + pub struct SetLongitude<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLongitude<S> {} + impl<S: State> State for SetLongitude<S> { + type PlacedAt = S::PlacedAt; + type Latitude = S::Latitude; + type Did = S::Did; + type Description = S::Description; + type Longitude = Set<members::longitude>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `placed_at` field pub struct placed_at(()); - ///Marker type for the `longitude` field - pub struct longitude(()); - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `latitude` field pub struct latitude(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `longitude` field + pub struct longitude(()); } } @@ -271,10 +271,10 @@ impl<'a, S> PinBuilder<'a, S> where S: pin_state::State, S::PlacedAt: pin_state::IsSet, - S::Longitude: pin_state::IsSet, - S::Description: pin_state::IsSet, S::Latitude: pin_state::IsSet, S::Did: pin_state::IsSet, + S::Description: pin_state::IsSet, + S::Longitude: pin_state::IsSet, { /// Build the final struct pub fn build(self) -> Pin<'a> { diff --git a/crates/jacquard-api/src/io_whiteside/profile.rs b/crates/jacquard-api/src/io_whiteside/profile.rs index 41aa937a..14f2e84f 100644 --- a/crates/jacquard-api/src/io_whiteside/profile.rs +++ b/crates/jacquard-api/src/io_whiteside/profile.rs @@ -38,49 +38,49 @@ pub mod profile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Content; type UpdatedAt; + type Content; type Heading; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Content = Unset; type UpdatedAt = Unset; + type Content = Unset; type Heading = Unset; } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type Content = Set<members::content>; - type UpdatedAt = S::UpdatedAt; - type Heading = S::Heading; - } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} impl<S: State> State for SetUpdatedAt<S> { - type Content = S::Content; type UpdatedAt = Set<members::updated_at>; + type Content = S::Content; + type Heading = S::Heading; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type UpdatedAt = S::UpdatedAt; + type Content = Set<members::content>; type Heading = S::Heading; } ///State transition - sets the `heading` field to Set pub struct SetHeading<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeading<S> {} impl<S: State> State for SetHeading<S> { - type Content = S::Content; type UpdatedAt = S::UpdatedAt; + type Content = S::Content; type Heading = Set<members::heading>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `content` field - pub struct content(()); ///Marker type for the `updated_at` field pub struct updated_at(()); + ///Marker type for the `content` field + pub struct content(()); ///Marker type for the `heading` field pub struct heading(()); } @@ -175,8 +175,8 @@ where impl<'a, S> ProfileBuilder<'a, S> where S: profile_state::State, - S::Content: profile_state::IsSet, S::UpdatedAt: profile_state::IsSet, + S::Content: profile_state::IsSet, S::Heading: profile_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/lib.rs b/crates/jacquard-api/src/lib.rs index 9839dfd3..8737b92c 100644 --- a/crates/jacquard-api/src/lib.rs +++ b/crates/jacquard-api/src/lib.rs @@ -13,9 +13,15 @@ pub mod app_bsky; #[cfg(feature = "app_dropanchor")] pub mod app_dropanchor; +#[cfg(feature = "app_juttu")] +pub mod app_juttu; + #[cfg(feature = "app_ocho")] pub mod app_ocho; +#[cfg(feature = "app_offprint")] +pub mod app_offprint; + #[cfg(feature = "app_rocksky")] pub mod app_rocksky; @@ -34,6 +40,9 @@ pub mod blue__2048; #[cfg(feature = "blue_atplane")] pub mod blue_atplane; +#[cfg(feature = "blue_atplay")] +pub mod blue_atplay; + #[cfg(feature = "blue_linkat")] pub mod blue_linkat; @@ -43,6 +52,9 @@ pub mod blue_recipes; #[cfg(feature = "blue_rito")] pub mod blue_rito; +#[cfg(feature = "blue_skytalk")] +pub mod blue_skytalk; + #[cfg(feature = "blue_zio")] pub mod blue_zio; pub mod builder_types; @@ -50,9 +62,15 @@ pub mod builder_types; #[cfg(feature = "buzz_bookhive")] pub mod buzz_bookhive; +#[cfg(feature = "cat_vt3e")] +pub mod cat_vt3e; + #[cfg(feature = "chat_bsky")] pub mod chat_bsky; +#[cfg(feature = "city_yoyle")] +pub mod city_yoyle; + #[cfg(feature = "club_stellz")] pub mod club_stellz; @@ -98,6 +116,15 @@ pub mod dev_ocbwoy3; #[cfg(feature = "dev_regnault")] pub mod dev_regnault; +#[cfg(feature = "dev_tsunagite")] +pub mod dev_tsunagite; + +#[cfg(feature = "dev_vielle")] +pub mod dev_vielle; + +#[cfg(feature = "events_smokesignal")] +pub mod events_smokesignal; + #[cfg(feature = "fm_teal")] pub mod fm_teal; @@ -179,6 +206,9 @@ pub mod org_okazu_diary; #[cfg(feature = "org_robocracy")] pub mod org_robocracy; +#[cfg(feature = "org_stormlightlabs")] +pub mod org_stormlightlabs; + #[cfg(feature = "org_user_intents")] pub mod org_user_intents; @@ -212,6 +242,9 @@ pub mod social_flockfeeds; #[cfg(feature = "social_grain")] pub mod social_grain; +#[cfg(feature = "social_pace")] +pub mod social_pace; + #[cfg(feature = "social_pmsky")] pub mod social_pmsky; @@ -221,6 +254,9 @@ pub mod social_psky; #[cfg(feature = "social_sket")] pub mod social_sket; +#[cfg(feature = "social_tophhie")] +pub mod social_tophhie; + #[cfg(feature = "tech_manos")] pub mod tech_manos; diff --git a/crates/jacquard-api/src/link_bridgebeats/lookup.rs b/crates/jacquard-api/src/link_bridgebeats/lookup.rs index 7bbad3ea..3ec7d3b8 100644 --- a/crates/jacquard-api/src/link_bridgebeats/lookup.rs +++ b/crates/jacquard-api/src/link_bridgebeats/lookup.rs @@ -576,83 +576,83 @@ pub mod provider_result_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Artist; - type Provider; - type Title; type MarketRegion; + type Title; + type Provider; + type Artist; type Url; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Artist = Unset; - type Provider = Unset; - type Title = Unset; type MarketRegion = Unset; + type Title = Unset; + type Provider = Unset; + type Artist = Unset; type Url = Unset; } - ///State transition - sets the `artist` field to Set - pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetArtist<S> {} - impl<S: State> State for SetArtist<S> { - type Artist = Set<members::artist>; - type Provider = S::Provider; + ///State transition - sets the `market_region` field to Set + pub struct SetMarketRegion<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMarketRegion<S> {} + impl<S: State> State for SetMarketRegion<S> { + type MarketRegion = Set<members::market_region>; type Title = S::Title; - type MarketRegion = S::MarketRegion; - type Url = S::Url; - } - ///State transition - sets the `provider` field to Set - pub struct SetProvider<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetProvider<S> {} - impl<S: State> State for SetProvider<S> { + type Provider = S::Provider; type Artist = S::Artist; - type Provider = Set<members::provider>; - type Title = S::Title; - type MarketRegion = S::MarketRegion; type Url = S::Url; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Artist = S::Artist; - type Provider = S::Provider; - type Title = Set<members::title>; type MarketRegion = S::MarketRegion; + type Title = Set<members::title>; + type Provider = S::Provider; + type Artist = S::Artist; type Url = S::Url; } - ///State transition - sets the `market_region` field to Set - pub struct SetMarketRegion<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMarketRegion<S> {} - impl<S: State> State for SetMarketRegion<S> { + ///State transition - sets the `provider` field to Set + pub struct SetProvider<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetProvider<S> {} + impl<S: State> State for SetProvider<S> { + type MarketRegion = S::MarketRegion; + type Title = S::Title; + type Provider = Set<members::provider>; type Artist = S::Artist; - type Provider = S::Provider; + type Url = S::Url; + } + ///State transition - sets the `artist` field to Set + pub struct SetArtist<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetArtist<S> {} + impl<S: State> State for SetArtist<S> { + type MarketRegion = S::MarketRegion; type Title = S::Title; - type MarketRegion = Set<members::market_region>; + type Provider = S::Provider; + type Artist = Set<members::artist>; type Url = S::Url; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type Artist = S::Artist; - type Provider = S::Provider; - type Title = S::Title; type MarketRegion = S::MarketRegion; + type Title = S::Title; + type Provider = S::Provider; + type Artist = S::Artist; type Url = Set<members::url>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `artist` field - pub struct artist(()); - ///Marker type for the `provider` field - pub struct provider(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `market_region` field pub struct market_region(()); + ///Marker type for the `title` field + pub struct title(()); + ///Marker type for the `provider` field + pub struct provider(()); + ///Marker type for the `artist` field + pub struct artist(()); ///Marker type for the `url` field pub struct url(()); } @@ -841,10 +841,10 @@ where impl<'a, S> ProviderResultBuilder<'a, S> where S: provider_result_state::State, - S::Artist: provider_result_state::IsSet, - S::Provider: provider_result_state::IsSet, - S::Title: provider_result_state::IsSet, S::MarketRegion: provider_result_state::IsSet, + S::Title: provider_result_state::IsSet, + S::Provider: provider_result_state::IsSet, + S::Artist: provider_result_state::IsSet, S::Url: provider_result_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/moe_karashiiro/kpaste/paste.rs b/crates/jacquard-api/src/moe_karashiiro/kpaste/paste.rs index 8ba5e629..b4cf9dcc 100644 --- a/crates/jacquard-api/src/moe_karashiiro/kpaste/paste.rs +++ b/crates/jacquard-api/src/moe_karashiiro/kpaste/paste.rs @@ -45,37 +45,37 @@ pub mod paste_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Content; type CreatedAt; + type Content; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Content = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type Content = Set<members::content>; - type CreatedAt = S::CreatedAt; + type Content = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Content = S::Content; type CreatedAt = Set<members::created_at>; + type Content = S::Content; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type CreatedAt = S::CreatedAt; + type Content = Set<members::content>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `content` field - pub struct content(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `content` field + pub struct content(()); } } @@ -202,8 +202,8 @@ impl<'a, S: paste_state::State> PasteBuilder<'a, S> { impl<'a, S> PasteBuilder<'a, S> where S: paste_state::State, - S::Content: paste_state::IsSet, S::CreatedAt: paste_state::IsSet, + S::Content: paste_state::IsSet, { /// Build the final struct pub fn build(self) -> Paste<'a> { diff --git a/crates/jacquard-api/src/my_skylights/rel.rs b/crates/jacquard-api/src/my_skylights/rel.rs index d664b65a..560cba09 100644 --- a/crates/jacquard-api/src/my_skylights/rel.rs +++ b/crates/jacquard-api/src/my_skylights/rel.rs @@ -507,49 +507,49 @@ pub mod note_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Value; + type CreatedAt; type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Value = Unset; + type CreatedAt = Unset; type UpdatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Value = S::Value; - type UpdatedAt = S::UpdatedAt; - } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type CreatedAt = S::CreatedAt; type Value = Set<members::value>; + type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Value = S::Value; + type CreatedAt = Set<members::created_at>; type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} impl<S: State> State for SetUpdatedAt<S> { - type CreatedAt = S::CreatedAt; type Value = S::Value; + type CreatedAt = S::CreatedAt; type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `updated_at` field pub struct updated_at(()); } @@ -644,8 +644,8 @@ where impl<'a, S> NoteBuilder<'a, S> where S: note_state::State, - S::CreatedAt: note_state::IsSet, S::Value: note_state::IsSet, + S::CreatedAt: note_state::IsSet, S::UpdatedAt: note_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/net_aftertheinter/coolthingtwo.rs b/crates/jacquard-api/src/net_aftertheinter/coolthingtwo.rs index 19c34ea4..e799c2ff 100644 --- a/crates/jacquard-api/src/net_aftertheinter/coolthingtwo.rs +++ b/crates/jacquard-api/src/net_aftertheinter/coolthingtwo.rs @@ -32,37 +32,37 @@ pub mod coolthingtwo_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type CreatedAt; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; - type CreatedAt = S::CreatedAt; + type Status = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Status = S::Status; type CreatedAt = Set<members::created_at>; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type CreatedAt = S::CreatedAt; + type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> CoolthingtwoBuilder<'a, S> where S: coolthingtwo_state::State, - S::Status: coolthingtwo_state::IsSet, S::CreatedAt: coolthingtwo_state::IsSet, + S::Status: coolthingtwo_state::IsSet, { /// Build the final struct pub fn build(self) -> Coolthingtwo<'a> { diff --git a/crates/jacquard-api/src/net_altq/aqfile.rs b/crates/jacquard-api/src/net_altq/aqfile.rs index 386d38c1..555ca211 100644 --- a/crates/jacquard-api/src/net_altq/aqfile.rs +++ b/crates/jacquard-api/src/net_altq/aqfile.rs @@ -465,37 +465,37 @@ pub mod file_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Size; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Size = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Size = S::Size; + type Name = Unset; } ///State transition - sets the `size` field to Set pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSize<S> {} impl<S: State> State for SetSize<S> { - type Name = S::Name; type Size = Set<members::size>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Size = S::Size; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `size` field pub struct size(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -608,8 +608,8 @@ where impl<'a, S> FileBuilder<'a, S> where S: file_state::State, - S::Name: file_state::IsSet, S::Size: file_state::IsSet, + S::Name: file_state::IsSet, { /// Build the final struct pub fn build(self) -> File<'a> { @@ -748,51 +748,51 @@ pub mod aqfile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type File; - type CreatedAt; type Blob; + type CreatedAt; + type File; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type File = Unset; - type CreatedAt = Unset; type Blob = Unset; + type CreatedAt = Unset; + type File = Unset; } - ///State transition - sets the `file` field to Set - pub struct SetFile<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFile<S> {} - impl<S: State> State for SetFile<S> { - type File = Set<members::file>; + ///State transition - sets the `blob` field to Set + pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlob<S> {} + impl<S: State> State for SetBlob<S> { + type Blob = Set<members::blob>; type CreatedAt = S::CreatedAt; - type Blob = S::Blob; + type File = S::File; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type File = S::File; - type CreatedAt = Set<members::created_at>; type Blob = S::Blob; - } - ///State transition - sets the `blob` field to Set - pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlob<S> {} - impl<S: State> State for SetBlob<S> { + type CreatedAt = Set<members::created_at>; type File = S::File; + } + ///State transition - sets the `file` field to Set + pub struct SetFile<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFile<S> {} + impl<S: State> State for SetFile<S> { + type Blob = S::Blob; type CreatedAt = S::CreatedAt; - type Blob = Set<members::blob>; + type File = Set<members::file>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `file` field - pub struct file(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `blob` field pub struct blob(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `file` field + pub struct file(()); } } @@ -925,9 +925,9 @@ where impl<'a, S> AqfileBuilder<'a, S> where S: aqfile_state::State, - S::File: aqfile_state::IsSet, - S::CreatedAt: aqfile_state::IsSet, S::Blob: aqfile_state::IsSet, + S::CreatedAt: aqfile_state::IsSet, + S::File: aqfile_state::IsSet, { /// Build the final struct pub fn build(self) -> Aqfile<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/collection.rs b/crates/jacquard-api/src/net_anisota/beta/game/collection.rs index e007ce31..8f86fa12 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/collection.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/collection.rs @@ -91,67 +91,67 @@ pub mod collection_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AcquiredAt; type SpecimenId; - type CreatedAt; type Quantity; + type CreatedAt; + type AcquiredAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AcquiredAt = Unset; type SpecimenId = Unset; - type CreatedAt = Unset; type Quantity = Unset; - } - ///State transition - sets the `acquired_at` field to Set - pub struct SetAcquiredAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAcquiredAt<S> {} - impl<S: State> State for SetAcquiredAt<S> { - type AcquiredAt = Set<members::acquired_at>; - type SpecimenId = S::SpecimenId; - type CreatedAt = S::CreatedAt; - type Quantity = S::Quantity; + type CreatedAt = Unset; + type AcquiredAt = Unset; } ///State transition - sets the `specimen_id` field to Set pub struct SetSpecimenId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSpecimenId<S> {} impl<S: State> State for SetSpecimenId<S> { - type AcquiredAt = S::AcquiredAt; type SpecimenId = Set<members::specimen_id>; - type CreatedAt = S::CreatedAt; type Quantity = S::Quantity; + type CreatedAt = S::CreatedAt; + type AcquiredAt = S::AcquiredAt; + } + ///State transition - sets the `quantity` field to Set + pub struct SetQuantity<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetQuantity<S> {} + impl<S: State> State for SetQuantity<S> { + type SpecimenId = S::SpecimenId; + type Quantity = Set<members::quantity>; + type CreatedAt = S::CreatedAt; + type AcquiredAt = S::AcquiredAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type AcquiredAt = S::AcquiredAt; type SpecimenId = S::SpecimenId; - type CreatedAt = Set<members::created_at>; type Quantity = S::Quantity; - } - ///State transition - sets the `quantity` field to Set - pub struct SetQuantity<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetQuantity<S> {} - impl<S: State> State for SetQuantity<S> { + type CreatedAt = Set<members::created_at>; type AcquiredAt = S::AcquiredAt; + } + ///State transition - sets the `acquired_at` field to Set + pub struct SetAcquiredAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAcquiredAt<S> {} + impl<S: State> State for SetAcquiredAt<S> { type SpecimenId = S::SpecimenId; + type Quantity = S::Quantity; type CreatedAt = S::CreatedAt; - type Quantity = Set<members::quantity>; + type AcquiredAt = Set<members::acquired_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `acquired_at` field - pub struct acquired_at(()); ///Marker type for the `specimen_id` field pub struct specimen_id(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `quantity` field pub struct quantity(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `acquired_at` field + pub struct acquired_at(()); } } @@ -532,10 +532,10 @@ impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { impl<'a, S> CollectionBuilder<'a, S> where S: collection_state::State, - S::AcquiredAt: collection_state::IsSet, S::SpecimenId: collection_state::IsSet, - S::CreatedAt: collection_state::IsSet, S::Quantity: collection_state::IsSet, + S::CreatedAt: collection_state::IsSet, + S::AcquiredAt: collection_state::IsSet, { /// Build the final struct pub fn build(self) -> Collection<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/inventory.rs b/crates/jacquard-api/src/net_anisota/beta/game/inventory.rs index b97ca4e8..5ea07ad3 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/inventory.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/inventory.rs @@ -80,67 +80,67 @@ pub mod inventory_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AcquiredAt; type CreatedAt; - type Quantity; type ItemId; + type Quantity; + type AcquiredAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AcquiredAt = Unset; type CreatedAt = Unset; - type Quantity = Unset; type ItemId = Unset; - } - ///State transition - sets the `acquired_at` field to Set - pub struct SetAcquiredAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAcquiredAt<S> {} - impl<S: State> State for SetAcquiredAt<S> { - type AcquiredAt = Set<members::acquired_at>; - type CreatedAt = S::CreatedAt; - type Quantity = S::Quantity; - type ItemId = S::ItemId; + type Quantity = Unset; + type AcquiredAt = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type AcquiredAt = S::AcquiredAt; type CreatedAt = Set<members::created_at>; - type Quantity = S::Quantity; type ItemId = S::ItemId; + type Quantity = S::Quantity; + type AcquiredAt = S::AcquiredAt; + } + ///State transition - sets the `item_id` field to Set + pub struct SetItemId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetItemId<S> {} + impl<S: State> State for SetItemId<S> { + type CreatedAt = S::CreatedAt; + type ItemId = Set<members::item_id>; + type Quantity = S::Quantity; + type AcquiredAt = S::AcquiredAt; } ///State transition - sets the `quantity` field to Set pub struct SetQuantity<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetQuantity<S> {} impl<S: State> State for SetQuantity<S> { - type AcquiredAt = S::AcquiredAt; type CreatedAt = S::CreatedAt; - type Quantity = Set<members::quantity>; type ItemId = S::ItemId; - } - ///State transition - sets the `item_id` field to Set - pub struct SetItemId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetItemId<S> {} - impl<S: State> State for SetItemId<S> { + type Quantity = Set<members::quantity>; type AcquiredAt = S::AcquiredAt; + } + ///State transition - sets the `acquired_at` field to Set + pub struct SetAcquiredAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAcquiredAt<S> {} + impl<S: State> State for SetAcquiredAt<S> { type CreatedAt = S::CreatedAt; + type ItemId = S::ItemId; type Quantity = S::Quantity; - type ItemId = Set<members::item_id>; + type AcquiredAt = Set<members::acquired_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `acquired_at` field - pub struct acquired_at(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `quantity` field - pub struct quantity(()); ///Marker type for the `item_id` field pub struct item_id(()); + ///Marker type for the `quantity` field + pub struct quantity(()); + ///Marker type for the `acquired_at` field + pub struct acquired_at(()); } } @@ -469,10 +469,10 @@ impl<'a, S: inventory_state::State> InventoryBuilder<'a, S> { impl<'a, S> InventoryBuilder<'a, S> where S: inventory_state::State, - S::AcquiredAt: inventory_state::IsSet, S::CreatedAt: inventory_state::IsSet, - S::Quantity: inventory_state::IsSet, S::ItemId: inventory_state::IsSet, + S::Quantity: inventory_state::IsSet, + S::AcquiredAt: inventory_state::IsSet, { /// Build the final struct pub fn build(self) -> Inventory<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/log.rs b/crates/jacquard-api/src/net_anisota/beta/game/log.rs index c9318248..f8a51e29 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/log.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/log.rs @@ -1403,50 +1403,50 @@ pub mod log_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type SessionId; - type EventType; type Timestamp; + type EventType; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type SessionId = Unset; - type EventType = Unset; type Timestamp = Unset; + type EventType = Unset; } ///State transition - sets the `session_id` field to Set pub struct SetSessionId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSessionId<S> {} impl<S: State> State for SetSessionId<S> { type SessionId = Set<members::session_id>; - type EventType = S::EventType; - type Timestamp = S::Timestamp; - } - ///State transition - sets the `event_type` field to Set - pub struct SetEventType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEventType<S> {} - impl<S: State> State for SetEventType<S> { - type SessionId = S::SessionId; - type EventType = Set<members::event_type>; type Timestamp = S::Timestamp; + type EventType = S::EventType; } ///State transition - sets the `timestamp` field to Set pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTimestamp<S> {} impl<S: State> State for SetTimestamp<S> { type SessionId = S::SessionId; - type EventType = S::EventType; type Timestamp = Set<members::timestamp>; + type EventType = S::EventType; + } + ///State transition - sets the `event_type` field to Set + pub struct SetEventType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEventType<S> {} + impl<S: State> State for SetEventType<S> { + type SessionId = S::SessionId; + type Timestamp = S::Timestamp; + type EventType = Set<members::event_type>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `session_id` field pub struct session_id(()); - ///Marker type for the `event_type` field - pub struct event_type(()); ///Marker type for the `timestamp` field pub struct timestamp(()); + ///Marker type for the `event_type` field + pub struct event_type(()); } } @@ -1779,8 +1779,8 @@ impl<'a, S> LogBuilder<'a, S> where S: log_state::State, S::SessionId: log_state::IsSet, - S::EventType: log_state::IsSet, S::Timestamp: log_state::IsSet, + S::EventType: log_state::IsSet, { /// Build the final struct pub fn build(self) -> Log<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/pack.rs b/crates/jacquard-api/src/net_anisota/beta/game/pack.rs index 466cf69f..aaeaa66a 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/pack.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/pack.rs @@ -50,67 +50,67 @@ pub mod pack_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type TotalOpens; - type Streak; type CreatedAt; type LastOpenTime; + type Streak; + type TotalOpens; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type TotalOpens = Unset; - type Streak = Unset; type CreatedAt = Unset; type LastOpenTime = Unset; - } - ///State transition - sets the `total_opens` field to Set - pub struct SetTotalOpens<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTotalOpens<S> {} - impl<S: State> State for SetTotalOpens<S> { - type TotalOpens = Set<members::total_opens>; - type Streak = S::Streak; - type CreatedAt = S::CreatedAt; - type LastOpenTime = S::LastOpenTime; - } - ///State transition - sets the `streak` field to Set - pub struct SetStreak<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStreak<S> {} - impl<S: State> State for SetStreak<S> { - type TotalOpens = S::TotalOpens; - type Streak = Set<members::streak>; - type CreatedAt = S::CreatedAt; - type LastOpenTime = S::LastOpenTime; + type Streak = Unset; + type TotalOpens = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type TotalOpens = S::TotalOpens; - type Streak = S::Streak; type CreatedAt = Set<members::created_at>; type LastOpenTime = S::LastOpenTime; + type Streak = S::Streak; + type TotalOpens = S::TotalOpens; } ///State transition - sets the `last_open_time` field to Set pub struct SetLastOpenTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLastOpenTime<S> {} impl<S: State> State for SetLastOpenTime<S> { - type TotalOpens = S::TotalOpens; - type Streak = S::Streak; type CreatedAt = S::CreatedAt; type LastOpenTime = Set<members::last_open_time>; + type Streak = S::Streak; + type TotalOpens = S::TotalOpens; + } + ///State transition - sets the `streak` field to Set + pub struct SetStreak<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreak<S> {} + impl<S: State> State for SetStreak<S> { + type CreatedAt = S::CreatedAt; + type LastOpenTime = S::LastOpenTime; + type Streak = Set<members::streak>; + type TotalOpens = S::TotalOpens; + } + ///State transition - sets the `total_opens` field to Set + pub struct SetTotalOpens<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTotalOpens<S> {} + impl<S: State> State for SetTotalOpens<S> { + type CreatedAt = S::CreatedAt; + type LastOpenTime = S::LastOpenTime; + type Streak = S::Streak; + type TotalOpens = Set<members::total_opens>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `total_opens` field - pub struct total_opens(()); - ///Marker type for the `streak` field - pub struct streak(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `last_open_time` field pub struct last_open_time(()); + ///Marker type for the `streak` field + pub struct streak(()); + ///Marker type for the `total_opens` field + pub struct total_opens(()); } } @@ -281,10 +281,10 @@ where impl<'a, S> PackBuilder<'a, S> where S: pack_state::State, - S::TotalOpens: pack_state::IsSet, - S::Streak: pack_state::IsSet, S::CreatedAt: pack_state::IsSet, S::LastOpenTime: pack_state::IsSet, + S::Streak: pack_state::IsSet, + S::TotalOpens: pack_state::IsSet, { /// Build the final struct pub fn build(self) -> Pack<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/progress.rs b/crates/jacquard-api/src/net_anisota/beta/game/progress.rs index 3f8d684f..b604eaf3 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/progress.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/progress.rs @@ -79,85 +79,85 @@ pub mod progress_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type ProgressPercentage; type Level; + type CreatedAt; type TotalXp; - type ProgressPercentage; type XpToNextLevel; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type ProgressPercentage = Unset; type Level = Unset; + type CreatedAt = Unset; type TotalXp = Unset; - type ProgressPercentage = Unset; type XpToNextLevel = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `progress_percentage` field to Set + pub struct SetProgressPercentage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetProgressPercentage<S> {} + impl<S: State> State for SetProgressPercentage<S> { + type ProgressPercentage = Set<members::progress_percentage>; + type Level = S::Level; + type CreatedAt = S::CreatedAt; + type TotalXp = S::TotalXp; + type XpToNextLevel = S::XpToNextLevel; } ///State transition - sets the `level` field to Set pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLevel<S> {} impl<S: State> State for SetLevel<S> { + type ProgressPercentage = S::ProgressPercentage; type Level = Set<members::level>; + type CreatedAt = S::CreatedAt; type TotalXp = S::TotalXp; + type XpToNextLevel = S::XpToNextLevel; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type ProgressPercentage = S::ProgressPercentage; + type Level = S::Level; + type CreatedAt = Set<members::created_at>; + type TotalXp = S::TotalXp; type XpToNextLevel = S::XpToNextLevel; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `total_xp` field to Set pub struct SetTotalXp<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTotalXp<S> {} impl<S: State> State for SetTotalXp<S> { - type Level = S::Level; - type TotalXp = Set<members::total_xp>; type ProgressPercentage = S::ProgressPercentage; - type XpToNextLevel = S::XpToNextLevel; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `progress_percentage` field to Set - pub struct SetProgressPercentage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetProgressPercentage<S> {} - impl<S: State> State for SetProgressPercentage<S> { type Level = S::Level; - type TotalXp = S::TotalXp; - type ProgressPercentage = Set<members::progress_percentage>; - type XpToNextLevel = S::XpToNextLevel; type CreatedAt = S::CreatedAt; + type TotalXp = Set<members::total_xp>; + type XpToNextLevel = S::XpToNextLevel; } ///State transition - sets the `xp_to_next_level` field to Set pub struct SetXpToNextLevel<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetXpToNextLevel<S> {} impl<S: State> State for SetXpToNextLevel<S> { - type Level = S::Level; - type TotalXp = S::TotalXp; type ProgressPercentage = S::ProgressPercentage; - type XpToNextLevel = Set<members::xp_to_next_level>; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type Level = S::Level; + type CreatedAt = S::CreatedAt; type TotalXp = S::TotalXp; - type ProgressPercentage = S::ProgressPercentage; - type XpToNextLevel = S::XpToNextLevel; - type CreatedAt = Set<members::created_at>; + type XpToNextLevel = Set<members::xp_to_next_level>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `progress_percentage` field + pub struct progress_percentage(()); ///Marker type for the `level` field pub struct level(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `total_xp` field pub struct total_xp(()); - ///Marker type for the `progress_percentage` field - pub struct progress_percentage(()); ///Marker type for the `xp_to_next_level` field pub struct xp_to_next_level(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -491,11 +491,11 @@ where impl<'a, S> ProgressBuilder<'a, S> where S: progress_state::State, + S::ProgressPercentage: progress_state::IsSet, S::Level: progress_state::IsSet, + S::CreatedAt: progress_state::IsSet, S::TotalXp: progress_state::IsSet, - S::ProgressPercentage: progress_state::IsSet, S::XpToNextLevel: progress_state::IsSet, - S::CreatedAt: progress_state::IsSet, { /// Build the final struct pub fn build(self) -> Progress<'a> { diff --git a/crates/jacquard-api/src/net_anisota/beta/game/session.rs b/crates/jacquard-api/src/net_anisota/beta/game/session.rs index 9bb3fd08..1dc464a3 100644 --- a/crates/jacquard-api/src/net_anisota/beta/game/session.rs +++ b/crates/jacquard-api/src/net_anisota/beta/game/session.rs @@ -1080,67 +1080,67 @@ pub mod session_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ClientVersion; - type Platform; type StartedAt; type Status; + type ClientVersion; + type Platform; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ClientVersion = Unset; - type Platform = Unset; type StartedAt = Unset; type Status = Unset; - } - ///State transition - sets the `client_version` field to Set - pub struct SetClientVersion<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetClientVersion<S> {} - impl<S: State> State for SetClientVersion<S> { - type ClientVersion = Set<members::client_version>; - type Platform = S::Platform; - type StartedAt = S::StartedAt; - type Status = S::Status; - } - ///State transition - sets the `platform` field to Set - pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPlatform<S> {} - impl<S: State> State for SetPlatform<S> { - type ClientVersion = S::ClientVersion; - type Platform = Set<members::platform>; - type StartedAt = S::StartedAt; - type Status = S::Status; + type ClientVersion = Unset; + type Platform = Unset; } ///State transition - sets the `started_at` field to Set pub struct SetStartedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStartedAt<S> {} impl<S: State> State for SetStartedAt<S> { - type ClientVersion = S::ClientVersion; - type Platform = S::Platform; type StartedAt = Set<members::started_at>; type Status = S::Status; + type ClientVersion = S::ClientVersion; + type Platform = S::Platform; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { + type StartedAt = S::StartedAt; + type Status = Set<members::status>; type ClientVersion = S::ClientVersion; type Platform = S::Platform; + } + ///State transition - sets the `client_version` field to Set + pub struct SetClientVersion<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetClientVersion<S> {} + impl<S: State> State for SetClientVersion<S> { type StartedAt = S::StartedAt; - type Status = Set<members::status>; + type Status = S::Status; + type ClientVersion = Set<members::client_version>; + type Platform = S::Platform; + } + ///State transition - sets the `platform` field to Set + pub struct SetPlatform<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlatform<S> {} + impl<S: State> State for SetPlatform<S> { + type StartedAt = S::StartedAt; + type Status = S::Status; + type ClientVersion = S::ClientVersion; + type Platform = Set<members::platform>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `client_version` field - pub struct client_version(()); - ///Marker type for the `platform` field - pub struct platform(()); ///Marker type for the `started_at` field pub struct started_at(()); ///Marker type for the `status` field pub struct status(()); + ///Marker type for the `client_version` field + pub struct client_version(()); + ///Marker type for the `platform` field + pub struct platform(()); } } @@ -1533,10 +1533,10 @@ impl<'a, S: session_state::State> SessionBuilder<'a, S> { impl<'a, S> SessionBuilder<'a, S> where S: session_state::State, - S::ClientVersion: session_state::IsSet, - S::Platform: session_state::IsSet, S::StartedAt: session_state::IsSet, S::Status: session_state::IsSet, + S::ClientVersion: session_state::IsSet, + S::Platform: session_state::IsSet, { /// Build the final struct pub fn build(self) -> Session<'a> { diff --git a/crates/jacquard-api/src/net_anisota/feed/like.rs b/crates/jacquard-api/src/net_anisota/feed/like.rs index c46eef15..ab6d3676 100644 --- a/crates/jacquard-api/src/net_anisota/feed/like.rs +++ b/crates/jacquard-api/src/net_anisota/feed/like.rs @@ -35,37 +35,37 @@ pub mod like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> LikeBuilder<'a, S> where S: like_state::State, - S::CreatedAt: like_state::IsSet, S::Subject: like_state::IsSet, + S::CreatedAt: like_state::IsSet, { /// Build the final struct pub fn build(self) -> Like<'a> { diff --git a/crates/jacquard-api/src/net_anisota/feed/list_item.rs b/crates/jacquard-api/src/net_anisota/feed/list_item.rs index 925b1c97..cfaa4428 100644 --- a/crates/jacquard-api/src/net_anisota/feed/list_item.rs +++ b/crates/jacquard-api/src/net_anisota/feed/list_item.rs @@ -38,51 +38,51 @@ pub mod list_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type List; type CreatedAt; type Subject; - type List; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type List = Unset; type CreatedAt = Unset; type Subject = Unset; - type List = Unset; + } + ///State transition - sets the `list` field to Set + pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetList<S> {} + impl<S: State> State for SetList<S> { + type List = Set<members::list>; + type CreatedAt = S::CreatedAt; + type Subject = S::Subject; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type List = S::List; type CreatedAt = Set<members::created_at>; type Subject = S::Subject; - type List = S::List; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; - type Subject = Set<members::subject>; type List = S::List; - } - ///State transition - sets the `list` field to Set - pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetList<S> {} - impl<S: State> State for SetList<S> { type CreatedAt = S::CreatedAt; - type Subject = S::Subject; - type List = Set<members::list>; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `list` field + pub struct list(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); - ///Marker type for the `list` field - pub struct list(()); } } @@ -175,9 +175,9 @@ where impl<'a, S> ListItemBuilder<'a, S> where S: list_item_state::State, + S::List: list_item_state::IsSet, S::CreatedAt: list_item_state::IsSet, S::Subject: list_item_state::IsSet, - S::List: list_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ListItem<'a> { diff --git a/crates/jacquard-api/src/net_anisota/feed/post.rs b/crates/jacquard-api/src/net_anisota/feed/post.rs index 3932f07d..4021538c 100644 --- a/crates/jacquard-api/src/net_anisota/feed/post.rs +++ b/crates/jacquard-api/src/net_anisota/feed/post.rs @@ -56,37 +56,37 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Text; type CreatedAt; + type Text; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Text = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `text` field to Set - pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetText<S> {} - impl<S: State> State for SetText<S> { - type Text = Set<members::text>; - type CreatedAt = S::CreatedAt; + type Text = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Text = S::Text; type CreatedAt = Set<members::created_at>; + type Text = S::Text; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type CreatedAt = S::CreatedAt; + type Text = Set<members::text>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `text` field - pub struct text(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `text` field + pub struct text(()); } } @@ -273,8 +273,8 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::Text: post_state::IsSet, S::CreatedAt: post_state::IsSet, + S::Text: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/net_anisota/harvest/minigame.rs b/crates/jacquard-api/src/net_anisota/harvest/minigame.rs index 10ec9d44..94a91f0c 100644 --- a/crates/jacquard-api/src/net_anisota/harvest/minigame.rs +++ b/crates/jacquard-api/src/net_anisota/harvest/minigame.rs @@ -80,85 +80,85 @@ pub mod minigame_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type PlayedAt; + type ShapesCollected; type RoundDuration; - type FinalScore; type GameContext; - type ShapesCollected; + type PlayedAt; + type FinalScore; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type PlayedAt = Unset; + type ShapesCollected = Unset; type RoundDuration = Unset; - type FinalScore = Unset; type GameContext = Unset; - type ShapesCollected = Unset; + type PlayedAt = Unset; + type FinalScore = Unset; } - ///State transition - sets the `played_at` field to Set - pub struct SetPlayedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPlayedAt<S> {} - impl<S: State> State for SetPlayedAt<S> { - type PlayedAt = Set<members::played_at>; + ///State transition - sets the `shapes_collected` field to Set + pub struct SetShapesCollected<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetShapesCollected<S> {} + impl<S: State> State for SetShapesCollected<S> { + type ShapesCollected = Set<members::shapes_collected>; type RoundDuration = S::RoundDuration; - type FinalScore = S::FinalScore; type GameContext = S::GameContext; - type ShapesCollected = S::ShapesCollected; + type PlayedAt = S::PlayedAt; + type FinalScore = S::FinalScore; } ///State transition - sets the `round_duration` field to Set pub struct SetRoundDuration<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRoundDuration<S> {} impl<S: State> State for SetRoundDuration<S> { - type PlayedAt = S::PlayedAt; + type ShapesCollected = S::ShapesCollected; type RoundDuration = Set<members::round_duration>; - type FinalScore = S::FinalScore; type GameContext = S::GameContext; - type ShapesCollected = S::ShapesCollected; - } - ///State transition - sets the `final_score` field to Set - pub struct SetFinalScore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFinalScore<S> {} - impl<S: State> State for SetFinalScore<S> { type PlayedAt = S::PlayedAt; - type RoundDuration = S::RoundDuration; - type FinalScore = Set<members::final_score>; - type GameContext = S::GameContext; - type ShapesCollected = S::ShapesCollected; + type FinalScore = S::FinalScore; } ///State transition - sets the `game_context` field to Set pub struct SetGameContext<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGameContext<S> {} impl<S: State> State for SetGameContext<S> { - type PlayedAt = S::PlayedAt; + type ShapesCollected = S::ShapesCollected; type RoundDuration = S::RoundDuration; - type FinalScore = S::FinalScore; type GameContext = Set<members::game_context>; - type ShapesCollected = S::ShapesCollected; - } - ///State transition - sets the `shapes_collected` field to Set - pub struct SetShapesCollected<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetShapesCollected<S> {} - impl<S: State> State for SetShapesCollected<S> { type PlayedAt = S::PlayedAt; + type FinalScore = S::FinalScore; + } + ///State transition - sets the `played_at` field to Set + pub struct SetPlayedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlayedAt<S> {} + impl<S: State> State for SetPlayedAt<S> { + type ShapesCollected = S::ShapesCollected; type RoundDuration = S::RoundDuration; + type GameContext = S::GameContext; + type PlayedAt = Set<members::played_at>; type FinalScore = S::FinalScore; + } + ///State transition - sets the `final_score` field to Set + pub struct SetFinalScore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFinalScore<S> {} + impl<S: State> State for SetFinalScore<S> { + type ShapesCollected = S::ShapesCollected; + type RoundDuration = S::RoundDuration; type GameContext = S::GameContext; - type ShapesCollected = Set<members::shapes_collected>; + type PlayedAt = S::PlayedAt; + type FinalScore = Set<members::final_score>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `played_at` field - pub struct played_at(()); + ///Marker type for the `shapes_collected` field + pub struct shapes_collected(()); ///Marker type for the `round_duration` field pub struct round_duration(()); - ///Marker type for the `final_score` field - pub struct final_score(()); ///Marker type for the `game_context` field pub struct game_context(()); - ///Marker type for the `shapes_collected` field - pub struct shapes_collected(()); + ///Marker type for the `played_at` field + pub struct played_at(()); + ///Marker type for the `final_score` field + pub struct final_score(()); } } @@ -499,11 +499,11 @@ impl<'a, S: minigame_state::State> MinigameBuilder<'a, S> { impl<'a, S> MinigameBuilder<'a, S> where S: minigame_state::State, - S::PlayedAt: minigame_state::IsSet, + S::ShapesCollected: minigame_state::IsSet, S::RoundDuration: minigame_state::IsSet, - S::FinalScore: minigame_state::IsSet, S::GameContext: minigame_state::IsSet, - S::ShapesCollected: minigame_state::IsSet, + S::PlayedAt: minigame_state::IsSet, + S::FinalScore: minigame_state::IsSet, { /// Build the final struct pub fn build(self) -> Minigame<'a> { diff --git a/crates/jacquard-api/src/net_anisota/settings.rs b/crates/jacquard-api/src/net_anisota/settings.rs index 1e67ffd8..75b033e6 100644 --- a/crates/jacquard-api/src/net_anisota/settings.rs +++ b/crates/jacquard-api/src/net_anisota/settings.rs @@ -4166,51 +4166,51 @@ pub mod settings_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UpdatedAt; type Version; type CreatedAt; + type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UpdatedAt = Unset; type Version = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type UpdatedAt = Set<members::updated_at>; - type Version = S::Version; - type CreatedAt = S::CreatedAt; + type UpdatedAt = Unset; } ///State transition - sets the `version` field to Set pub struct SetVersion<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVersion<S> {} impl<S: State> State for SetVersion<S> { - type UpdatedAt = S::UpdatedAt; type Version = Set<members::version>; type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type UpdatedAt = S::UpdatedAt; type Version = S::Version; type CreatedAt = Set<members::created_at>; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type Version = S::Version; + type CreatedAt = S::CreatedAt; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `version` field pub struct version(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); } } @@ -4400,9 +4400,9 @@ where impl<'a, S> SettingsBuilder<'a, S> where S: settings_state::State, - S::UpdatedAt: settings_state::IsSet, S::Version: settings_state::IsSet, S::CreatedAt: settings_state::IsSet, + S::UpdatedAt: settings_state::IsSet, { /// Build the final struct pub fn build(self) -> Settings<'a> { diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle.rs index 37fa4a8a..7069670f 100644 --- a/crates/jacquard-api/src/net_asadaame5121/at_circle.rs +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle.rs @@ -8,6 +8,7 @@ pub mod banner; pub mod block; pub mod member; +pub mod request; pub mod ring; #[jacquard_derive::lexicon] diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle/banner.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle/banner.rs index 92ec62ab..c2e2ff0b 100644 --- a/crates/jacquard-api/src/net_asadaame5121/at_circle/banner.rs +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle/banner.rs @@ -35,49 +35,49 @@ pub mod banner_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Ring; + type CreatedAt; type Banner; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Ring = Unset; + type CreatedAt = Unset; type Banner = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Ring = S::Ring; - type Banner = S::Banner; - } ///State transition - sets the `ring` field to Set pub struct SetRing<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRing<S> {} impl<S: State> State for SetRing<S> { - type CreatedAt = S::CreatedAt; type Ring = Set<members::ring>; + type CreatedAt = S::CreatedAt; + type Banner = S::Banner; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Ring = S::Ring; + type CreatedAt = Set<members::created_at>; type Banner = S::Banner; } ///State transition - sets the `banner` field to Set pub struct SetBanner<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBanner<S> {} impl<S: State> State for SetBanner<S> { - type CreatedAt = S::CreatedAt; type Ring = S::Ring; + type CreatedAt = S::CreatedAt; type Banner = Set<members::banner>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `ring` field pub struct ring(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `banner` field pub struct banner(()); } @@ -172,8 +172,8 @@ where impl<'a, S> BannerBuilder<'a, S> where S: banner_state::State, - S::CreatedAt: banner_state::IsSet, S::Ring: banner_state::IsSet, + S::CreatedAt: banner_state::IsSet, S::Banner: banner_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle/block.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle/block.rs index 6e5e6a27..f4ed4d2a 100644 --- a/crates/jacquard-api/src/net_asadaame5121/at_circle/block.rs +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle/block.rs @@ -40,51 +40,51 @@ pub mod block_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Ring; type Subject; type CreatedAt; - type Ring; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Ring = Unset; type Subject = Unset; type CreatedAt = Unset; - type Ring = Unset; + } + ///State transition - sets the `ring` field to Set + pub struct SetRing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRing<S> {} + impl<S: State> State for SetRing<S> { + type Ring = Set<members::ring>; + type Subject = S::Subject; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { + type Ring = S::Ring; type Subject = Set<members::subject>; type CreatedAt = S::CreatedAt; - type Ring = S::Ring; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Subject = S::Subject; - type CreatedAt = Set<members::created_at>; type Ring = S::Ring; - } - ///State transition - sets the `ring` field to Set - pub struct SetRing<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRing<S> {} - impl<S: State> State for SetRing<S> { type Subject = S::Subject; - type CreatedAt = S::CreatedAt; - type Ring = Set<members::ring>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `ring` field + pub struct ring(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `ring` field - pub struct ring(()); } } @@ -194,9 +194,9 @@ where impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, + S::Ring: block_state::IsSet, S::Subject: block_state::IsSet, S::CreatedAt: block_state::IsSet, - S::Ring: block_state::IsSet, { /// Build the final struct pub fn build(self) -> Block<'a> { diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle/member.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle/member.rs index 314f1423..48366014 100644 --- a/crates/jacquard-api/src/net_asadaame5121/at_circle/member.rs +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle/member.rs @@ -47,67 +47,67 @@ pub mod member_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; + type Title; type Ring; + type Url; type CreatedAt; - type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; + type Title = Unset; type Ring = Unset; + type Url = Unset; type CreatedAt = Unset; - type Title = Unset; } - ///State transition - sets the `url` field to Set - pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUrl<S> {} - impl<S: State> State for SetUrl<S> { - type Url = Set<members::url>; + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; type Ring = S::Ring; + type Url = S::Url; type CreatedAt = S::CreatedAt; - type Title = S::Title; } ///State transition - sets the `ring` field to Set pub struct SetRing<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRing<S> {} impl<S: State> State for SetRing<S> { - type Url = S::Url; + type Title = S::Title; type Ring = Set<members::ring>; + type Url = S::Url; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { type Title = S::Title; + type Ring = S::Ring; + type Url = Set<members::url>; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Url = S::Url; - type Ring = S::Ring; - type CreatedAt = Set<members::created_at>; type Title = S::Title; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Url = S::Url; type Ring = S::Ring; - type CreatedAt = S::CreatedAt; - type Title = Set<members::title>; + type Url = S::Url; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `ring` field pub struct ring(()); + ///Marker type for the `url` field + pub struct url(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `title` field - pub struct title(()); } } @@ -257,10 +257,10 @@ where impl<'a, S> MemberBuilder<'a, S> where S: member_state::State, - S::Url: member_state::IsSet, + S::Title: member_state::IsSet, S::Ring: member_state::IsSet, + S::Url: member_state::IsSet, S::CreatedAt: member_state::IsSet, - S::Title: member_state::IsSet, { /// Build the final struct pub fn build(self) -> Member<'a> { diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle/request.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle/request.rs new file mode 100644 index 00000000..47da5da3 --- /dev/null +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle/request.rs @@ -0,0 +1,586 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: net.asadaame5121.at-circle.request +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A request to join a webring +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Request<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// Introduction message + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub message: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(borrow)] + pub ring: crate::net_asadaame5121::at_circle::RingRef<'a>, + /// RSS feed URL of the site + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub rss_url: std::option::Option<jacquard_common::types::string::Uri<'a>>, + /// Title of the site + #[serde(borrow)] + pub site_title: jacquard_common::CowStr<'a>, + /// URL of the site to register + #[serde(borrow)] + pub site_url: jacquard_common::types::string::Uri<'a>, +} + +pub mod request_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Ring; + type SiteUrl; + type SiteTitle; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Ring = Unset; + type SiteUrl = Unset; + type SiteTitle = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `ring` field to Set + pub struct SetRing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRing<S> {} + impl<S: State> State for SetRing<S> { + type Ring = Set<members::ring>; + type SiteUrl = S::SiteUrl; + type SiteTitle = S::SiteTitle; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `site_url` field to Set + pub struct SetSiteUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSiteUrl<S> {} + impl<S: State> State for SetSiteUrl<S> { + type Ring = S::Ring; + type SiteUrl = Set<members::site_url>; + type SiteTitle = S::SiteTitle; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `site_title` field to Set + pub struct SetSiteTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSiteTitle<S> {} + impl<S: State> State for SetSiteTitle<S> { + type Ring = S::Ring; + type SiteUrl = S::SiteUrl; + type SiteTitle = Set<members::site_title>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Ring = S::Ring; + type SiteUrl = S::SiteUrl; + type SiteTitle = S::SiteTitle; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `ring` field + pub struct ring(()); + ///Marker type for the `site_url` field + pub struct site_url(()); + ///Marker type for the `site_title` field + pub struct site_title(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RequestBuilder<'a, S: request_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<crate::net_asadaame5121::at_circle::RingRef<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Request<'a> { + /// Create a new builder for this type + pub fn new() -> RequestBuilder<'a, request_state::Empty> { + RequestBuilder::new() + } +} + +impl<'a> RequestBuilder<'a, request_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::CreatedAt: request_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RequestBuilder<'a, request_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `message` field (optional) + pub fn message( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `message` field to an Option value (optional) + pub fn maybe_message(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::Ring: request_state::IsUnset, +{ + /// Set the `ring` field (required) + pub fn ring( + mut self, + value: impl Into<crate::net_asadaame5121::at_circle::RingRef<'a>>, + ) -> RequestBuilder<'a, request_state::SetRing<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `rssUrl` field (optional) + pub fn rss_url( + mut self, + value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `rssUrl` field to an Option value (optional) + pub fn maybe_rss_url( + mut self, + value: Option<jacquard_common::types::string::Uri<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::SiteTitle: request_state::IsUnset, +{ + /// Set the `siteTitle` field (required) + pub fn site_title( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> RequestBuilder<'a, request_state::SetSiteTitle<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::SiteUrl: request_state::IsUnset, +{ + /// Set the `siteUrl` field (required) + pub fn site_url( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> RequestBuilder<'a, request_state::SetSiteUrl<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::Ring: request_state::IsSet, + S::SiteUrl: request_state::IsSet, + S::SiteTitle: request_state::IsSet, + S::CreatedAt: request_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Request<'a> { + Request { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1, + ring: self.__unsafe_private_named.2.unwrap(), + rss_url: self.__unsafe_private_named.3, + site_title: self.__unsafe_private_named.4.unwrap(), + site_url: self.__unsafe_private_named.5.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Request<'a> { + Request { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1, + ring: self.__unsafe_private_named.2.unwrap(), + rss_url: self.__unsafe_private_named.3, + site_title: self.__unsafe_private_named.4.unwrap(), + site_url: self.__unsafe_private_named.5.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Request<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, RequestRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Request<'a>, +} + +impl From<RequestGetRecordOutput<'_>> for Request<'_> { + fn from(output: RequestGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Request<'_> { + const NSID: &'static str = "net.asadaame5121.at-circle.request"; + type Record = RequestRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct RequestRecord; +impl jacquard_common::xrpc::XrpcResp for RequestRecord { + const NSID: &'static str = "net.asadaame5121.at-circle.request"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = RequestGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for RequestRecord { + const NSID: &'static str = "net.asadaame5121.at-circle.request"; + type Record = RequestRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Request<'a> { + fn nsid() -> &'static str { + "net.asadaame5121.at-circle.request" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_net_asadaame5121_at_circle_request() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.message { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.message { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 100usize, + actual: count, + }); + } + } + } + { + let value = &self.site_title; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "site_title", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.site_title; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "site_title", + ), + max: 100usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_net_asadaame5121_at_circle_request() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("net.asadaame5121.at-circle.request"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A request to join a webring", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("ring"), + ::jacquard_common::smol_str::SmolStr::new_static("siteUrl"), + ::jacquard_common::smol_str::SmolStr::new_static("siteTitle"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("message"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Introduction message", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(100usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("ring"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "net.asadaame5121.at-circle.defs#ringRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("rssUrl"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "RSS feed URL of the site", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "siteTitle", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Title of the site"), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(100usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("siteUrl"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "URL of the site to register", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/net_asadaame5121/at_circle/ring.rs b/crates/jacquard-api/src/net_asadaame5121/at_circle/ring.rs index ca3cec01..25929c47 100644 --- a/crates/jacquard-api/src/net_asadaame5121/at_circle/ring.rs +++ b/crates/jacquard-api/src/net_asadaame5121/at_circle/ring.rs @@ -45,49 +45,49 @@ pub mod ring_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; type Title; + type Status; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; type Title = Unset; + type Status = Unset; type CreatedAt = Unset; } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Status = S::Status; type Title = Set<members::title>; + type Status = S::Status; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type Title = S::Title; + type Status = Set<members::status>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Status = S::Status; type Title = S::Title; + type Status = S::Status; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `status` field + pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -222,8 +222,8 @@ where impl<'a, S> RingBuilder<'a, S> where S: ring_state::State, - S::Status: ring_state::IsSet, S::Title: ring_state::IsSet, + S::Status: ring_state::IsSet, S::CreatedAt: ring_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/net_mmatt/vitals/car.rs b/crates/jacquard-api/src/net_mmatt/vitals/car.rs index 624d1b73..99691b7a 100644 --- a/crates/jacquard-api/src/net_mmatt/vitals/car.rs +++ b/crates/jacquard-api/src/net_mmatt/vitals/car.rs @@ -52,85 +52,85 @@ pub mod car_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type AmountRemaining; - type CarTraveledDistance; - type CreatedAt; type CarPercentFuelRemaining; + type AmountRemaining; type CarFuelRange; + type CreatedAt; + type CarTraveledDistance; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type AmountRemaining = Unset; - type CarTraveledDistance = Unset; - type CreatedAt = Unset; type CarPercentFuelRemaining = Unset; + type AmountRemaining = Unset; type CarFuelRange = Unset; + type CreatedAt = Unset; + type CarTraveledDistance = Unset; + } + ///State transition - sets the `car_percent_fuel_remaining` field to Set + pub struct SetCarPercentFuelRemaining<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCarPercentFuelRemaining<S> {} + impl<S: State> State for SetCarPercentFuelRemaining<S> { + type CarPercentFuelRemaining = Set<members::car_percent_fuel_remaining>; + type AmountRemaining = S::AmountRemaining; + type CarFuelRange = S::CarFuelRange; + type CreatedAt = S::CreatedAt; + type CarTraveledDistance = S::CarTraveledDistance; } ///State transition - sets the `amount_remaining` field to Set pub struct SetAmountRemaining<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAmountRemaining<S> {} impl<S: State> State for SetAmountRemaining<S> { - type AmountRemaining = Set<members::amount_remaining>; - type CarTraveledDistance = S::CarTraveledDistance; - type CreatedAt = S::CreatedAt; type CarPercentFuelRemaining = S::CarPercentFuelRemaining; + type AmountRemaining = Set<members::amount_remaining>; type CarFuelRange = S::CarFuelRange; + type CreatedAt = S::CreatedAt; + type CarTraveledDistance = S::CarTraveledDistance; } - ///State transition - sets the `car_traveled_distance` field to Set - pub struct SetCarTraveledDistance<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCarTraveledDistance<S> {} - impl<S: State> State for SetCarTraveledDistance<S> { + ///State transition - sets the `car_fuel_range` field to Set + pub struct SetCarFuelRange<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCarFuelRange<S> {} + impl<S: State> State for SetCarFuelRange<S> { + type CarPercentFuelRemaining = S::CarPercentFuelRemaining; type AmountRemaining = S::AmountRemaining; - type CarTraveledDistance = Set<members::car_traveled_distance>; + type CarFuelRange = Set<members::car_fuel_range>; type CreatedAt = S::CreatedAt; - type CarPercentFuelRemaining = S::CarPercentFuelRemaining; - type CarFuelRange = S::CarFuelRange; + type CarTraveledDistance = S::CarTraveledDistance; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type AmountRemaining = S::AmountRemaining; - type CarTraveledDistance = S::CarTraveledDistance; - type CreatedAt = Set<members::created_at>; type CarPercentFuelRemaining = S::CarPercentFuelRemaining; - type CarFuelRange = S::CarFuelRange; - } - ///State transition - sets the `car_percent_fuel_remaining` field to Set - pub struct SetCarPercentFuelRemaining<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCarPercentFuelRemaining<S> {} - impl<S: State> State for SetCarPercentFuelRemaining<S> { type AmountRemaining = S::AmountRemaining; - type CarTraveledDistance = S::CarTraveledDistance; - type CreatedAt = S::CreatedAt; - type CarPercentFuelRemaining = Set<members::car_percent_fuel_remaining>; type CarFuelRange = S::CarFuelRange; + type CreatedAt = Set<members::created_at>; + type CarTraveledDistance = S::CarTraveledDistance; } - ///State transition - sets the `car_fuel_range` field to Set - pub struct SetCarFuelRange<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCarFuelRange<S> {} - impl<S: State> State for SetCarFuelRange<S> { + ///State transition - sets the `car_traveled_distance` field to Set + pub struct SetCarTraveledDistance<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCarTraveledDistance<S> {} + impl<S: State> State for SetCarTraveledDistance<S> { + type CarPercentFuelRemaining = S::CarPercentFuelRemaining; type AmountRemaining = S::AmountRemaining; - type CarTraveledDistance = S::CarTraveledDistance; + type CarFuelRange = S::CarFuelRange; type CreatedAt = S::CreatedAt; - type CarPercentFuelRemaining = S::CarPercentFuelRemaining; - type CarFuelRange = Set<members::car_fuel_range>; + type CarTraveledDistance = Set<members::car_traveled_distance>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `amount_remaining` field - pub struct amount_remaining(()); - ///Marker type for the `car_traveled_distance` field - pub struct car_traveled_distance(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `car_percent_fuel_remaining` field pub struct car_percent_fuel_remaining(()); + ///Marker type for the `amount_remaining` field + pub struct amount_remaining(()); ///Marker type for the `car_fuel_range` field pub struct car_fuel_range(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `car_traveled_distance` field + pub struct car_traveled_distance(()); } } @@ -314,11 +314,11 @@ where impl<'a, S> CarBuilder<'a, S> where S: car_state::State, - S::AmountRemaining: car_state::IsSet, - S::CarTraveledDistance: car_state::IsSet, - S::CreatedAt: car_state::IsSet, S::CarPercentFuelRemaining: car_state::IsSet, + S::AmountRemaining: car_state::IsSet, S::CarFuelRange: car_state::IsSet, + S::CreatedAt: car_state::IsSet, + S::CarTraveledDistance: car_state::IsSet, { /// Build the final struct pub fn build(self) -> Car<'a> { diff --git a/crates/jacquard-api/src/network_slices/lexicon.rs b/crates/jacquard-api/src/network_slices/lexicon.rs index 5f75b07c..755ec069 100644 --- a/crates/jacquard-api/src/network_slices/lexicon.rs +++ b/crates/jacquard-api/src/network_slices/lexicon.rs @@ -50,67 +50,67 @@ pub mod lexicon_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Slice; type Nsid; type CreatedAt; type Definitions; - type Slice; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Slice = Unset; type Nsid = Unset; type CreatedAt = Unset; type Definitions = Unset; - type Slice = Unset; + } + ///State transition - sets the `slice` field to Set + pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSlice<S> {} + impl<S: State> State for SetSlice<S> { + type Slice = Set<members::slice>; + type Nsid = S::Nsid; + type CreatedAt = S::CreatedAt; + type Definitions = S::Definitions; } ///State transition - sets the `nsid` field to Set pub struct SetNsid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNsid<S> {} impl<S: State> State for SetNsid<S> { + type Slice = S::Slice; type Nsid = Set<members::nsid>; type CreatedAt = S::CreatedAt; type Definitions = S::Definitions; - type Slice = S::Slice; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Slice = S::Slice; type Nsid = S::Nsid; type CreatedAt = Set<members::created_at>; type Definitions = S::Definitions; - type Slice = S::Slice; } ///State transition - sets the `definitions` field to Set pub struct SetDefinitions<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDefinitions<S> {} impl<S: State> State for SetDefinitions<S> { - type Nsid = S::Nsid; - type CreatedAt = S::CreatedAt; - type Definitions = Set<members::definitions>; type Slice = S::Slice; - } - ///State transition - sets the `slice` field to Set - pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSlice<S> {} - impl<S: State> State for SetSlice<S> { type Nsid = S::Nsid; type CreatedAt = S::CreatedAt; - type Definitions = S::Definitions; - type Slice = Set<members::slice>; + type Definitions = Set<members::definitions>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `slice` field + pub struct slice(()); ///Marker type for the `nsid` field pub struct nsid(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `definitions` field pub struct definitions(()); - ///Marker type for the `slice` field - pub struct slice(()); } } @@ -277,10 +277,10 @@ impl<'a, S: lexicon_state::State> LexiconBuilder<'a, S> { impl<'a, S> LexiconBuilder<'a, S> where S: lexicon_state::State, + S::Slice: lexicon_state::IsSet, S::Nsid: lexicon_state::IsSet, S::CreatedAt: lexicon_state::IsSet, S::Definitions: lexicon_state::IsSet, - S::Slice: lexicon_state::IsSet, { /// Build the final struct pub fn build(self) -> Lexicon<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice.rs b/crates/jacquard-api/src/network_slices/slice.rs index ace03afc..96b834a6 100644 --- a/crates/jacquard-api/src/network_slices/slice.rs +++ b/crates/jacquard-api/src/network_slices/slice.rs @@ -54,49 +54,49 @@ pub mod slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Domain; + type CreatedAt; type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Domain = Unset; + type CreatedAt = Unset; type Name = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Domain = S::Domain; - type Name = S::Name; - } ///State transition - sets the `domain` field to Set pub struct SetDomain<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDomain<S> {} impl<S: State> State for SetDomain<S> { - type CreatedAt = S::CreatedAt; type Domain = Set<members::domain>; + type CreatedAt = S::CreatedAt; + type Name = S::Name; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Domain = S::Domain; + type CreatedAt = Set<members::created_at>; type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Domain = S::Domain; + type CreatedAt = S::CreatedAt; type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `domain` field pub struct domain(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); } @@ -191,8 +191,8 @@ where impl<'a, S> SliceBuilder<'a, S> where S: slice_state::State, - S::CreatedAt: slice_state::IsSet, S::Domain: slice_state::IsSet, + S::CreatedAt: slice_state::IsSet, S::Name: slice_state::IsSet, { /// Build the final struct @@ -481,105 +481,105 @@ pub mod slice_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Domain; + type CreatedAt; type Cid; + type Name; type Creator; - type CreatedAt; type Uri; - type Domain; - type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Domain = Unset; + type CreatedAt = Unset; type Cid = Unset; + type Name = Unset; type Creator = Unset; - type CreatedAt = Unset; type Uri = Unset; - type Domain = Unset; - type Name = Unset; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type Creator = S::Creator; + ///State transition - sets the `domain` field to Set + pub struct SetDomain<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDomain<S> {} + impl<S: State> State for SetDomain<S> { + type Domain = Set<members::domain>; type CreatedAt = S::CreatedAt; - type Uri = S::Uri; - type Domain = S::Domain; - type Name = S::Name; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { type Cid = S::Cid; - type Creator = Set<members::creator>; - type CreatedAt = S::CreatedAt; - type Uri = S::Uri; - type Domain = S::Domain; type Name = S::Name; + type Creator = S::Creator; + type Uri = S::Uri; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Domain = S::Domain; + type CreatedAt = Set<members::created_at>; type Cid = S::Cid; + type Name = S::Name; type Creator = S::Creator; - type CreatedAt = Set<members::created_at>; type Uri = S::Uri; - type Domain = S::Domain; - type Name = S::Name; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Cid = S::Cid; - type Creator = S::Creator; - type CreatedAt = S::CreatedAt; - type Uri = Set<members::uri>; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Domain = S::Domain; + type CreatedAt = S::CreatedAt; + type Cid = Set<members::cid>; type Name = S::Name; - } - ///State transition - sets the `domain` field to Set - pub struct SetDomain<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDomain<S> {} - impl<S: State> State for SetDomain<S> { - type Cid = S::Cid; type Creator = S::Creator; - type CreatedAt = S::CreatedAt; type Uri = S::Uri; - type Domain = Set<members::domain>; - type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type Domain = S::Domain; + type CreatedAt = S::CreatedAt; type Cid = S::Cid; + type Name = Set<members::name>; type Creator = S::Creator; + type Uri = S::Uri; + } + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type Domain = S::Domain; type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Name = S::Name; + type Creator = Set<members::creator>; type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Domain = S::Domain; - type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Name = S::Name; + type Creator = S::Creator; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `domain` field + pub struct domain(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `creator` field pub struct creator(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `domain` field - pub struct domain(()); - ///Marker type for the `name` field - pub struct name(()); } } @@ -835,12 +835,12 @@ impl<'a, S: slice_view_state::State> SliceViewBuilder<'a, S> { impl<'a, S> SliceViewBuilder<'a, S> where S: slice_view_state::State, + S::Domain: slice_view_state::IsSet, + S::CreatedAt: slice_view_state::IsSet, S::Cid: slice_view_state::IsSet, + S::Name: slice_view_state::IsSet, S::Creator: slice_view_state::IsSet, - S::CreatedAt: slice_view_state::IsSet, S::Uri: slice_view_state::IsSet, - S::Domain: slice_view_state::IsSet, - S::Name: slice_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SliceView<'a> { @@ -1199,37 +1199,37 @@ pub mod sparkline_point_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Count; type Timestamp; + type Count; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Count = Unset; type Timestamp = Unset; - } - ///State transition - sets the `count` field to Set - pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCount<S> {} - impl<S: State> State for SetCount<S> { - type Count = Set<members::count>; - type Timestamp = S::Timestamp; + type Count = Unset; } ///State transition - sets the `timestamp` field to Set pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTimestamp<S> {} impl<S: State> State for SetTimestamp<S> { - type Count = S::Count; type Timestamp = Set<members::timestamp>; + type Count = S::Count; + } + ///State transition - sets the `count` field to Set + pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCount<S> {} + impl<S: State> State for SetCount<S> { + type Timestamp = S::Timestamp; + type Count = Set<members::count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `count` field - pub struct count(()); ///Marker type for the `timestamp` field pub struct timestamp(()); + ///Marker type for the `count` field + pub struct count(()); } } @@ -1302,8 +1302,8 @@ where impl<'a, S> SparklinePointBuilder<'a, S> where S: sparkline_point_state::State, - S::Count: sparkline_point_state::IsSet, S::Timestamp: sparkline_point_state::IsSet, + S::Count: sparkline_point_state::IsSet, { /// Build the final struct pub fn build(self) -> SparklinePoint<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/create_o_auth_client.rs b/crates/jacquard-api/src/network_slices/slice/create_o_auth_client.rs index d3e2867a..f5554537 100644 --- a/crates/jacquard-api/src/network_slices/slice/create_o_auth_client.rs +++ b/crates/jacquard-api/src/network_slices/slice/create_o_auth_client.rs @@ -67,50 +67,50 @@ pub mod create_o_auth_client_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type SliceUri; - type ClientName; type RedirectUris; + type ClientName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type SliceUri = Unset; - type ClientName = Unset; type RedirectUris = Unset; + type ClientName = Unset; } ///State transition - sets the `slice_uri` field to Set pub struct SetSliceUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSliceUri<S> {} impl<S: State> State for SetSliceUri<S> { type SliceUri = Set<members::slice_uri>; - type ClientName = S::ClientName; - type RedirectUris = S::RedirectUris; - } - ///State transition - sets the `client_name` field to Set - pub struct SetClientName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetClientName<S> {} - impl<S: State> State for SetClientName<S> { - type SliceUri = S::SliceUri; - type ClientName = Set<members::client_name>; type RedirectUris = S::RedirectUris; + type ClientName = S::ClientName; } ///State transition - sets the `redirect_uris` field to Set pub struct SetRedirectUris<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRedirectUris<S> {} impl<S: State> State for SetRedirectUris<S> { type SliceUri = S::SliceUri; - type ClientName = S::ClientName; type RedirectUris = Set<members::redirect_uris>; + type ClientName = S::ClientName; + } + ///State transition - sets the `client_name` field to Set + pub struct SetClientName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetClientName<S> {} + impl<S: State> State for SetClientName<S> { + type SliceUri = S::SliceUri; + type RedirectUris = S::RedirectUris; + type ClientName = Set<members::client_name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `slice_uri` field pub struct slice_uri(()); - ///Marker type for the `client_name` field - pub struct client_name(()); ///Marker type for the `redirect_uris` field pub struct redirect_uris(()); + ///Marker type for the `client_name` field + pub struct client_name(()); } } @@ -352,8 +352,8 @@ impl<'a, S> CreateOAuthClientBuilder<'a, S> where S: create_o_auth_client_state::State, S::SliceUri: create_o_auth_client_state::IsSet, - S::ClientName: create_o_auth_client_state::IsSet, S::RedirectUris: create_o_auth_client_state::IsSet, + S::ClientName: create_o_auth_client_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateOAuthClient<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/get_actors.rs b/crates/jacquard-api/src/network_slices/slice/get_actors.rs index 7beca0e4..99cc119b 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_actors.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_actors.rs @@ -42,50 +42,50 @@ pub mod actor_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; - type IndexedAt; type SliceUri; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; - type IndexedAt = Unset; type SliceUri = Unset; + type IndexedAt = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Did = Set<members::did>; - type IndexedAt = S::IndexedAt; - type SliceUri = S::SliceUri; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Did = S::Did; - type IndexedAt = Set<members::indexed_at>; type SliceUri = S::SliceUri; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `slice_uri` field to Set pub struct SetSliceUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSliceUri<S> {} impl<S: State> State for SetSliceUri<S> { type Did = S::Did; - type IndexedAt = S::IndexedAt; type SliceUri = Set<members::slice_uri>; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Did = S::Did; + type SliceUri = S::SliceUri; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `slice_uri` field pub struct slice_uri(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -199,8 +199,8 @@ impl<'a, S> ActorBuilder<'a, S> where S: actor_state::State, S::Did: actor_state::IsSet, - S::IndexedAt: actor_state::IsSet, S::SliceUri: actor_state::IsSet, + S::IndexedAt: actor_state::IsSet, { /// Build the final struct pub fn build(self) -> Actor<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/get_job_logs.rs b/crates/jacquard-api/src/network_slices/slice/get_job_logs.rs index 88676553..ac7c30cc 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_job_logs.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_job_logs.rs @@ -58,85 +58,85 @@ pub mod log_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type LogType; + type Message; type CreatedAt; - type Level; + type LogType; type Id; - type Message; + type Level; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type LogType = Unset; + type Message = Unset; type CreatedAt = Unset; - type Level = Unset; + type LogType = Unset; type Id = Unset; - type Message = Unset; + type Level = Unset; } - ///State transition - sets the `log_type` field to Set - pub struct SetLogType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLogType<S> {} - impl<S: State> State for SetLogType<S> { - type LogType = Set<members::log_type>; + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type Message = Set<members::message>; type CreatedAt = S::CreatedAt; - type Level = S::Level; + type LogType = S::LogType; type Id = S::Id; - type Message = S::Message; + type Level = S::Level; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type LogType = S::LogType; + type Message = S::Message; type CreatedAt = Set<members::created_at>; - type Level = S::Level; + type LogType = S::LogType; type Id = S::Id; - type Message = S::Message; + type Level = S::Level; } - ///State transition - sets the `level` field to Set - pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLevel<S> {} - impl<S: State> State for SetLevel<S> { - type LogType = S::LogType; + ///State transition - sets the `log_type` field to Set + pub struct SetLogType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLogType<S> {} + impl<S: State> State for SetLogType<S> { + type Message = S::Message; type CreatedAt = S::CreatedAt; - type Level = Set<members::level>; + type LogType = Set<members::log_type>; type Id = S::Id; - type Message = S::Message; + type Level = S::Level; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { - type LogType = S::LogType; + type Message = S::Message; type CreatedAt = S::CreatedAt; - type Level = S::Level; + type LogType = S::LogType; type Id = Set<members::id>; - type Message = S::Message; + type Level = S::Level; } - ///State transition - sets the `message` field to Set - pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessage<S> {} - impl<S: State> State for SetMessage<S> { - type LogType = S::LogType; + ///State transition - sets the `level` field to Set + pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLevel<S> {} + impl<S: State> State for SetLevel<S> { + type Message = S::Message; type CreatedAt = S::CreatedAt; - type Level = S::Level; + type LogType = S::LogType; type Id = S::Id; - type Message = Set<members::message>; + type Level = Set<members::level>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `log_type` field - pub struct log_type(()); + ///Marker type for the `message` field + pub struct message(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `level` field - pub struct level(()); + ///Marker type for the `log_type` field + pub struct log_type(()); ///Marker type for the `id` field pub struct id(()); - ///Marker type for the `message` field - pub struct message(()); + ///Marker type for the `level` field + pub struct level(()); } } @@ -356,11 +356,11 @@ impl<'a, S: log_entry_state::State> LogEntryBuilder<'a, S> { impl<'a, S> LogEntryBuilder<'a, S> where S: log_entry_state::State, - S::LogType: log_entry_state::IsSet, + S::Message: log_entry_state::IsSet, S::CreatedAt: log_entry_state::IsSet, - S::Level: log_entry_state::IsSet, + S::LogType: log_entry_state::IsSet, S::Id: log_entry_state::IsSet, - S::Message: log_entry_state::IsSet, + S::Level: log_entry_state::IsSet, { /// Build the final struct pub fn build(self) -> LogEntry<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/get_job_status.rs b/crates/jacquard-api/src/network_slices/slice/get_job_status.rs index 87614111..aeef7a8d 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_job_status.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_job_status.rs @@ -55,65 +55,65 @@ pub mod job_status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Status; type CreatedAt; type JobId; - type Status; type RetryCount; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Status = Unset; type CreatedAt = Unset; type JobId = Unset; - type Status = Unset; type RetryCount = Unset; } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type Status = Set<members::status>; + type CreatedAt = S::CreatedAt; + type JobId = S::JobId; + type RetryCount = S::RetryCount; + } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Status = S::Status; type CreatedAt = Set<members::created_at>; type JobId = S::JobId; - type Status = S::Status; type RetryCount = S::RetryCount; } ///State transition - sets the `job_id` field to Set pub struct SetJobId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetJobId<S> {} impl<S: State> State for SetJobId<S> { - type CreatedAt = S::CreatedAt; - type JobId = Set<members::job_id>; type Status = S::Status; - type RetryCount = S::RetryCount; - } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { type CreatedAt = S::CreatedAt; - type JobId = S::JobId; - type Status = Set<members::status>; + type JobId = Set<members::job_id>; type RetryCount = S::RetryCount; } ///State transition - sets the `retry_count` field to Set pub struct SetRetryCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRetryCount<S> {} impl<S: State> State for SetRetryCount<S> { + type Status = S::Status; type CreatedAt = S::CreatedAt; type JobId = S::JobId; - type Status = S::Status; type RetryCount = Set<members::retry_count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `status` field + pub struct status(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `job_id` field pub struct job_id(()); - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `retry_count` field pub struct retry_count(()); } @@ -309,9 +309,9 @@ where impl<'a, S> JobStatusBuilder<'a, S> where S: job_status_state::State, + S::Status: job_status_state::IsSet, S::CreatedAt: job_status_state::IsSet, S::JobId: job_status_state::IsSet, - S::Status: job_status_state::IsSet, S::RetryCount: job_status_state::IsSet, { /// Build the final struct @@ -875,85 +875,85 @@ pub mod sync_job_result_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ReposProcessed; - type CollectionsSynced; + type Success; type TotalRecords; + type ReposProcessed; type Message; - type Success; + type CollectionsSynced; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ReposProcessed = Unset; - type CollectionsSynced = Unset; + type Success = Unset; type TotalRecords = Unset; + type ReposProcessed = Unset; type Message = Unset; - type Success = Unset; + type CollectionsSynced = Unset; } - ///State transition - sets the `repos_processed` field to Set - pub struct SetReposProcessed<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReposProcessed<S> {} - impl<S: State> State for SetReposProcessed<S> { - type ReposProcessed = Set<members::repos_processed>; - type CollectionsSynced = S::CollectionsSynced; + ///State transition - sets the `success` field to Set + pub struct SetSuccess<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSuccess<S> {} + impl<S: State> State for SetSuccess<S> { + type Success = Set<members::success>; type TotalRecords = S::TotalRecords; - type Message = S::Message; - type Success = S::Success; - } - ///State transition - sets the `collections_synced` field to Set - pub struct SetCollectionsSynced<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollectionsSynced<S> {} - impl<S: State> State for SetCollectionsSynced<S> { type ReposProcessed = S::ReposProcessed; - type CollectionsSynced = Set<members::collections_synced>; - type TotalRecords = S::TotalRecords; type Message = S::Message; - type Success = S::Success; + type CollectionsSynced = S::CollectionsSynced; } ///State transition - sets the `total_records` field to Set pub struct SetTotalRecords<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTotalRecords<S> {} impl<S: State> State for SetTotalRecords<S> { - type ReposProcessed = S::ReposProcessed; - type CollectionsSynced = S::CollectionsSynced; + type Success = S::Success; type TotalRecords = Set<members::total_records>; + type ReposProcessed = S::ReposProcessed; type Message = S::Message; + type CollectionsSynced = S::CollectionsSynced; + } + ///State transition - sets the `repos_processed` field to Set + pub struct SetReposProcessed<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReposProcessed<S> {} + impl<S: State> State for SetReposProcessed<S> { type Success = S::Success; + type TotalRecords = S::TotalRecords; + type ReposProcessed = Set<members::repos_processed>; + type Message = S::Message; + type CollectionsSynced = S::CollectionsSynced; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type ReposProcessed = S::ReposProcessed; - type CollectionsSynced = S::CollectionsSynced; - type TotalRecords = S::TotalRecords; - type Message = Set<members::message>; type Success = S::Success; - } - ///State transition - sets the `success` field to Set - pub struct SetSuccess<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSuccess<S> {} - impl<S: State> State for SetSuccess<S> { + type TotalRecords = S::TotalRecords; type ReposProcessed = S::ReposProcessed; + type Message = Set<members::message>; type CollectionsSynced = S::CollectionsSynced; + } + ///State transition - sets the `collections_synced` field to Set + pub struct SetCollectionsSynced<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollectionsSynced<S> {} + impl<S: State> State for SetCollectionsSynced<S> { + type Success = S::Success; type TotalRecords = S::TotalRecords; + type ReposProcessed = S::ReposProcessed; type Message = S::Message; - type Success = Set<members::success>; + type CollectionsSynced = Set<members::collections_synced>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repos_processed` field - pub struct repos_processed(()); - ///Marker type for the `collections_synced` field - pub struct collections_synced(()); + ///Marker type for the `success` field + pub struct success(()); ///Marker type for the `total_records` field pub struct total_records(()); + ///Marker type for the `repos_processed` field + pub struct repos_processed(()); ///Marker type for the `message` field pub struct message(()); - ///Marker type for the `success` field - pub struct success(()); + ///Marker type for the `collections_synced` field + pub struct collections_synced(()); } } @@ -1086,11 +1086,11 @@ where impl<'a, S> SyncJobResultBuilder<'a, S> where S: sync_job_result_state::State, - S::ReposProcessed: sync_job_result_state::IsSet, - S::CollectionsSynced: sync_job_result_state::IsSet, + S::Success: sync_job_result_state::IsSet, S::TotalRecords: sync_job_result_state::IsSet, + S::ReposProcessed: sync_job_result_state::IsSet, S::Message: sync_job_result_state::IsSet, - S::Success: sync_job_result_state::IsSet, + S::CollectionsSynced: sync_job_result_state::IsSet, { /// Build the final struct pub fn build(self) -> SyncJobResult<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/get_o_auth_clients.rs b/crates/jacquard-api/src/network_slices/slice/get_o_auth_clients.rs index 54e7aee1..12d1f1d0 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_o_auth_clients.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_o_auth_clients.rs @@ -221,127 +221,127 @@ pub mod oauth_client_details_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ClientName; + type ClientId; type RedirectUris; + type ResponseTypes; + type ClientName; type CreatedByDid; type GrantTypes; - type ClientId; type CreatedAt; - type ResponseTypes; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ClientName = Unset; + type ClientId = Unset; type RedirectUris = Unset; + type ResponseTypes = Unset; + type ClientName = Unset; type CreatedByDid = Unset; type GrantTypes = Unset; - type ClientId = Unset; type CreatedAt = Unset; - type ResponseTypes = Unset; } - ///State transition - sets the `client_name` field to Set - pub struct SetClientName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetClientName<S> {} - impl<S: State> State for SetClientName<S> { - type ClientName = Set<members::client_name>; + ///State transition - sets the `client_id` field to Set + pub struct SetClientId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetClientId<S> {} + impl<S: State> State for SetClientId<S> { + type ClientId = Set<members::client_id>; type RedirectUris = S::RedirectUris; + type ResponseTypes = S::ResponseTypes; + type ClientName = S::ClientName; type CreatedByDid = S::CreatedByDid; type GrantTypes = S::GrantTypes; - type ClientId = S::ClientId; type CreatedAt = S::CreatedAt; - type ResponseTypes = S::ResponseTypes; } ///State transition - sets the `redirect_uris` field to Set pub struct SetRedirectUris<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRedirectUris<S> {} impl<S: State> State for SetRedirectUris<S> { - type ClientName = S::ClientName; + type ClientId = S::ClientId; type RedirectUris = Set<members::redirect_uris>; + type ResponseTypes = S::ResponseTypes; + type ClientName = S::ClientName; type CreatedByDid = S::CreatedByDid; type GrantTypes = S::GrantTypes; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `response_types` field to Set + pub struct SetResponseTypes<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetResponseTypes<S> {} + impl<S: State> State for SetResponseTypes<S> { type ClientId = S::ClientId; + type RedirectUris = S::RedirectUris; + type ResponseTypes = Set<members::response_types>; + type ClientName = S::ClientName; + type CreatedByDid = S::CreatedByDid; + type GrantTypes = S::GrantTypes; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `client_name` field to Set + pub struct SetClientName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetClientName<S> {} + impl<S: State> State for SetClientName<S> { + type ClientId = S::ClientId; + type RedirectUris = S::RedirectUris; type ResponseTypes = S::ResponseTypes; + type ClientName = Set<members::client_name>; + type CreatedByDid = S::CreatedByDid; + type GrantTypes = S::GrantTypes; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_by_did` field to Set pub struct SetCreatedByDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedByDid<S> {} impl<S: State> State for SetCreatedByDid<S> { - type ClientName = S::ClientName; + type ClientId = S::ClientId; type RedirectUris = S::RedirectUris; + type ResponseTypes = S::ResponseTypes; + type ClientName = S::ClientName; type CreatedByDid = Set<members::created_by_did>; type GrantTypes = S::GrantTypes; - type ClientId = S::ClientId; type CreatedAt = S::CreatedAt; - type ResponseTypes = S::ResponseTypes; } ///State transition - sets the `grant_types` field to Set pub struct SetGrantTypes<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGrantTypes<S> {} impl<S: State> State for SetGrantTypes<S> { - type ClientName = S::ClientName; - type RedirectUris = S::RedirectUris; - type CreatedByDid = S::CreatedByDid; - type GrantTypes = Set<members::grant_types>; type ClientId = S::ClientId; - type CreatedAt = S::CreatedAt; + type RedirectUris = S::RedirectUris; type ResponseTypes = S::ResponseTypes; - } - ///State transition - sets the `client_id` field to Set - pub struct SetClientId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetClientId<S> {} - impl<S: State> State for SetClientId<S> { type ClientName = S::ClientName; - type RedirectUris = S::RedirectUris; type CreatedByDid = S::CreatedByDid; - type GrantTypes = S::GrantTypes; - type ClientId = Set<members::client_id>; + type GrantTypes = Set<members::grant_types>; type CreatedAt = S::CreatedAt; - type ResponseTypes = S::ResponseTypes; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type ClientName = S::ClientName; - type RedirectUris = S::RedirectUris; - type CreatedByDid = S::CreatedByDid; - type GrantTypes = S::GrantTypes; type ClientId = S::ClientId; - type CreatedAt = Set<members::created_at>; + type RedirectUris = S::RedirectUris; type ResponseTypes = S::ResponseTypes; - } - ///State transition - sets the `response_types` field to Set - pub struct SetResponseTypes<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetResponseTypes<S> {} - impl<S: State> State for SetResponseTypes<S> { type ClientName = S::ClientName; - type RedirectUris = S::RedirectUris; type CreatedByDid = S::CreatedByDid; type GrantTypes = S::GrantTypes; - type ClientId = S::ClientId; - type CreatedAt = S::CreatedAt; - type ResponseTypes = Set<members::response_types>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `client_name` field - pub struct client_name(()); + ///Marker type for the `client_id` field + pub struct client_id(()); ///Marker type for the `redirect_uris` field pub struct redirect_uris(()); + ///Marker type for the `response_types` field + pub struct response_types(()); + ///Marker type for the `client_name` field + pub struct client_name(()); ///Marker type for the `created_by_did` field pub struct created_by_did(()); ///Marker type for the `grant_types` field pub struct grant_types(()); - ///Marker type for the `client_id` field - pub struct client_id(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `response_types` field - pub struct response_types(()); } } @@ -645,13 +645,13 @@ impl<'a, S: oauth_client_details_state::State> OauthClientDetailsBuilder<'a, S> impl<'a, S> OauthClientDetailsBuilder<'a, S> where S: oauth_client_details_state::State, - S::ClientName: oauth_client_details_state::IsSet, + S::ClientId: oauth_client_details_state::IsSet, S::RedirectUris: oauth_client_details_state::IsSet, + S::ResponseTypes: oauth_client_details_state::IsSet, + S::ClientName: oauth_client_details_state::IsSet, S::CreatedByDid: oauth_client_details_state::IsSet, S::GrantTypes: oauth_client_details_state::IsSet, - S::ClientId: oauth_client_details_state::IsSet, S::CreatedAt: oauth_client_details_state::IsSet, - S::ResponseTypes: oauth_client_details_state::IsSet, { /// Build the final struct pub fn build(self) -> OauthClientDetails<'a> { diff --git a/crates/jacquard-api/src/network_slices/slice/get_slice_records.rs b/crates/jacquard-api/src/network_slices/slice/get_slice_records.rs index 274c1dae..c689d894 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_slice_records.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_slice_records.rs @@ -46,103 +46,103 @@ pub mod indexed_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; - type IndexedAt; type Value; - type Uri; + type IndexedAt; type Cid; + type Uri; + type Did; type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; - type IndexedAt = Unset; type Value = Unset; - type Uri = Unset; + type IndexedAt = Unset; type Cid = Unset; + type Uri = Unset; + type Did = Unset; type Collection = Unset; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; + ///State transition - sets the `value` field to Set + pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValue<S> {} + impl<S: State> State for SetValue<S> { + type Value = Set<members::value>; type IndexedAt = S::IndexedAt; - type Value = S::Value; - type Uri = S::Uri; type Cid = S::Cid; + type Uri = S::Uri; + type Did = S::Did; type Collection = S::Collection; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Did = S::Did; - type IndexedAt = Set<members::indexed_at>; type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = Set<members::indexed_at>; type Cid = S::Cid; + type Uri = S::Uri; + type Did = S::Did; type Collection = S::Collection; } - ///State transition - sets the `value` field to Set - pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetValue<S> {} - impl<S: State> State for SetValue<S> { - type Did = S::Did; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Value = S::Value; type IndexedAt = S::IndexedAt; - type Value = Set<members::value>; + type Cid = Set<members::cid>; type Uri = S::Uri; - type Cid = S::Cid; + type Did = S::Did; type Collection = S::Collection; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Did = S::Did; - type IndexedAt = S::IndexedAt; type Value = S::Value; - type Uri = Set<members::uri>; + type IndexedAt = S::IndexedAt; type Cid = S::Cid; + type Uri = Set<members::uri>; + type Did = S::Did; type Collection = S::Collection; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Did = S::Did; - type IndexedAt = S::IndexedAt; + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { type Value = S::Value; + type IndexedAt = S::IndexedAt; + type Cid = S::Cid; type Uri = S::Uri; - type Cid = Set<members::cid>; + type Did = Set<members::did>; type Collection = S::Collection; } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { - type Did = S::Did; - type IndexedAt = S::IndexedAt; type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; type Cid = S::Cid; + type Uri = S::Uri; + type Did = S::Did; type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `did` field + pub struct did(()); ///Marker type for the `collection` field pub struct collection(()); } @@ -297,11 +297,11 @@ where impl<'a, S> IndexedRecordBuilder<'a, S> where S: indexed_record_state::State, - S::Did: indexed_record_state::IsSet, - S::IndexedAt: indexed_record_state::IsSet, S::Value: indexed_record_state::IsSet, - S::Uri: indexed_record_state::IsSet, + S::IndexedAt: indexed_record_state::IsSet, S::Cid: indexed_record_state::IsSet, + S::Uri: indexed_record_state::IsSet, + S::Did: indexed_record_state::IsSet, S::Collection: indexed_record_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/network_slices/slice/get_sync_summary.rs b/crates/jacquard-api/src/network_slices/slice/get_sync_summary.rs index 72f40090..60aaba8a 100644 --- a/crates/jacquard-api/src/network_slices/slice/get_sync_summary.rs +++ b/crates/jacquard-api/src/network_slices/slice/get_sync_summary.rs @@ -33,49 +33,49 @@ pub mod collection_summary_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EstimatedRepos; type Collection; + type EstimatedRepos; type IsExternal; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EstimatedRepos = Unset; type Collection = Unset; + type EstimatedRepos = Unset; type IsExternal = Unset; } - ///State transition - sets the `estimated_repos` field to Set - pub struct SetEstimatedRepos<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEstimatedRepos<S> {} - impl<S: State> State for SetEstimatedRepos<S> { - type EstimatedRepos = Set<members::estimated_repos>; - type Collection = S::Collection; - type IsExternal = S::IsExternal; - } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { - type EstimatedRepos = S::EstimatedRepos; type Collection = Set<members::collection>; + type EstimatedRepos = S::EstimatedRepos; + type IsExternal = S::IsExternal; + } + ///State transition - sets the `estimated_repos` field to Set + pub struct SetEstimatedRepos<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEstimatedRepos<S> {} + impl<S: State> State for SetEstimatedRepos<S> { + type Collection = S::Collection; + type EstimatedRepos = Set<members::estimated_repos>; type IsExternal = S::IsExternal; } ///State transition - sets the `is_external` field to Set pub struct SetIsExternal<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIsExternal<S> {} impl<S: State> State for SetIsExternal<S> { - type EstimatedRepos = S::EstimatedRepos; type Collection = S::Collection; + type EstimatedRepos = S::EstimatedRepos; type IsExternal = Set<members::is_external>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `estimated_repos` field - pub struct estimated_repos(()); ///Marker type for the `collection` field pub struct collection(()); + ///Marker type for the `estimated_repos` field + pub struct estimated_repos(()); ///Marker type for the `is_external` field pub struct is_external(()); } @@ -170,8 +170,8 @@ where impl<'a, S> CollectionSummaryBuilder<'a, S> where S: collection_summary_state::State, - S::EstimatedRepos: collection_summary_state::IsSet, S::Collection: collection_summary_state::IsSet, + S::EstimatedRepos: collection_summary_state::IsSet, S::IsExternal: collection_summary_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/network_slices/slice/stats.rs b/crates/jacquard-api/src/network_slices/slice/stats.rs index 6252eec8..363e0bcd 100644 --- a/crates/jacquard-api/src/network_slices/slice/stats.rs +++ b/crates/jacquard-api/src/network_slices/slice/stats.rs @@ -36,51 +36,51 @@ pub mod collection_stats_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Collection; - type UniqueActors; type RecordCount; + type UniqueActors; + type Collection; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Collection = Unset; - type UniqueActors = Unset; type RecordCount = Unset; + type UniqueActors = Unset; + type Collection = Unset; } - ///State transition - sets the `collection` field to Set - pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCollection<S> {} - impl<S: State> State for SetCollection<S> { - type Collection = Set<members::collection>; + ///State transition - sets the `record_count` field to Set + pub struct SetRecordCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecordCount<S> {} + impl<S: State> State for SetRecordCount<S> { + type RecordCount = Set<members::record_count>; type UniqueActors = S::UniqueActors; - type RecordCount = S::RecordCount; + type Collection = S::Collection; } ///State transition - sets the `unique_actors` field to Set pub struct SetUniqueActors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUniqueActors<S> {} impl<S: State> State for SetUniqueActors<S> { - type Collection = S::Collection; - type UniqueActors = Set<members::unique_actors>; type RecordCount = S::RecordCount; - } - ///State transition - sets the `record_count` field to Set - pub struct SetRecordCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecordCount<S> {} - impl<S: State> State for SetRecordCount<S> { + type UniqueActors = Set<members::unique_actors>; type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type RecordCount = S::RecordCount; type UniqueActors = S::UniqueActors; - type RecordCount = Set<members::record_count>; + type Collection = Set<members::collection>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `collection` field - pub struct collection(()); - ///Marker type for the `unique_actors` field - pub struct unique_actors(()); ///Marker type for the `record_count` field pub struct record_count(()); + ///Marker type for the `unique_actors` field + pub struct unique_actors(()); + ///Marker type for the `collection` field + pub struct collection(()); } } @@ -173,9 +173,9 @@ where impl<'a, S> CollectionStatsBuilder<'a, S> where S: collection_stats_state::State, - S::Collection: collection_stats_state::IsSet, - S::UniqueActors: collection_stats_state::IsSet, S::RecordCount: collection_stats_state::IsSet, + S::UniqueActors: collection_stats_state::IsSet, + S::Collection: collection_stats_state::IsSet, { /// Build the final struct pub fn build(self) -> CollectionStats<'a> { diff --git a/crates/jacquard-api/src/network_slices/tools.rs b/crates/jacquard-api/src/network_slices/tools.rs index a598d19f..6ad6ffdc 100644 --- a/crates/jacquard-api/src/network_slices/tools.rs +++ b/crates/jacquard-api/src/network_slices/tools.rs @@ -38,37 +38,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Alt; type Image; + type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Alt = Unset; type Image = Unset; - } - ///State transition - sets the `alt` field to Set - pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAlt<S> {} - impl<S: State> State for SetAlt<S> { - type Alt = Set<members::alt>; - type Image = S::Image; + type Alt = Unset; } ///State transition - sets the `image` field to Set pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetImage<S> {} impl<S: State> State for SetImage<S> { - type Alt = S::Alt; type Image = Set<members::image>; + type Alt = S::Alt; + } + ///State transition - sets the `alt` field to Set + pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAlt<S> {} + impl<S: State> State for SetAlt<S> { + type Image = S::Image; + type Alt = Set<members::alt>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `alt` field - pub struct alt(()); ///Marker type for the `image` field pub struct image(()); + ///Marker type for the `alt` field + pub struct alt(()); } } @@ -141,8 +141,8 @@ where impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Alt: image_state::IsSet, S::Image: image_state::IsSet, + S::Alt: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { diff --git a/crates/jacquard-api/src/network_slices/tools/bug.rs b/crates/jacquard-api/src/network_slices/tools/bug.rs index ce22a554..7d5948e7 100644 --- a/crates/jacquard-api/src/network_slices/tools/bug.rs +++ b/crates/jacquard-api/src/network_slices/tools/bug.rs @@ -63,103 +63,103 @@ pub mod bug_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Description; + type CreatedAt; type Severity; type Title; type StepsToReproduce; - type CreatedAt; - type Description; type Namespace; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Description = Unset; + type CreatedAt = Unset; type Severity = Unset; type Title = Unset; type StepsToReproduce = Unset; - type CreatedAt = Unset; - type Description = Unset; type Namespace = Unset; } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type Description = Set<members::description>; + type CreatedAt = S::CreatedAt; + type Severity = S::Severity; + type Title = S::Title; + type StepsToReproduce = S::StepsToReproduce; + type Namespace = S::Namespace; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Description = S::Description; + type CreatedAt = Set<members::created_at>; + type Severity = S::Severity; + type Title = S::Title; + type StepsToReproduce = S::StepsToReproduce; + type Namespace = S::Namespace; + } ///State transition - sets the `severity` field to Set pub struct SetSeverity<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSeverity<S> {} impl<S: State> State for SetSeverity<S> { + type Description = S::Description; + type CreatedAt = S::CreatedAt; type Severity = Set<members::severity>; type Title = S::Title; type StepsToReproduce = S::StepsToReproduce; - type CreatedAt = S::CreatedAt; - type Description = S::Description; type Namespace = S::Namespace; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { + type Description = S::Description; + type CreatedAt = S::CreatedAt; type Severity = S::Severity; type Title = Set<members::title>; type StepsToReproduce = S::StepsToReproduce; - type CreatedAt = S::CreatedAt; - type Description = S::Description; type Namespace = S::Namespace; } ///State transition - sets the `steps_to_reproduce` field to Set pub struct SetStepsToReproduce<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStepsToReproduce<S> {} impl<S: State> State for SetStepsToReproduce<S> { - type Severity = S::Severity; - type Title = S::Title; - type StepsToReproduce = Set<members::steps_to_reproduce>; - type CreatedAt = S::CreatedAt; - type Description = S::Description; - type Namespace = S::Namespace; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Severity = S::Severity; - type Title = S::Title; - type StepsToReproduce = S::StepsToReproduce; - type CreatedAt = Set<members::created_at>; type Description = S::Description; - type Namespace = S::Namespace; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { + type CreatedAt = S::CreatedAt; type Severity = S::Severity; type Title = S::Title; - type StepsToReproduce = S::StepsToReproduce; - type CreatedAt = S::CreatedAt; - type Description = Set<members::description>; + type StepsToReproduce = Set<members::steps_to_reproduce>; type Namespace = S::Namespace; } ///State transition - sets the `namespace` field to Set pub struct SetNamespace<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNamespace<S> {} impl<S: State> State for SetNamespace<S> { + type Description = S::Description; + type CreatedAt = S::CreatedAt; type Severity = S::Severity; type Title = S::Title; type StepsToReproduce = S::StepsToReproduce; - type CreatedAt = S::CreatedAt; - type Description = S::Description; type Namespace = Set<members::namespace>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `description` field + pub struct description(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `severity` field pub struct severity(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `steps_to_reproduce` field pub struct steps_to_reproduce(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `description` field - pub struct description(()); ///Marker type for the `namespace` field pub struct namespace(()); } @@ -410,11 +410,11 @@ where impl<'a, S> BugBuilder<'a, S> where S: bug_state::State, + S::Description: bug_state::IsSet, + S::CreatedAt: bug_state::IsSet, S::Severity: bug_state::IsSet, S::Title: bug_state::IsSet, S::StepsToReproduce: bug_state::IsSet, - S::CreatedAt: bug_state::IsSet, - S::Description: bug_state::IsSet, S::Namespace: bug_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/network_slices/tools/bug/comment.rs b/crates/jacquard-api/src/network_slices/tools/bug/comment.rs index b8ea1e0d..39065d79 100644 --- a/crates/jacquard-api/src/network_slices/tools/bug/comment.rs +++ b/crates/jacquard-api/src/network_slices/tools/bug/comment.rs @@ -48,51 +48,51 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Bug; type Body; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Bug = Unset; type Body = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Bug = S::Bug; - type Body = S::Body; + type CreatedAt = Unset; } ///State transition - sets the `bug` field to Set pub struct SetBug<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBug<S> {} impl<S: State> State for SetBug<S> { - type CreatedAt = S::CreatedAt; type Bug = Set<members::bug>; type Body = S::Body; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `body` field to Set pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBody<S> {} impl<S: State> State for SetBody<S> { - type CreatedAt = S::CreatedAt; type Bug = S::Bug; type Body = Set<members::body>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Bug = S::Bug; + type Body = S::Body; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `bug` field pub struct bug(()); ///Marker type for the `body` field pub struct body(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -245,9 +245,9 @@ impl<'a, S: comment_state::State> CommentBuilder<'a, S> { impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::CreatedAt: comment_state::IsSet, S::Bug: comment_state::IsSet, S::Body: comment_state::IsSet, + S::CreatedAt: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { diff --git a/crates/jacquard-api/src/network_slices/tools/bug/issue.rs b/crates/jacquard-api/src/network_slices/tools/bug/issue.rs index 753099f8..dde76103 100644 --- a/crates/jacquard-api/src/network_slices/tools/bug/issue.rs +++ b/crates/jacquard-api/src/network_slices/tools/bug/issue.rs @@ -36,49 +36,49 @@ pub mod issue_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Bug; type CreatedAt; + type Bug; type Issue; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Bug = Unset; type CreatedAt = Unset; + type Bug = Unset; type Issue = Unset; } - ///State transition - sets the `bug` field to Set - pub struct SetBug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBug<S> {} - impl<S: State> State for SetBug<S> { - type Bug = Set<members::bug>; - type CreatedAt = S::CreatedAt; - type Issue = S::Issue; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Bug = S::Bug; type CreatedAt = Set<members::created_at>; + type Bug = S::Bug; + type Issue = S::Issue; + } + ///State transition - sets the `bug` field to Set + pub struct SetBug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBug<S> {} + impl<S: State> State for SetBug<S> { + type CreatedAt = S::CreatedAt; + type Bug = Set<members::bug>; type Issue = S::Issue; } ///State transition - sets the `issue` field to Set pub struct SetIssue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIssue<S> {} impl<S: State> State for SetIssue<S> { - type Bug = S::Bug; type CreatedAt = S::CreatedAt; + type Bug = S::Bug; type Issue = Set<members::issue>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `bug` field - pub struct bug(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `bug` field + pub struct bug(()); ///Marker type for the `issue` field pub struct issue(()); } @@ -173,8 +173,8 @@ where impl<'a, S> IssueBuilder<'a, S> where S: issue_state::State, - S::Bug: issue_state::IsSet, S::CreatedAt: issue_state::IsSet, + S::Bug: issue_state::IsSet, S::Issue: issue_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/network_slices/tools/bug/response.rs b/crates/jacquard-api/src/network_slices/tools/bug/response.rs index 559d734a..a45560e2 100644 --- a/crates/jacquard-api/src/network_slices/tools/bug/response.rs +++ b/crates/jacquard-api/src/network_slices/tools/bug/response.rs @@ -45,49 +45,49 @@ pub mod response_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Bug; type CreatedAt; + type Bug; type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Bug = Unset; type CreatedAt = Unset; + type Bug = Unset; type Status = Unset; } - ///State transition - sets the `bug` field to Set - pub struct SetBug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBug<S> {} - impl<S: State> State for SetBug<S> { - type Bug = Set<members::bug>; - type CreatedAt = S::CreatedAt; - type Status = S::Status; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Bug = S::Bug; type CreatedAt = Set<members::created_at>; + type Bug = S::Bug; + type Status = S::Status; + } + ///State transition - sets the `bug` field to Set + pub struct SetBug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBug<S> {} + impl<S: State> State for SetBug<S> { + type CreatedAt = S::CreatedAt; + type Bug = Set<members::bug>; type Status = S::Status; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { - type Bug = S::Bug; type CreatedAt = S::CreatedAt; + type Bug = S::Bug; type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `bug` field - pub struct bug(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `bug` field + pub struct bug(()); ///Marker type for the `status` field pub struct status(()); } @@ -219,8 +219,8 @@ where impl<'a, S> ResponseBuilder<'a, S> where S: response_state::State, - S::Bug: response_state::IsSet, S::CreatedAt: response_state::IsSet, + S::Bug: response_state::IsSet, S::Status: response_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/network_slices/tools/document.rs b/crates/jacquard-api/src/network_slices/tools/document.rs index d67e6149..584d3f0a 100644 --- a/crates/jacquard-api/src/network_slices/tools/document.rs +++ b/crates/jacquard-api/src/network_slices/tools/document.rs @@ -547,37 +547,37 @@ pub mod heading_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Level; type Text; + type Level; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Level = Unset; type Text = Unset; - } - ///State transition - sets the `level` field to Set - pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLevel<S> {} - impl<S: State> State for SetLevel<S> { - type Level = Set<members::level>; - type Text = S::Text; + type Level = Unset; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { - type Level = S::Level; type Text = Set<members::text>; + type Level = S::Level; + } + ///State transition - sets the `level` field to Set + pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLevel<S> {} + impl<S: State> State for SetLevel<S> { + type Text = S::Text; + type Level = Set<members::level>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `level` field - pub struct level(()); ///Marker type for the `text` field pub struct text(()); + ///Marker type for the `level` field + pub struct level(()); } } @@ -674,8 +674,8 @@ where impl<'a, S> HeadingBuilder<'a, S> where S: heading_state::State, - S::Level: heading_state::IsSet, S::Text: heading_state::IsSet, + S::Level: heading_state::IsSet, { /// Build the final struct pub fn build(self) -> Heading<'a> { @@ -964,67 +964,67 @@ pub mod document_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Slug; - type Title; type CreatedAt; type Blocks; + type Slug; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Slug = Unset; - type Title = Unset; type CreatedAt = Unset; type Blocks = Unset; - } - ///State transition - sets the `slug` field to Set - pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSlug<S> {} - impl<S: State> State for SetSlug<S> { - type Slug = Set<members::slug>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - type Blocks = S::Blocks; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Slug = S::Slug; - type Title = Set<members::title>; - type CreatedAt = S::CreatedAt; - type Blocks = S::Blocks; + type Slug = Unset; + type Title = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Slug = S::Slug; - type Title = S::Title; type CreatedAt = Set<members::created_at>; type Blocks = S::Blocks; + type Slug = S::Slug; + type Title = S::Title; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlocks<S> {} impl<S: State> State for SetBlocks<S> { + type CreatedAt = S::CreatedAt; + type Blocks = Set<members::blocks>; type Slug = S::Slug; type Title = S::Title; + } + ///State transition - sets the `slug` field to Set + pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSlug<S> {} + impl<S: State> State for SetSlug<S> { type CreatedAt = S::CreatedAt; - type Blocks = Set<members::blocks>; + type Blocks = S::Blocks; + type Slug = Set<members::slug>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type CreatedAt = S::CreatedAt; + type Blocks = S::Blocks; + type Slug = S::Slug; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `slug` field - pub struct slug(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `blocks` field pub struct blocks(()); + ///Marker type for the `slug` field + pub struct slug(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -1157,10 +1157,10 @@ impl<'a, S: document_state::State> DocumentBuilder<'a, S> { impl<'a, S> DocumentBuilder<'a, S> where S: document_state::State, - S::Slug: document_state::IsSet, - S::Title: document_state::IsSet, S::CreatedAt: document_state::IsSet, S::Blocks: document_state::IsSet, + S::Slug: document_state::IsSet, + S::Title: document_state::IsSet, { /// Build the final struct pub fn build(self) -> Document<'a> { diff --git a/crates/jacquard-api/src/network_slices/tools/richtext/facet.rs b/crates/jacquard-api/src/network_slices/tools/richtext/facet.rs index b9c62411..d00f82b6 100644 --- a/crates/jacquard-api/src/network_slices/tools/richtext/facet.rs +++ b/crates/jacquard-api/src/network_slices/tools/richtext/facet.rs @@ -293,37 +293,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteEnd; type ByteStart; + type ByteEnd; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteEnd = Unset; type ByteStart = Unset; - } - ///State transition - sets the `byte_end` field to Set - pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetByteEnd<S> {} - impl<S: State> State for SetByteEnd<S> { - type ByteEnd = Set<members::byte_end>; - type ByteStart = S::ByteStart; + type ByteEnd = Unset; } ///State transition - sets the `byte_start` field to Set pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetByteStart<S> {} impl<S: State> State for SetByteStart<S> { - type ByteEnd = S::ByteEnd; type ByteStart = Set<members::byte_start>; + type ByteEnd = S::ByteEnd; + } + ///State transition - sets the `byte_end` field to Set + pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetByteEnd<S> {} + impl<S: State> State for SetByteEnd<S> { + type ByteStart = S::ByteStart; + type ByteEnd = Set<members::byte_end>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_end` field - pub struct byte_end(()); ///Marker type for the `byte_start` field pub struct byte_start(()); + ///Marker type for the `byte_end` field + pub struct byte_end(()); } } @@ -393,8 +393,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteEnd: byte_slice_state::IsSet, S::ByteStart: byte_slice_state::IsSet, + S::ByteEnd: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -728,37 +728,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Index; type Features; + type Index; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Index = Unset; type Features = Unset; - } - ///State transition - sets the `index` field to Set - pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndex<S> {} - impl<S: State> State for SetIndex<S> { - type Index = Set<members::index>; - type Features = S::Features; + type Index = Unset; } ///State transition - sets the `features` field to Set pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetFeatures<S> {} impl<S: State> State for SetFeatures<S> { - type Index = S::Index; type Features = Set<members::features>; + type Index = S::Index; + } + ///State transition - sets the `index` field to Set + pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndex<S> {} + impl<S: State> State for SetIndex<S> { + type Features = S::Features; + type Index = Set<members::index>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `index` field - pub struct index(()); ///Marker type for the `features` field pub struct features(()); + ///Marker type for the `index` field + pub struct index(()); } } @@ -833,8 +833,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Index: facet_state::IsSet, S::Features: facet_state::IsSet, + S::Index: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { diff --git a/crates/jacquard-api/src/network_slices/waitlist.rs b/crates/jacquard-api/src/network_slices/waitlist.rs index 87bc0286..2b74d6c3 100644 --- a/crates/jacquard-api/src/network_slices/waitlist.rs +++ b/crates/jacquard-api/src/network_slices/waitlist.rs @@ -52,51 +52,51 @@ pub mod invite_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Did; type Slice; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Did = Unset; type Slice = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Did = S::Did; - type Slice = S::Slice; + type CreatedAt = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type CreatedAt = S::CreatedAt; type Did = Set<members::did>; type Slice = S::Slice; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `slice` field to Set pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSlice<S> {} impl<S: State> State for SetSlice<S> { - type CreatedAt = S::CreatedAt; type Did = S::Did; type Slice = Set<members::slice>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Did = S::Did; + type Slice = S::Slice; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `slice` field pub struct slice(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -249,9 +249,9 @@ impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> { impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, - S::CreatedAt: invite_view_state::IsSet, S::Did: invite_view_state::IsSet, S::Slice: invite_view_state::IsSet, + S::CreatedAt: invite_view_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteView<'a> { diff --git a/crates/jacquard-api/src/org_devcon/event/test.rs b/crates/jacquard-api/src/org_devcon/event/test.rs index 1c77704d..fb42a665 100644 --- a/crates/jacquard-api/src/org_devcon/event/test.rs +++ b/crates/jacquard-api/src/org_devcon/event/test.rs @@ -50,51 +50,51 @@ pub mod test_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Title; - type End; type Start; + type End; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Title = Unset; - type End = Unset; type Start = Unset; + type End = Unset; + type Title = Unset; } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Title = Set<members::title>; + ///State transition - sets the `start` field to Set + pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStart<S> {} + impl<S: State> State for SetStart<S> { + type Start = Set<members::start>; type End = S::End; - type Start = S::Start; + type Title = S::Title; } ///State transition - sets the `end` field to Set pub struct SetEnd<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEnd<S> {} impl<S: State> State for SetEnd<S> { - type Title = S::Title; - type End = Set<members::end>; type Start = S::Start; - } - ///State transition - sets the `start` field to Set - pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStart<S> {} - impl<S: State> State for SetStart<S> { + type End = Set<members::end>; type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Start = S::Start; type End = S::End; - type Start = Set<members::start>; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `title` field - pub struct title(()); - ///Marker type for the `end` field - pub struct end(()); ///Marker type for the `start` field pub struct start(()); + ///Marker type for the `end` field + pub struct end(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -258,9 +258,9 @@ impl<'a, S: test_state::State> TestBuilder<'a, S> { impl<'a, S> TestBuilder<'a, S> where S: test_state::State, - S::Title: test_state::IsSet, - S::End: test_state::IsSet, S::Start: test_state::IsSet, + S::End: test_state::IsSet, + S::Title: test_state::IsSet, { /// Build the final struct pub fn build(self) -> Test<'a> { diff --git a/crates/jacquard-api/src/org_okazu_diary.rs b/crates/jacquard-api/src/org_okazu_diary.rs index 60017f6d..4826fd32 100644 --- a/crates/jacquard-api/src/org_okazu_diary.rs +++ b/crates/jacquard-api/src/org_okazu_diary.rs @@ -5,4 +5,5 @@ pub mod actor; pub mod embed; -pub mod feed; \ No newline at end of file +pub mod feed; +pub mod material; \ No newline at end of file diff --git a/crates/jacquard-api/src/org_okazu_diary/feed/collection_item.rs b/crates/jacquard-api/src/org_okazu_diary/feed/collection_item.rs index 58aa8955..ab8bb0df 100644 --- a/crates/jacquard-api/src/org_okazu_diary/feed/collection_item.rs +++ b/crates/jacquard-api/src/org_okazu_diary/feed/collection_item.rs @@ -50,50 +50,50 @@ pub mod collection_item_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Collection; - type CreatedAt; type Subjects; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Collection = Unset; - type CreatedAt = Unset; type Subjects = Unset; + type CreatedAt = Unset; } ///State transition - sets the `collection` field to Set pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCollection<S> {} impl<S: State> State for SetCollection<S> { type Collection = Set<members::collection>; - type CreatedAt = S::CreatedAt; - type Subjects = S::Subjects; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Collection = S::Collection; - type CreatedAt = Set<members::created_at>; type Subjects = S::Subjects; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `subjects` field to Set pub struct SetSubjects<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubjects<S> {} impl<S: State> State for SetSubjects<S> { type Collection = S::Collection; - type CreatedAt = S::CreatedAt; type Subjects = Set<members::subjects>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Collection = S::Collection; + type Subjects = S::Subjects; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `collection` field pub struct collection(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subjects` field pub struct subjects(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -247,8 +247,8 @@ impl<'a, S> CollectionItemBuilder<'a, S> where S: collection_item_state::State, S::Collection: collection_item_state::IsSet, - S::CreatedAt: collection_item_state::IsSet, S::Subjects: collection_item_state::IsSet, + S::CreatedAt: collection_item_state::IsSet, { /// Build the final struct pub fn build(self) -> CollectionItem<'a> { diff --git a/crates/jacquard-api/src/org_okazu_diary/feed/entry.rs b/crates/jacquard-api/src/org_okazu_diary/feed/entry.rs index 3690e132..82dbbbd4 100644 --- a/crates/jacquard-api/src/org_okazu_diary/feed/entry.rs +++ b/crates/jacquard-api/src/org_okazu_diary/feed/entry.rs @@ -24,7 +24,7 @@ pub struct Entry<'a> { /// If `true`, indicates that there may have been unrecorded activities since the last entry, so that the data in the meantime are not reliable for statistical purposes. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub had_hiatus: std::option::Option<bool>, - /// General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the subjects, tags, and the note are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so. To put warnings on the subject even for explicit users of the Okazu-Diary.org application, put self-labels in the `labels` property value of individual `subject` values as well. + /// Self-label values for this post. Effectively content warnings for the note and tags. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>, @@ -32,15 +32,17 @@ pub struct Entry<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub note: std::option::Option<jacquard_common::CowStr<'a>>, - /// Materials used for gratification. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain. + /// References to `org.okazu-diary.material.external` records associated with the activity. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain. Although this property uses a `strongRef` to make a reference to an external repository reliable to some extent, it is recommended that you copy the record to your own repository if you want to reference a record from another repository. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub subjects: std::option::Option<Vec<crate::org_okazu_diary::feed::Subject<'a>>>, - /// User-specified tags for the entry. + pub subjects: std::option::Option< + Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + >, + /// User-specified tags for the activity. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub tags: std::option::Option<Vec<crate::org_okazu_diary::feed::Tag<'a>>>, - /// Reference to another `org.okazu-diary.feed.entry` record or an `org.okazu-diary.feed.collectionItem` record whose `subjects` this collection item is derived from. + pub tags: std::option::Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, + /// Reference to another `org.okazu-diary.feed.entry` record or an `org.okazu-diary.material.collectionItem` record from this entry is derived. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub via: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, @@ -90,8 +92,8 @@ pub struct EntryBuilder<'a, S: entry_state::State> { ::core::option::Option<bool>, ::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>, ::core::option::Option<jacquard_common::CowStr<'a>>, - ::core::option::Option<Vec<crate::org_okazu_diary::feed::Subject<'a>>>, - ::core::option::Option<Vec<crate::org_okazu_diary::feed::Tag<'a>>>, + ::core::option::Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ::core::option::Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, ::core::option::Option<EntryVisibility<'a>>, ), @@ -187,7 +189,9 @@ impl<'a, S: entry_state::State> EntryBuilder<'a, S> { /// Set the `subjects` field (optional) pub fn subjects( mut self, - value: impl Into<Option<Vec<crate::org_okazu_diary::feed::Subject<'a>>>>, + value: impl Into< + Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + >, ) -> Self { self.__unsafe_private_named.4 = value.into(); self @@ -195,7 +199,7 @@ impl<'a, S: entry_state::State> EntryBuilder<'a, S> { /// Set the `subjects` field to an Option value (optional) pub fn maybe_subjects( mut self, - value: Option<Vec<crate::org_okazu_diary::feed::Subject<'a>>>, + value: Option<Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, ) -> Self { self.__unsafe_private_named.4 = value; self @@ -206,7 +210,7 @@ impl<'a, S: entry_state::State> EntryBuilder<'a, S> { /// Set the `tags` field (optional) pub fn tags( mut self, - value: impl Into<Option<Vec<crate::org_okazu_diary::feed::Tag<'a>>>>, + value: impl Into<Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>>, ) -> Self { self.__unsafe_private_named.5 = value.into(); self @@ -214,7 +218,7 @@ impl<'a, S: entry_state::State> EntryBuilder<'a, S> { /// Set the `tags` field to an Option value (optional) pub fn maybe_tags( mut self, - value: Option<Vec<crate::org_okazu_diary::feed::Tag<'a>>>, + value: Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, ) -> Self { self.__unsafe_private_named.5 = value; self @@ -581,7 +585,7 @@ fn lexicon_doc_org_okazu_diary_feed_entry() -> ::jacquard_lexicon::lexicon::Lexi ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: Some( ::jacquard_common::CowStr::new_static( - "General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the subjects, tags, and the note are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so. To put warnings on the subject even for explicit users of the Okazu-Diary.org application, put self-labels in the `labels` property value of individual `subject` values as well.", + "Self-label values for this post. Effectively content warnings for the note and tags.", ), ), refs: vec![ @@ -616,13 +620,13 @@ fn lexicon_doc_org_okazu_diary_feed_entry() -> ::jacquard_lexicon::lexicon::Lexi ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( - "Materials used for gratification. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain.", + "References to `org.okazu-diary.material.external` records associated with the activity. Leave the array empty if it is known that there is no applicable material. Omit the property if the materials are uncertain. Although this property uses a `strongRef` to make a reference to an external repository reliable to some extent, it is recommended that you copy the record to your own repository if you want to reference a record from another repository.", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( - "org.okazu-diary.feed.defs#subject", + "com.atproto.repo.strongRef", ), }), min_length: None, @@ -634,13 +638,13 @@ fn lexicon_doc_org_okazu_diary_feed_entry() -> ::jacquard_lexicon::lexicon::Lexi ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( - "User-specified tags for the entry.", + "User-specified tags for the activity.", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( - "org.okazu-diary.feed.defs#tag", + "org.okazu-diary.material.defs#tag", ), }), min_length: None, diff --git a/crates/jacquard-api/src/org_okazu_diary/material.rs b/crates/jacquard-api/src/org_okazu_diary/material.rs new file mode 100644 index 00000000..e5f9742a --- /dev/null +++ b/crates/jacquard-api/src/org_okazu_diary/material.rs @@ -0,0 +1,115 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.okazu-diary.material.defs +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod collection; +pub mod collection_item; +pub mod external; + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct Tag<'a> { + #[serde(borrow)] + pub value: jacquard_common::CowStr<'a>, +} + +fn lexicon_doc_org_okazu_diary_material_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("org.okazu-diary.material.defs"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tag"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("value")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("value"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: Some(1usize), + max_length: Some(256usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Tag<'a> { + fn nsid() -> &'static str { + "org.okazu-diary.material.defs" + } + fn def_name() -> &'static str { + "tag" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_okazu_diary_material_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.value; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 256usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "value", + ), + max: 256usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.value; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "value", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/org_okazu_diary/material/collection.rs b/crates/jacquard-api/src/org_okazu_diary/material/collection.rs new file mode 100644 index 00000000..808c59a2 --- /dev/null +++ b/crates/jacquard-api/src/org_okazu_diary/material/collection.rs @@ -0,0 +1,442 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.okazu-diary.material.collection +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Record representing a user-curated colleciton of materials. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Collection<'a> { + pub created_at: jacquard_common::types::string::Datetime, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// General-purpose self-label values primarily for consumption by generic AT clients. See the `labels` property of `org.okazu-diary.feed.entry` for details. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + /// Display name for the collection. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub name: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod collection_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CollectionBuilder<'a, S: collection_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Collection<'a> { + /// Create a new builder for this type + pub fn new() -> CollectionBuilder<'a, collection_state::Empty> { + CollectionBuilder::new() + } +} + +impl<'a> CollectionBuilder<'a, collection_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CollectionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionBuilder<'a, S> +where + S: collection_state::State, + S::CreatedAt: collection_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CollectionBuilder<'a, collection_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CollectionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { + /// Set the `labels` field (optional) + pub fn labels( + mut self, + value: impl Into<Option<crate::com_atproto::label::SelfLabels<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `labels` field to an Option value (optional) + pub fn maybe_labels( + mut self, + value: Option<crate::com_atproto::label::SelfLabels<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { + /// Set the `name` field (optional) + pub fn name( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `name` field to an Option value (optional) + pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> CollectionBuilder<'a, S> +where + S: collection_state::State, + S::CreatedAt: collection_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Collection<'a> { + Collection { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + labels: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Collection<'a> { + Collection { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + labels: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Collection<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, CollectionRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Collection<'a>, +} + +impl From<CollectionGetRecordOutput<'_>> for Collection<'_> { + fn from(output: CollectionGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Collection<'_> { + const NSID: &'static str = "org.okazu-diary.material.collection"; + type Record = CollectionRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct CollectionRecord; +impl jacquard_common::xrpc::XrpcResp for CollectionRecord { + const NSID: &'static str = "org.okazu-diary.material.collection"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CollectionGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for CollectionRecord { + const NSID: &'static str = "org.okazu-diary.material.collection"; + type Record = CollectionRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Collection<'a> { + fn nsid() -> &'static str { + "org.okazu-diary.material.collection" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_okazu_diary_material_collection() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 3000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 3000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 300usize, + actual: count, + }); + } + } + } + if let Some(ref value) = self.name { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 64usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.name { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_org_okazu_diary_material_collection() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("org.okazu-diary.material.collection"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Record representing a user-curated colleciton of materials.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(3000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("labels"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: Some( + ::jacquard_common::CowStr::new_static( + "General-purpose self-label values primarily for consumption by generic AT clients. See the `labels` property of `org.okazu-diary.feed.entry` for details.", + ), + ), + refs: vec![ + ::jacquard_common::CowStr::new_static("com.atproto.label.defs#selfLabels") + ], + closed: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Display name for the collection.", + ), + ), + format: None, + default: None, + min_length: Some(1usize), + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/org_okazu_diary/material/collection_item.rs b/crates/jacquard-api/src/org_okazu_diary/material/collection_item.rs new file mode 100644 index 00000000..f4401534 --- /dev/null +++ b/crates/jacquard-api/src/org_okazu_diary/material/collection_item.rs @@ -0,0 +1,530 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.okazu-diary.material.collectionItem +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Record declaring the inclusion of a single material or a set of materials in a specific collection. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionItem<'a> { + /// Reference to the collection record (`org.okazu-diary.feed.collection`). + #[serde(borrow)] + pub collection: jacquard_common::types::string::AtUri<'a>, + pub created_at: jacquard_common::types::string::Datetime, + /// Remarks on the collection item. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub note: std::option::Option<jacquard_common::CowStr<'a>>, + /// Reference(s) to a material or set of materials (`org.okazu-diary.material.external`) to be included in the collection. + #[serde(borrow)] + pub subjects: Vec<jacquard_common::types::string::AtUri<'a>>, + /// Reference to an `org.okazu-diary.feed.entry` record or an `org.okazu-diary.material.collectionItem` of another collection from which this collection item is derived. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub via: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, +} + +pub mod collection_item_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Collection; + type Subjects; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Collection = Unset; + type Subjects = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Collection = S::Collection; + type Subjects = S::Subjects; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type CreatedAt = S::CreatedAt; + type Collection = Set<members::collection>; + type Subjects = S::Subjects; + } + ///State transition - sets the `subjects` field to Set + pub struct SetSubjects<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubjects<S> {} + impl<S: State> State for SetSubjects<S> { + type CreatedAt = S::CreatedAt; + type Collection = S::Collection; + type Subjects = Set<members::subjects>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `collection` field + pub struct collection(()); + ///Marker type for the `subjects` field + pub struct subjects(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CollectionItemBuilder<'a, S: collection_item_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CollectionItem<'a> { + /// Create a new builder for this type + pub fn new() -> CollectionItemBuilder<'a, collection_item_state::Empty> { + CollectionItemBuilder::new() + } +} + +impl<'a> CollectionItemBuilder<'a, collection_item_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::Collection: collection_item_state::IsUnset, +{ + /// Set the `collection` field (required) + pub fn collection( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetCollection<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::CreatedAt: collection_item_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_item_state::State> CollectionItemBuilder<'a, S> { + /// Set the `note` field (optional) + pub fn note( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `note` field to an Option value (optional) + pub fn maybe_note(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::Subjects: collection_item_state::IsUnset, +{ + /// Set the `subjects` field (required) + pub fn subjects( + mut self, + value: impl Into<Vec<jacquard_common::types::string::AtUri<'a>>>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetSubjects<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_item_state::State> CollectionItemBuilder<'a, S> { + /// Set the `via` field (optional) + pub fn via( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `via` field to an Option value (optional) + pub fn maybe_via( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::CreatedAt: collection_item_state::IsSet, + S::Collection: collection_item_state::IsSet, + S::Subjects: collection_item_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CollectionItem<'a> { + CollectionItem { + collection: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + note: self.__unsafe_private_named.2, + subjects: self.__unsafe_private_named.3.unwrap(), + via: self.__unsafe_private_named.4, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CollectionItem<'a> { + CollectionItem { + collection: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + note: self.__unsafe_private_named.2, + subjects: self.__unsafe_private_named.3.unwrap(), + via: self.__unsafe_private_named.4, + extra_data: Some(extra_data), + } + } +} + +impl<'a> CollectionItem<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, CollectionItemRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionItemGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: CollectionItem<'a>, +} + +impl From<CollectionItemGetRecordOutput<'_>> for CollectionItem<'_> { + fn from(output: CollectionItemGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for CollectionItem<'_> { + const NSID: &'static str = "org.okazu-diary.material.collectionItem"; + type Record = CollectionItemRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct CollectionItemRecord; +impl jacquard_common::xrpc::XrpcResp for CollectionItemRecord { + const NSID: &'static str = "org.okazu-diary.material.collectionItem"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CollectionItemGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for CollectionItemRecord { + const NSID: &'static str = "org.okazu-diary.material.collectionItem"; + type Record = CollectionItemRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollectionItem<'a> { + fn nsid() -> &'static str { + "org.okazu-diary.material.collectionItem" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_okazu_diary_material_collectionItem() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.note { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 5000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "note", + ), + max: 5000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.note { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "note", + ), + max: 500usize, + actual: count, + }); + } + } + } + { + let value = &self.subjects; + #[allow(unused_comparisons)] + if value.len() > 16usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "subjects", + ), + max: 16usize, + actual: value.len(), + }); + } + } + { + let value = &self.subjects; + #[allow(unused_comparisons)] + if value.len() < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "subjects", + ), + min: 1usize, + actual: value.len(), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_org_okazu_diary_material_collectionItem() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "org.okazu-diary.material.collectionItem", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Record declaring the inclusion of a single material or a set of materials in a specific collection.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("collection"), + ::jacquard_common::smol_str::SmolStr::new_static("subjects"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "collection", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Reference to the collection record (`org.okazu-diary.feed.collection`).", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("note"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Remarks on the collection item.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(5000usize), + min_graphemes: None, + max_graphemes: Some(500usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "subjects", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Reference(s) to a material or set of materials (`org.okazu-diary.material.external`) to be included in the collection.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: Some(1usize), + max_length: Some(16usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("via"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/org_okazu_diary/material/external.rs b/crates/jacquard-api/src/org_okazu_diary/material/external.rs new file mode 100644 index 00000000..59caa336 --- /dev/null +++ b/crates/jacquard-api/src/org_okazu_diary/material/external.rs @@ -0,0 +1,805 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.okazu-diary.material.external +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A descriptor of a pornographic material. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct External<'a> { + /// Description of the material, typically taken from the material's HTML metadata. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the material and tags are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub generic_labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + /// User-specified self-label values for the material. While the Lexicon by its nature assumes the material to be possibly sensitive by default, these label values are intended to signal that a warning should be put on the material even for the explicit Okazu-Diary.org application users who are willing to see mature contents in general. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + /// Reference to a record representing the material, such as a Bluesky post. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub record: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + /// User-specified tags for the material. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, + /// Link to a thumbnail of the material, typically taken from the material's HTML metadata. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub thumb: std::option::Option< + crate::org_okazu_diary::material::external::Thumb<'a>, + >, + /// Title of the material, typically taken from the material's HTML `<title>` element. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub title: std::option::Option<jacquard_common::CowStr<'a>>, + /// URI of the material, typically an HTTP(S) URL. If the URL is of a Web interface for an AT resource (such as a `bsky.app` URL), the record should also include the `record` property referencing the AT resource. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub uri: std::option::Option<jacquard_common::types::string::Uri<'a>>, + /// Reference to an `org.okazu-diary.feed.material` record from another repository from which this collection item is derived. Clients can use this property to offer the user to update this record if the original record have updated from the referenced version. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub via: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, +} + +pub mod external_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed {} + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty {} + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members {} +} + +/// Builder for constructing an instance of this type +pub struct ExternalBuilder<'a, S: external_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + ::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, + ::core::option::Option<crate::org_okazu_diary::material::external::Thumb<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> External<'a> { + /// Create a new builder for this type + pub fn new() -> ExternalBuilder<'a, external_state::Empty> { + ExternalBuilder::new() + } +} + +impl<'a> ExternalBuilder<'a, external_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ExternalBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `genericLabels` field (optional) + pub fn generic_labels( + mut self, + value: impl Into<Option<crate::com_atproto::label::SelfLabels<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `genericLabels` field to an Option value (optional) + pub fn maybe_generic_labels( + mut self, + value: Option<crate::com_atproto::label::SelfLabels<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `labels` field (optional) + pub fn labels( + mut self, + value: impl Into<Option<crate::com_atproto::label::SelfLabels<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `labels` field to an Option value (optional) + pub fn maybe_labels( + mut self, + value: Option<crate::com_atproto::label::SelfLabels<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `record` field (optional) + pub fn record( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `record` field to an Option value (optional) + pub fn maybe_record( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<crate::org_okazu_diary::material::Tag<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `thumb` field (optional) + pub fn thumb( + mut self, + value: impl Into<Option<crate::org_okazu_diary::material::external::Thumb<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `thumb` field to an Option value (optional) + pub fn maybe_thumb( + mut self, + value: Option<crate::org_okazu_diary::material::external::Thumb<'a>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `title` field (optional) + pub fn title( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `title` field to an Option value (optional) + pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `uri` field (optional) + pub fn uri( + mut self, + value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>, + ) -> Self { + self.__unsafe_private_named.7 = value.into(); + self + } + /// Set the `uri` field to an Option value (optional) + pub fn maybe_uri( + mut self, + value: Option<jacquard_common::types::string::Uri<'a>>, + ) -> Self { + self.__unsafe_private_named.7 = value; + self + } +} + +impl<'a, S: external_state::State> ExternalBuilder<'a, S> { + /// Set the `via` field (optional) + pub fn via( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.8 = value.into(); + self + } + /// Set the `via` field to an Option value (optional) + pub fn maybe_via( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.8 = value; + self + } +} + +impl<'a, S> ExternalBuilder<'a, S> +where + S: external_state::State, +{ + /// Build the final struct + pub fn build(self) -> External<'a> { + External { + description: self.__unsafe_private_named.0, + generic_labels: self.__unsafe_private_named.1, + labels: self.__unsafe_private_named.2, + record: self.__unsafe_private_named.3, + tags: self.__unsafe_private_named.4, + thumb: self.__unsafe_private_named.5, + title: self.__unsafe_private_named.6, + uri: self.__unsafe_private_named.7, + via: self.__unsafe_private_named.8, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> External<'a> { + External { + description: self.__unsafe_private_named.0, + generic_labels: self.__unsafe_private_named.1, + labels: self.__unsafe_private_named.2, + record: self.__unsafe_private_named.3, + tags: self.__unsafe_private_named.4, + thumb: self.__unsafe_private_named.5, + title: self.__unsafe_private_named.6, + uri: self.__unsafe_private_named.7, + via: self.__unsafe_private_named.8, + extra_data: Some(extra_data), + } + } +} + +impl<'a> External<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ExternalRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ExternalGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: External<'a>, +} + +impl From<ExternalGetRecordOutput<'_>> for External<'_> { + fn from(output: ExternalGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for External<'_> { + const NSID: &'static str = "org.okazu-diary.material.external"; + type Record = ExternalRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ExternalRecord; +impl jacquard_common::xrpc::XrpcResp for ExternalRecord { + const NSID: &'static str = "org.okazu-diary.material.external"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ExternalGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ExternalRecord { + const NSID: &'static str = "org.okazu-diary.material.external"; + type Record = ExternalRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for External<'a> { + fn nsid() -> &'static str { + "org.okazu-diary.material.external" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_okazu_diary_material_external() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 64usize, + actual: value.len(), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_org_okazu_diary_material_external() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("org.okazu-diary.material.external"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A descriptor of a pornographic material.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: None, + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of the material, typically taken from the material's HTML metadata.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "genericLabels", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: Some( + ::jacquard_common::CowStr::new_static( + "General-purpose self-label values primarily for consumption by generic AT clients who may not expect the sensitive nature of this Lexicon. Publishers of this record are strongly recommended to always include at least one of the protocol-global label values; namely, `porn`, `sexual`, `graphic-media`, and `nudity`, unless the material and tags are all known to be safe by themselves. It is the safest to unconditionally include the `sexual` value, which has the `adultOnly` semantics, but it is acceptable to use a stronger (`porn`/`graphic-media`) or more moderate (`nudity`) value instead if the user decides so.", + ), + ), + refs: vec![ + ::jacquard_common::CowStr::new_static("com.atproto.label.defs#selfLabels") + ], + closed: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("labels"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: Some( + ::jacquard_common::CowStr::new_static( + "User-specified self-label values for the material. While the Lexicon by its nature assumes the material to be possibly sensitive by default, these label values are intended to signal that a warning should be put on the material even for the explicit Okazu-Diary.org application users who are willing to see mature contents in general.", + ), + ), + refs: vec![ + ::jacquard_common::CowStr::new_static("com.atproto.label.defs#selfLabels") + ], + closed: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("record"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "User-specified tags for the material.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "org.okazu-diary.material.defs#tag", + ), + }), + min_length: None, + max_length: Some(64usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("thumb"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#thumb"), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Title of the material, typically taken from the material's HTML `<title>` element.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "URI of the material, typically an HTTP(S) URL. If the URL is of a Web interface for an AT resource (such as a `bsky.app` URL), the record should also include the `record` property referencing the AT resource.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("via"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("thumb"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![::jacquard_common::smol_str::SmolStr::new_static("url")], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Thumb<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub url: jacquard_common::types::string::Uri<'a>, +} + +pub mod thumb_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Url; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Url = Unset; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Url = Set<members::url>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `url` field + pub struct url(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ThumbBuilder<'a, S: thumb_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Thumb<'a> { + /// Create a new builder for this type + pub fn new() -> ThumbBuilder<'a, thumb_state::Empty> { + ThumbBuilder::new() + } +} + +impl<'a> ThumbBuilder<'a, thumb_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ThumbBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: thumb_state::State> ThumbBuilder<'a, S> { + /// Set the `cid` field (optional) + pub fn cid( + mut self, + value: impl Into<Option<jacquard_common::types::string::Cid<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `cid` field to an Option value (optional) + pub fn maybe_cid( + mut self, + value: Option<jacquard_common::types::string::Cid<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> ThumbBuilder<'a, S> +where + S: thumb_state::State, + S::Url: thumb_state::IsUnset, +{ + /// Set the `url` field (required) + pub fn url( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> ThumbBuilder<'a, thumb_state::SetUrl<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ThumbBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ThumbBuilder<'a, S> +where + S: thumb_state::State, + S::Url: thumb_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Thumb<'a> { + Thumb { + cid: self.__unsafe_private_named.0, + url: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Thumb<'a> { + Thumb { + cid: self.__unsafe_private_named.0, + url: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Thumb<'a> { + fn nsid() -> &'static str { + "org.okazu-diary.material.external" + } + fn def_name() -> &'static str { + "thumb" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_okazu_diary_material_external() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/org_stormlightlabs.rs b/crates/jacquard-api/src/org_stormlightlabs.rs new file mode 100644 index 00000000..f5b44834 --- /dev/null +++ b/crates/jacquard-api/src/org_stormlightlabs.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod malfestio; \ No newline at end of file diff --git a/crates/jacquard-api/src/org_stormlightlabs/malfestio.rs b/crates/jacquard-api/src/org_stormlightlabs/malfestio.rs new file mode 100644 index 00000000..fe29c188 --- /dev/null +++ b/crates/jacquard-api/src/org_stormlightlabs/malfestio.rs @@ -0,0 +1,7 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod deck; +pub mod thread; \ No newline at end of file diff --git a/crates/jacquard-api/src/org_stormlightlabs/malfestio/deck.rs b/crates/jacquard-api/src/org_stormlightlabs/malfestio/deck.rs new file mode 100644 index 00000000..4d811099 --- /dev/null +++ b/crates/jacquard-api/src/org_stormlightlabs/malfestio/deck.rs @@ -0,0 +1,873 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.stormlightlabs.malfestio.deck +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A collection of flashcards and sources. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Deck<'a> { + /// Ordered list of references to cards in this deck. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub card_refs: std::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + pub created_at: jacquard_common::types::string::Datetime, + /// Description of the deck context. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// Language code for the deck content (e.g., 'en', 'es', 'fr'). + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub language: std::option::Option<jacquard_common::CowStr<'a>>, + /// License for the deck content. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub license: std::option::Option<jacquard_common::CowStr<'a>>, + /// References to source materials (articles, lectures) used in this deck. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub source_refs: std::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Title of the deck. + #[serde(borrow)] + pub title: jacquard_common::CowStr<'a>, + /// Timestamp of last update. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>, + /// Visibility setting for the deck. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub visibility: std::option::Option<DeckVisibility<'a>>, +} + +pub mod deck_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Title; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Title = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type CreatedAt = S::CreatedAt; + type Title = Set<members::title>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `title` field + pub struct title(()); + } +} + +/// Builder for constructing an instance of this type +pub struct DeckBuilder<'a, S: deck_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<DeckVisibility<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Deck<'a> { + /// Create a new builder for this type + pub fn new() -> DeckBuilder<'a, deck_state::Empty> { + DeckBuilder::new() + } +} + +impl<'a> DeckBuilder<'a, deck_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + DeckBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `cardRefs` field (optional) + pub fn card_refs( + mut self, + value: impl Into<Option<Vec<jacquard_common::types::string::AtUri<'a>>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `cardRefs` field to an Option value (optional) + pub fn maybe_card_refs( + mut self, + value: Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> DeckBuilder<'a, S> +where + S: deck_state::State, + S::CreatedAt: deck_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> DeckBuilder<'a, deck_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + DeckBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `language` field (optional) + pub fn language( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `language` field to an Option value (optional) + pub fn maybe_language(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `license` field (optional) + pub fn license( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `license` field to an Option value (optional) + pub fn maybe_license(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `sourceRefs` field (optional) + pub fn source_refs( + mut self, + value: impl Into<Option<Vec<jacquard_common::types::string::AtUri<'a>>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `sourceRefs` field to an Option value (optional) + pub fn maybe_source_refs( + mut self, + value: Option<Vec<jacquard_common::types::string::AtUri<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S> DeckBuilder<'a, S> +where + S: deck_state::State, + S::Title: deck_state::IsUnset, +{ + /// Set the `title` field (required) + pub fn title( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> DeckBuilder<'a, deck_state::SetTitle<S>> { + self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); + DeckBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `updatedAt` field (optional) + pub fn updated_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.8 = value.into(); + self + } + /// Set the `updatedAt` field to an Option value (optional) + pub fn maybe_updated_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.8 = value; + self + } +} + +impl<'a, S: deck_state::State> DeckBuilder<'a, S> { + /// Set the `visibility` field (optional) + pub fn visibility(mut self, value: impl Into<Option<DeckVisibility<'a>>>) -> Self { + self.__unsafe_private_named.9 = value.into(); + self + } + /// Set the `visibility` field to an Option value (optional) + pub fn maybe_visibility(mut self, value: Option<DeckVisibility<'a>>) -> Self { + self.__unsafe_private_named.9 = value; + self + } +} + +impl<'a, S> DeckBuilder<'a, S> +where + S: deck_state::State, + S::CreatedAt: deck_state::IsSet, + S::Title: deck_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Deck<'a> { + Deck { + card_refs: self.__unsafe_private_named.0, + created_at: self.__unsafe_private_named.1.unwrap(), + description: self.__unsafe_private_named.2, + language: self.__unsafe_private_named.3, + license: self.__unsafe_private_named.4, + source_refs: self.__unsafe_private_named.5, + tags: self.__unsafe_private_named.6, + title: self.__unsafe_private_named.7.unwrap(), + updated_at: self.__unsafe_private_named.8, + visibility: self.__unsafe_private_named.9, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Deck<'a> { + Deck { + card_refs: self.__unsafe_private_named.0, + created_at: self.__unsafe_private_named.1.unwrap(), + description: self.__unsafe_private_named.2, + language: self.__unsafe_private_named.3, + license: self.__unsafe_private_named.4, + source_refs: self.__unsafe_private_named.5, + tags: self.__unsafe_private_named.6, + title: self.__unsafe_private_named.7.unwrap(), + updated_at: self.__unsafe_private_named.8, + visibility: self.__unsafe_private_named.9, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Deck<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, DeckRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Visibility setting for the deck. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum DeckVisibility<'a> { + Private, + Unlisted, + Public, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> DeckVisibility<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Private => "private", + Self::Unlisted => "unlisted", + Self::Public => "public", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for DeckVisibility<'a> { + fn from(s: &'a str) -> Self { + match s { + "private" => Self::Private, + "unlisted" => Self::Unlisted, + "public" => Self::Public, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From<String> for DeckVisibility<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "private" => Self::Private, + "unlisted" => Self::Unlisted, + "public" => Self::Public, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for DeckVisibility<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef<str> for DeckVisibility<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for DeckVisibility<'a> { + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for DeckVisibility<'a> +where + 'de: 'a, +{ + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for DeckVisibility<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for DeckVisibility<'_> { + type Output = DeckVisibility<'static>; + fn into_static(self) -> Self::Output { + match self { + DeckVisibility::Private => DeckVisibility::Private, + DeckVisibility::Unlisted => DeckVisibility::Unlisted, + DeckVisibility::Public => DeckVisibility::Public, + DeckVisibility::Other(v) => DeckVisibility::Other(v.into_static()), + } + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DeckGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Deck<'a>, +} + +impl From<DeckGetRecordOutput<'_>> for Deck<'_> { + fn from(output: DeckGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Deck<'_> { + const NSID: &'static str = "org.stormlightlabs.malfestio.deck"; + type Record = DeckRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct DeckRecord; +impl jacquard_common::xrpc::XrpcResp for DeckRecord { + const NSID: &'static str = "org.stormlightlabs.malfestio.deck"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DeckGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for DeckRecord { + const NSID: &'static str = "org.stormlightlabs.malfestio.deck"; + type Record = DeckRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Deck<'a> { + fn nsid() -> &'static str { + "org.stormlightlabs.malfestio.deck" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_stormlightlabs_malfestio_deck() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 3000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 3000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.language { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 20usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "language", + ), + max: 20usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.license { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "license", + ), + max: 500usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 64usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 64usize, + actual: value.len(), + }); + } + } + { + let value = &self.title; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "title", + ), + max: 300usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.visibility { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "visibility", + ), + max: 100usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_org_stormlightlabs_malfestio_deck() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("org.stormlightlabs.malfestio.deck"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A collection of flashcards and sources.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "cardRefs", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Ordered list of references to cards in this deck.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of the deck context.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(3000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "language", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Language code for the deck content (e.g., 'en', 'es', 'fr').", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(20usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("license"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "License for the deck content.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(500usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "sourceRefs", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "References to source materials (articles, lectures) used in this deck.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: None, + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(64usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("title"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Title of the deck."), + ), + format: None, + default: None, + min_length: None, + max_length: Some(300usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "updatedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp of last update.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "visibility", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Visibility setting for the deck.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread.rs b/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread.rs new file mode 100644 index 00000000..d0d1aebb --- /dev/null +++ b/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod comment; \ No newline at end of file diff --git a/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread/comment.rs b/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread/comment.rs new file mode 100644 index 00000000..db349d30 --- /dev/null +++ b/crates/jacquard-api/src/org_stormlightlabs/malfestio/thread/comment.rs @@ -0,0 +1,446 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: org.stormlightlabs.malfestio.thread.comment +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A comment on a deck, card, or note. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Comment<'a> { + /// The comment text. + #[serde(borrow)] + pub body: jacquard_common::CowStr<'a>, + pub created_at: jacquard_common::types::string::Datetime, + /// The parent comment if this is a reply. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub reply_to: std::option::Option<jacquard_common::types::string::AtUri<'a>>, + /// The root subject being commented on. + #[serde(borrow)] + pub subject_ref: jacquard_common::types::string::AtUri<'a>, +} + +pub mod comment_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Body; + type SubjectRef; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Body = Unset; + type SubjectRef = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `body` field to Set + pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBody<S> {} + impl<S: State> State for SetBody<S> { + type Body = Set<members::body>; + type SubjectRef = S::SubjectRef; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `subject_ref` field to Set + pub struct SetSubjectRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubjectRef<S> {} + impl<S: State> State for SetSubjectRef<S> { + type Body = S::Body; + type SubjectRef = Set<members::subject_ref>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Body = S::Body; + type SubjectRef = S::SubjectRef; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `body` field + pub struct body(()); + ///Marker type for the `subject_ref` field + pub struct subject_ref(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CommentBuilder<'a, S: comment_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Comment<'a> { + /// Create a new builder for this type + pub fn new() -> CommentBuilder<'a, comment_state::Empty> { + CommentBuilder::new() + } +} + +impl<'a> CommentBuilder<'a, comment_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CommentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CommentBuilder<'a, S> +where + S: comment_state::State, + S::Body: comment_state::IsUnset, +{ + /// Set the `body` field (required) + pub fn body( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> CommentBuilder<'a, comment_state::SetBody<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CommentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CommentBuilder<'a, S> +where + S: comment_state::State, + S::CreatedAt: comment_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CommentBuilder<'a, comment_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CommentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: comment_state::State> CommentBuilder<'a, S> { + /// Set the `replyTo` field (optional) + pub fn reply_to( + mut self, + value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `replyTo` field to an Option value (optional) + pub fn maybe_reply_to( + mut self, + value: Option<jacquard_common::types::string::AtUri<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> CommentBuilder<'a, S> +where + S: comment_state::State, + S::SubjectRef: comment_state::IsUnset, +{ + /// Set the `subjectRef` field (required) + pub fn subject_ref( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> CommentBuilder<'a, comment_state::SetSubjectRef<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + CommentBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CommentBuilder<'a, S> +where + S: comment_state::State, + S::Body: comment_state::IsSet, + S::SubjectRef: comment_state::IsSet, + S::CreatedAt: comment_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Comment<'a> { + Comment { + body: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + reply_to: self.__unsafe_private_named.2, + subject_ref: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Comment<'a> { + Comment { + body: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + reply_to: self.__unsafe_private_named.2, + subject_ref: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Comment<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, CommentRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CommentGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Comment<'a>, +} + +impl From<CommentGetRecordOutput<'_>> for Comment<'_> { + fn from(output: CommentGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Comment<'_> { + const NSID: &'static str = "org.stormlightlabs.malfestio.thread.comment"; + type Record = CommentRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct CommentRecord; +impl jacquard_common::xrpc::XrpcResp for CommentRecord { + const NSID: &'static str = "org.stormlightlabs.malfestio.thread.comment"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CommentGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for CommentRecord { + const NSID: &'static str = "org.stormlightlabs.malfestio.thread.comment"; + type Record = CommentRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Comment<'a> { + fn nsid() -> &'static str { + "org.stormlightlabs.malfestio.thread.comment" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_org_stormlightlabs_malfestio_thread_comment() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.body; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 5000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "body", + ), + max: 5000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_org_stormlightlabs_malfestio_thread_comment() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "org.stormlightlabs.malfestio.thread.comment", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A comment on a deck, card, or note.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("subjectRef"), + ::jacquard_common::smol_str::SmolStr::new_static("body"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("body"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("The comment text."), + ), + format: None, + default: None, + min_length: None, + max_length: Some(5000usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("replyTo"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The parent comment if this is a reply.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "subjectRef", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The root subject being commented on.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_atwork/endorsement.rs b/crates/jacquard-api/src/place_atwork/endorsement.rs index c7d255ea..b9c4a99e 100644 --- a/crates/jacquard-api/src/place_atwork/endorsement.rs +++ b/crates/jacquard-api/src/place_atwork/endorsement.rs @@ -48,8 +48,8 @@ pub mod endorsement_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Giver; - type CreatedAt; type Text; + type CreatedAt; type Receiver; } /// Empty state - all required fields are unset @@ -57,8 +57,8 @@ pub mod endorsement_state { impl sealed::Sealed for Empty {} impl State for Empty { type Giver = Unset; - type CreatedAt = Unset; type Text = Unset; + type CreatedAt = Unset; type Receiver = Unset; } ///State transition - sets the `giver` field to Set @@ -66,17 +66,8 @@ pub mod endorsement_state { impl<S: State> sealed::Sealed for SetGiver<S> {} impl<S: State> State for SetGiver<S> { type Giver = Set<members::giver>; - type CreatedAt = S::CreatedAt; - type Text = S::Text; - type Receiver = S::Receiver; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Giver = S::Giver; - type CreatedAt = Set<members::created_at>; type Text = S::Text; + type CreatedAt = S::CreatedAt; type Receiver = S::Receiver; } ///State transition - sets the `text` field to Set @@ -84,8 +75,17 @@ pub mod endorsement_state { impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { type Giver = S::Giver; - type CreatedAt = S::CreatedAt; type Text = Set<members::text>; + type CreatedAt = S::CreatedAt; + type Receiver = S::Receiver; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Giver = S::Giver; + type Text = S::Text; + type CreatedAt = Set<members::created_at>; type Receiver = S::Receiver; } ///State transition - sets the `receiver` field to Set @@ -93,8 +93,8 @@ pub mod endorsement_state { impl<S: State> sealed::Sealed for SetReceiver<S> {} impl<S: State> State for SetReceiver<S> { type Giver = S::Giver; - type CreatedAt = S::CreatedAt; type Text = S::Text; + type CreatedAt = S::CreatedAt; type Receiver = Set<members::receiver>; } /// Marker types for field names @@ -102,10 +102,10 @@ pub mod endorsement_state { pub mod members { ///Marker type for the `giver` field pub struct giver(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `text` field pub struct text(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `receiver` field pub struct receiver(()); } @@ -243,8 +243,8 @@ impl<'a, S> EndorsementBuilder<'a, S> where S: endorsement_state::State, S::Giver: endorsement_state::IsSet, - S::CreatedAt: endorsement_state::IsSet, S::Text: endorsement_state::IsSet, + S::CreatedAt: endorsement_state::IsSet, S::Receiver: endorsement_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/place_atwork/get_listing.rs b/crates/jacquard-api/src/place_atwork/get_listing.rs index 33c4c2f0..4d75bdbb 100644 --- a/crates/jacquard-api/src/place_atwork/get_listing.rs +++ b/crates/jacquard-api/src/place_atwork/get_listing.rs @@ -32,37 +32,37 @@ pub mod get_listing_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rkey; type Repo; + type Rkey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rkey = Unset; type Repo = Unset; - } - ///State transition - sets the `rkey` field to Set - pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRkey<S> {} - impl<S: State> State for SetRkey<S> { - type Rkey = Set<members::rkey>; - type Repo = S::Repo; + type Rkey = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Rkey = S::Rkey; type Repo = Set<members::repo>; + type Rkey = S::Rkey; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Repo = S::Repo; + type Rkey = Set<members::rkey>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rkey` field - pub struct rkey(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `rkey` field + pub struct rkey(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetListingBuilder<'a, S> where S: get_listing_state::State, - S::Rkey: get_listing_state::IsSet, S::Repo: get_listing_state::IsSet, + S::Rkey: get_listing_state::IsSet, { /// Build the final struct pub fn build(self) -> GetListing<'a> { diff --git a/crates/jacquard-api/src/place_atwork/listing.rs b/crates/jacquard-api/src/place_atwork/listing.rs index fe27894a..3e47bf63 100644 --- a/crates/jacquard-api/src/place_atwork/listing.rs +++ b/crates/jacquard-api/src/place_atwork/listing.rs @@ -58,67 +58,67 @@ pub mod listing_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Title; + type NotBefore; type Description; type NotAfter; - type NotBefore; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Title = Unset; + type NotBefore = Unset; type Description = Unset; type NotAfter = Unset; - type NotBefore = Unset; + type Title = Unset; } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Title = Set<members::title>; + ///State transition - sets the `not_before` field to Set + pub struct SetNotBefore<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotBefore<S> {} + impl<S: State> State for SetNotBefore<S> { + type NotBefore = Set<members::not_before>; type Description = S::Description; type NotAfter = S::NotAfter; - type NotBefore = S::NotBefore; + type Title = S::Title; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Title = S::Title; + type NotBefore = S::NotBefore; type Description = Set<members::description>; type NotAfter = S::NotAfter; - type NotBefore = S::NotBefore; + type Title = S::Title; } ///State transition - sets the `not_after` field to Set pub struct SetNotAfter<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNotAfter<S> {} impl<S: State> State for SetNotAfter<S> { - type Title = S::Title; + type NotBefore = S::NotBefore; type Description = S::Description; type NotAfter = Set<members::not_after>; - type NotBefore = S::NotBefore; - } - ///State transition - sets the `not_before` field to Set - pub struct SetNotBefore<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotBefore<S> {} - impl<S: State> State for SetNotBefore<S> { type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type NotBefore = S::NotBefore; type Description = S::Description; type NotAfter = S::NotAfter; - type NotBefore = Set<members::not_before>; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `title` field - pub struct title(()); + ///Marker type for the `not_before` field + pub struct not_before(()); ///Marker type for the `description` field pub struct description(()); ///Marker type for the `not_after` field pub struct not_after(()); - ///Marker type for the `not_before` field - pub struct not_before(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -315,10 +315,10 @@ where impl<'a, S> ListingBuilder<'a, S> where S: listing_state::State, - S::Title: listing_state::IsSet, + S::NotBefore: listing_state::IsSet, S::Description: listing_state::IsSet, S::NotAfter: listing_state::IsSet, - S::NotBefore: listing_state::IsSet, + S::Title: listing_state::IsSet, { /// Build the final struct pub fn build(self) -> Listing<'a> { diff --git a/crates/jacquard-api/src/place_atwork/search_listings.rs b/crates/jacquard-api/src/place_atwork/search_listings.rs index 54a1f714..7bf341bd 100644 --- a/crates/jacquard-api/src/place_atwork/search_listings.rs +++ b/crates/jacquard-api/src/place_atwork/search_listings.rs @@ -40,37 +40,37 @@ pub mod listing_record_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; + type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Uri = S::Uri; type Cid = Set<members::cid>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Cid = S::Cid; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -163,8 +163,8 @@ impl<'a, S: listing_record_state::State> ListingRecordBuilder<'a, S> { impl<'a, S> ListingRecordBuilder<'a, S> where S: listing_record_state::State, - S::Uri: listing_record_state::IsSet, S::Cid: listing_record_state::IsSet, + S::Uri: listing_record_state::IsSet, { /// Build the final struct pub fn build(self) -> ListingRecord<'a> { diff --git a/crates/jacquard-api/src/place_stream.rs b/crates/jacquard-api/src/place_stream.rs index 33560c8b..bcec0510 100644 --- a/crates/jacquard-api/src/place_stream.rs +++ b/crates/jacquard-api/src/place_stream.rs @@ -5,6 +5,7 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +pub mod branding; pub mod broadcast; pub mod chat; pub mod graph; @@ -12,6 +13,8 @@ pub mod key; pub mod live; pub mod livestream; pub mod metadata; +pub mod moderation; +pub mod multistream; pub mod richtext; pub mod segment; pub mod server; @@ -49,85 +52,85 @@ pub mod block_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type IndexedAt; - type Cid; type Uri; - type Blocker; type Record; + type IndexedAt; + type Blocker; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type IndexedAt = Unset; - type Cid = Unset; type Uri = Unset; - type Blocker = Unset; type Record = Unset; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type IndexedAt = Set<members::indexed_at>; - type Cid = S::Cid; - type Uri = S::Uri; - type Blocker = S::Blocker; - type Record = S::Record; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type IndexedAt = S::IndexedAt; - type Cid = Set<members::cid>; - type Uri = S::Uri; - type Blocker = S::Blocker; - type Record = S::Record; + type IndexedAt = Unset; + type Blocker = Unset; + type Cid = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type Record = S::Record; type IndexedAt = S::IndexedAt; + type Blocker = S::Blocker; type Cid = S::Cid; - type Uri = Set<members::uri>; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Uri = S::Uri; + type Record = Set<members::record>; + type IndexedAt = S::IndexedAt; type Blocker = S::Blocker; + type Cid = S::Cid; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Uri = S::Uri; type Record = S::Record; + type IndexedAt = Set<members::indexed_at>; + type Blocker = S::Blocker; + type Cid = S::Cid; } ///State transition - sets the `blocker` field to Set pub struct SetBlocker<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlocker<S> {} impl<S: State> State for SetBlocker<S> { - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; type Uri = S::Uri; - type Blocker = Set<members::blocker>; type Record = S::Record; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { type IndexedAt = S::IndexedAt; + type Blocker = Set<members::blocker>; type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Uri = S::Uri; + type Record = S::Record; + type IndexedAt = S::IndexedAt; type Blocker = S::Blocker; - type Record = Set<members::record>; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `blocker` field - pub struct blocker(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `blocker` field + pub struct blocker(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -260,11 +263,11 @@ where impl<'a, S> BlockViewBuilder<'a, S> where S: block_view_state::State, - S::IndexedAt: block_view_state::IsSet, - S::Cid: block_view_state::IsSet, S::Uri: block_view_state::IsSet, - S::Blocker: block_view_state::IsSet, S::Record: block_view_state::IsSet, + S::IndexedAt: block_view_state::IsSet, + S::Blocker: block_view_state::IsSet, + S::Cid: block_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BlockView<'a> { diff --git a/crates/jacquard-api/src/place_stream/branding.rs b/crates/jacquard-api/src/place_stream/branding.rs new file mode 100644 index 00000000..1f201185 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/branding.rs @@ -0,0 +1,9 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod delete_blob; +pub mod get_blob; +pub mod get_branding; +pub mod update_blob; \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/branding/delete_blob.rs b/crates/jacquard-api/src/place_stream/branding/delete_blob.rs new file mode 100644 index 00000000..23dcca25 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/branding/delete_blob.rs @@ -0,0 +1,118 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.branding.deleteBlob +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteBlob<'a> { + /// DID of the broadcaster. If not provided, uses the server's default broadcaster. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub broadcaster: std::option::Option<jacquard_common::types::string::Did<'a>>, + /// Branding asset key (mainLogo, favicon, siteTitle, etc.) + #[serde(borrow)] + pub key: jacquard_common::CowStr<'a>, +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteBlobOutput<'a> { + pub success: bool, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum DeleteBlobError<'a> { + /// The authenticated DID is not authorized to modify branding + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The requested branding asset does not exist + #[serde(rename = "BrandingNotFound")] + BrandingNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for DeleteBlobError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::BrandingNotFound(msg) => { + write!(f, "BrandingNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.branding.deleteBlob +pub struct DeleteBlobResponse; +impl jacquard_common::xrpc::XrpcResp for DeleteBlobResponse { + const NSID: &'static str = "place.stream.branding.deleteBlob"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DeleteBlobOutput<'de>; + type Err<'de> = DeleteBlobError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteBlob<'a> { + const NSID: &'static str = "place.stream.branding.deleteBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = DeleteBlobResponse; +} + +/// Endpoint type for +///place.stream.branding.deleteBlob +pub struct DeleteBlobRequest; +impl jacquard_common::xrpc::XrpcEndpoint for DeleteBlobRequest { + const PATH: &'static str = "/xrpc/place.stream.branding.deleteBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = DeleteBlob<'de>; + type Response = DeleteBlobResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/branding/get_blob.rs b/crates/jacquard-api/src/place_stream/branding/get_blob.rs new file mode 100644 index 00000000..3c27e7af --- /dev/null +++ b/crates/jacquard-api/src/place_stream/branding/get_blob.rs @@ -0,0 +1,227 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.branding.getBlob +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetBlob<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub broadcaster: std::option::Option<jacquard_common::types::string::Did<'a>>, + #[serde(borrow)] + pub key: jacquard_common::CowStr<'a>, +} + +pub mod get_blob_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Key; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Key = Unset; + } + ///State transition - sets the `key` field to Set + pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKey<S> {} + impl<S: State> State for SetKey<S> { + type Key = Set<members::key>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `key` field + pub struct key(()); + } +} + +/// Builder for constructing an instance of this type +pub struct GetBlobBuilder<'a, S: get_blob_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> GetBlob<'a> { + /// Create a new builder for this type + pub fn new() -> GetBlobBuilder<'a, get_blob_state::Empty> { + GetBlobBuilder::new() + } +} + +impl<'a> GetBlobBuilder<'a, get_blob_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GetBlobBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: get_blob_state::State> GetBlobBuilder<'a, S> { + /// Set the `broadcaster` field (optional) + pub fn broadcaster( + mut self, + value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `broadcaster` field to an Option value (optional) + pub fn maybe_broadcaster( + mut self, + value: Option<jacquard_common::types::string::Did<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> GetBlobBuilder<'a, S> +where + S: get_blob_state::State, + S::Key: get_blob_state::IsUnset, +{ + /// Set the `key` field (required) + pub fn key( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> GetBlobBuilder<'a, get_blob_state::SetKey<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + GetBlobBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> GetBlobBuilder<'a, S> +where + S: get_blob_state::State, + S::Key: get_blob_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> GetBlob<'a> { + GetBlob { + broadcaster: self.__unsafe_private_named.0, + key: self.__unsafe_private_named.1.unwrap(), + } + } +} + +/// Raw blob data with appropriate content-type +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetBlobOutput { + pub body: bytes::Bytes, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum GetBlobError<'a> { + /// The requested branding asset does not exist + #[serde(rename = "BrandingNotFound")] + BrandingNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for GetBlobError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::BrandingNotFound(msg) => { + write!(f, "BrandingNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.branding.getBlob +pub struct GetBlobResponse; +impl jacquard_common::xrpc::XrpcResp for GetBlobResponse { + const NSID: &'static str = "place.stream.branding.getBlob"; + const ENCODING: &'static str = "*/*"; + type Output<'de> = GetBlobOutput; + type Err<'de> = GetBlobError<'de>; + fn encode_output( + output: &Self::Output<'_>, + ) -> Result<Vec<u8>, jacquard_common::xrpc::EncodeError> { + Ok(output.body.to_vec()) + } + fn decode_output<'de>( + body: &'de [u8], + ) -> Result<Self::Output<'de>, jacquard_common::error::DecodeError> + where + Self::Output<'de>: serde::Deserialize<'de>, + { + Ok(GetBlobOutput { + body: bytes::Bytes::copy_from_slice(body), + }) + } +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for GetBlob<'a> { + const NSID: &'static str = "place.stream.branding.getBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Response = GetBlobResponse; +} + +/// Endpoint type for +///place.stream.branding.getBlob +pub struct GetBlobRequest; +impl jacquard_common::xrpc::XrpcEndpoint for GetBlobRequest { + const PATH: &'static str = "/xrpc/place.stream.branding.getBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Request<'de> = GetBlob<'de>; + type Response = GetBlobResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/branding/get_branding.rs b/crates/jacquard-api/src/place_stream/branding/get_branding.rs new file mode 100644 index 00000000..b765769a --- /dev/null +++ b/crates/jacquard-api/src/place_stream/branding/get_branding.rs @@ -0,0 +1,390 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.branding.getBranding +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct BrandingAsset<'a> { + /// Inline data for text assets + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub data: std::option::Option<jacquard_common::CowStr<'a>>, + /// Image height in pixels (optional, for images only) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub height: std::option::Option<i64>, + /// Asset key identifier + #[serde(borrow)] + pub key: jacquard_common::CowStr<'a>, + /// MIME type of the asset + #[serde(borrow)] + pub mime_type: jacquard_common::CowStr<'a>, + /// URL to fetch the asset blob (for images) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub url: std::option::Option<jacquard_common::CowStr<'a>>, + /// Image width in pixels (optional, for images only) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub width: std::option::Option<i64>, +} + +fn lexicon_doc_place_stream_branding_getBranding() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("place.stream.branding.getBranding"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("brandingAsset"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("key"), + ::jacquard_common::smol_str::SmolStr::new_static("mimeType") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("data"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Inline data for text assets", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("height"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("key"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Asset key identifier", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("mimeType"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "MIME type of the asset", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "URL to fetch the asset blob (for images)", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("width"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { + description: None, + parameters: Some( + ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { + description: None, + required: Some(vec![]), + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "broadcaster", + ), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "DID of the broadcaster. If not provided, uses the server's default broadcaster.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ), + output: None, + errors: None, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BrandingAsset<'a> { + fn nsid() -> &'static str { + "place.stream.branding.getBranding" + } + fn def_name() -> &'static str { + "brandingAsset" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_branding_getBranding() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetBranding<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub broadcaster: std::option::Option<jacquard_common::types::string::Did<'a>>, +} + +pub mod get_branding_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed {} + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty {} + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members {} +} + +/// Builder for constructing an instance of this type +pub struct GetBrandingBuilder<'a, S: get_branding_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> GetBranding<'a> { + /// Create a new builder for this type + pub fn new() -> GetBrandingBuilder<'a, get_branding_state::Empty> { + GetBrandingBuilder::new() + } +} + +impl<'a> GetBrandingBuilder<'a, get_branding_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + GetBrandingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: get_branding_state::State> GetBrandingBuilder<'a, S> { + /// Set the `broadcaster` field (optional) + pub fn broadcaster( + mut self, + value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `broadcaster` field to an Option value (optional) + pub fn maybe_broadcaster( + mut self, + value: Option<jacquard_common::types::string::Did<'a>>, + ) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> GetBrandingBuilder<'a, S> +where + S: get_branding_state::State, +{ + /// Build the final struct + pub fn build(self) -> GetBranding<'a> { + GetBranding { + broadcaster: self.__unsafe_private_named.0, + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct GetBrandingOutput<'a> { + /// List of available branding assets + #[serde(borrow)] + pub assets: Vec<crate::place_stream::branding::get_branding::BrandingAsset<'a>>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum GetBrandingError<'a> {} +impl core::fmt::Display for GetBrandingError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.branding.getBranding +pub struct GetBrandingResponse; +impl jacquard_common::xrpc::XrpcResp for GetBrandingResponse { + const NSID: &'static str = "place.stream.branding.getBranding"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = GetBrandingOutput<'de>; + type Err<'de> = GetBrandingError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for GetBranding<'a> { + const NSID: &'static str = "place.stream.branding.getBranding"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Response = GetBrandingResponse; +} + +/// Endpoint type for +///place.stream.branding.getBranding +pub struct GetBrandingRequest; +impl jacquard_common::xrpc::XrpcEndpoint for GetBrandingRequest { + const PATH: &'static str = "/xrpc/place.stream.branding.getBranding"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Request<'de> = GetBranding<'de>; + type Response = GetBrandingResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/branding/update_blob.rs b/crates/jacquard-api/src/place_stream/branding/update_blob.rs new file mode 100644 index 00000000..43d2bc1a --- /dev/null +++ b/crates/jacquard-api/src/place_stream/branding/update_blob.rs @@ -0,0 +1,130 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.branding.updateBlob +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct UpdateBlob<'a> { + /// DID of the broadcaster. If not provided, uses the server's default broadcaster. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub broadcaster: std::option::Option<jacquard_common::types::string::Did<'a>>, + /// Base64-encoded blob data + #[serde(borrow)] + pub data: jacquard_common::CowStr<'a>, + /// Image height in pixels (optional, for images only) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub height: std::option::Option<i64>, + /// Branding asset key (mainLogo, favicon, siteTitle, etc.) + #[serde(borrow)] + pub key: jacquard_common::CowStr<'a>, + /// MIME type of the blob (e.g., image/png, text/plain) + #[serde(borrow)] + pub mime_type: jacquard_common::CowStr<'a>, + /// Image width in pixels (optional, for images only) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub width: std::option::Option<i64>, +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct UpdateBlobOutput<'a> { + pub success: bool, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum UpdateBlobError<'a> { + /// The authenticated DID is not authorized to modify branding + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The blob exceeds the maximum size limit + #[serde(rename = "BlobTooLarge")] + BlobTooLarge(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for UpdateBlobError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::BlobTooLarge(msg) => { + write!(f, "BlobTooLarge")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.branding.updateBlob +pub struct UpdateBlobResponse; +impl jacquard_common::xrpc::XrpcResp for UpdateBlobResponse { + const NSID: &'static str = "place.stream.branding.updateBlob"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = UpdateBlobOutput<'de>; + type Err<'de> = UpdateBlobError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for UpdateBlob<'a> { + const NSID: &'static str = "place.stream.branding.updateBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = UpdateBlobResponse; +} + +/// Endpoint type for +///place.stream.branding.updateBlob +pub struct UpdateBlobRequest; +impl jacquard_common::xrpc::XrpcEndpoint for UpdateBlobRequest { + const PATH: &'static str = "/xrpc/place.stream.branding.updateBlob"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = UpdateBlob<'de>; + type Response = UpdateBlobResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/broadcast.rs b/crates/jacquard-api/src/place_stream/broadcast.rs index 9e38191c..2632d89f 100644 --- a/crates/jacquard-api/src/place_stream/broadcast.rs +++ b/crates/jacquard-api/src/place_stream/broadcast.rs @@ -41,67 +41,67 @@ pub mod broadcast_origin_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Cid; - type Author; type Record; + type Author; + type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Cid = Unset; - type Author = Unset; type Record = Unset; + type Author = Unset; + type Cid = Unset; + type Uri = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Record = Set<members::record>; type Author = S::Author; - type Record = S::Record; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + type Cid = S::Cid; type Uri = S::Uri; - type Cid = Set<members::cid>; - type Author = S::Author; - type Record = S::Record; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Uri = S::Uri; - type Cid = S::Cid; - type Author = Set<members::author>; type Record = S::Record; + type Author = Set<members::author>; + type Cid = S::Cid; + type Uri = S::Uri; } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Record = S::Record; + type Author = S::Author; + type Cid = Set<members::cid>; type Uri = S::Uri; - type Cid = S::Cid; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Record = S::Record; type Author = S::Author; - type Record = Set<members::record>; + type Cid = S::Cid; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -214,10 +214,10 @@ where impl<'a, S> BroadcastOriginViewBuilder<'a, S> where S: broadcast_origin_view_state::State, - S::Uri: broadcast_origin_view_state::IsSet, - S::Cid: broadcast_origin_view_state::IsSet, - S::Author: broadcast_origin_view_state::IsSet, S::Record: broadcast_origin_view_state::IsSet, + S::Author: broadcast_origin_view_state::IsSet, + S::Cid: broadcast_origin_view_state::IsSet, + S::Uri: broadcast_origin_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BroadcastOriginView<'a> { diff --git a/crates/jacquard-api/src/place_stream/broadcast/get_broadcaster.rs b/crates/jacquard-api/src/place_stream/broadcast/get_broadcaster.rs index 7d80053b..0d61fb34 100644 --- a/crates/jacquard-api/src/place_stream/broadcast/get_broadcaster.rs +++ b/crates/jacquard-api/src/place_stream/broadcast/get_broadcaster.rs @@ -28,6 +28,10 @@ pub struct GetBroadcaster; )] #[serde(rename_all = "camelCase")] pub struct GetBroadcasterOutput<'a> { + /// Array of DIDs authorized as admins + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub admins: std::option::Option<Vec<jacquard_common::types::string::Did<'a>>>, /// DID of the Streamplace broadcaster to which this server belongs #[serde(borrow)] pub broadcaster: jacquard_common::types::string::Did<'a>, @@ -37,29 +41,6 @@ pub struct GetBroadcasterOutput<'a> { pub server: std::option::Option<jacquard_common::types::string::Did<'a>>, } -#[jacquard_derive::open_union] -#[derive( - serde::Serialize, - serde::Deserialize, - Debug, - Clone, - PartialEq, - Eq, - thiserror::Error, - miette::Diagnostic, - jacquard_derive::IntoStatic -)] -#[serde(tag = "error", content = "message")] -#[serde(bound(deserialize = "'de: 'a"))] -pub enum GetBroadcasterError<'a> {} -impl core::fmt::Display for GetBroadcasterError<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - match self { - Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), - } - } -} - /// Response type for ///place.stream.broadcast.getBroadcaster pub struct GetBroadcasterResponse; @@ -67,7 +48,7 @@ impl jacquard_common::xrpc::XrpcResp for GetBroadcasterResponse { const NSID: &'static str = "place.stream.broadcast.getBroadcaster"; const ENCODING: &'static str = "application/json"; type Output<'de> = GetBroadcasterOutput<'de>; - type Err<'de> = GetBroadcasterError<'de>; + type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl jacquard_common::xrpc::XrpcRequest for GetBroadcaster { diff --git a/crates/jacquard-api/src/place_stream/broadcast/origin.rs b/crates/jacquard-api/src/place_stream/broadcast/origin.rs index 928cc873..b4bc41a7 100644 --- a/crates/jacquard-api/src/place_stream/broadcast/origin.rs +++ b/crates/jacquard-api/src/place_stream/broadcast/origin.rs @@ -50,51 +50,51 @@ pub mod origin_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UpdatedAt; - type Streamer; type Server; + type Streamer; + type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UpdatedAt = Unset; - type Streamer = Unset; type Server = Unset; + type Streamer = Unset; + type UpdatedAt = Unset; } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type UpdatedAt = Set<members::updated_at>; + ///State transition - sets the `server` field to Set + pub struct SetServer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetServer<S> {} + impl<S: State> State for SetServer<S> { + type Server = Set<members::server>; type Streamer = S::Streamer; - type Server = S::Server; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `streamer` field to Set pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStreamer<S> {} impl<S: State> State for SetStreamer<S> { - type UpdatedAt = S::UpdatedAt; - type Streamer = Set<members::streamer>; type Server = S::Server; - } - ///State transition - sets the `server` field to Set - pub struct SetServer<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetServer<S> {} - impl<S: State> State for SetServer<S> { + type Streamer = Set<members::streamer>; type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type Server = S::Server; type Streamer = S::Streamer; - type Server = Set<members::server>; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `updated_at` field - pub struct updated_at(()); - ///Marker type for the `streamer` field - pub struct streamer(()); ///Marker type for the `server` field pub struct server(()); + ///Marker type for the `streamer` field + pub struct streamer(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); } } @@ -247,9 +247,9 @@ impl<'a, S: origin_state::State> OriginBuilder<'a, S> { impl<'a, S> OriginBuilder<'a, S> where S: origin_state::State, - S::UpdatedAt: origin_state::IsSet, - S::Streamer: origin_state::IsSet, S::Server: origin_state::IsSet, + S::Streamer: origin_state::IsSet, + S::UpdatedAt: origin_state::IsSet, { /// Build the final struct pub fn build(self) -> Origin<'a> { diff --git a/crates/jacquard-api/src/place_stream/chat.rs b/crates/jacquard-api/src/place_stream/chat.rs index 2fb1d069..bb0e4dad 100644 --- a/crates/jacquard-api/src/place_stream/chat.rs +++ b/crates/jacquard-api/src/place_stream/chat.rs @@ -53,85 +53,85 @@ pub mod message_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Author; + type Cid; type IndexedAt; type Record; type Uri; - type Cid; + type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Author = Unset; + type Cid = Unset; type IndexedAt = Unset; type Record = Unset; type Uri = Unset; - type Cid = Unset; + type Author = Unset; } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { - type Author = Set<members::author>; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; type IndexedAt = S::IndexedAt; type Record = S::Record; type Uri = S::Uri; - type Cid = S::Cid; + type Author = S::Author; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Author = S::Author; + type Cid = S::Cid; type IndexedAt = Set<members::indexed_at>; type Record = S::Record; type Uri = S::Uri; - type Cid = S::Cid; + type Author = S::Author; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Author = S::Author; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Record = Set<members::record>; type Uri = S::Uri; - type Cid = S::Cid; + type Author = S::Author; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Author = S::Author; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Record = S::Record; type Uri = Set<members::uri>; - type Cid = S::Cid; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { type Author = S::Author; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Cid = S::Cid; type IndexedAt = S::IndexedAt; type Record = S::Record; type Uri = S::Uri; - type Cid = Set<members::cid>; + type Author = Set<members::author>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `author` field - pub struct author(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); + ///Marker type for the `author` field + pub struct author(()); } } @@ -312,11 +312,11 @@ where impl<'a, S> MessageViewBuilder<'a, S> where S: message_view_state::State, - S::Author: message_view_state::IsSet, + S::Cid: message_view_state::IsSet, S::IndexedAt: message_view_state::IsSet, S::Record: message_view_state::IsSet, S::Uri: message_view_state::IsSet, - S::Cid: message_view_state::IsSet, + S::Author: message_view_state::IsSet, { /// Build the final struct pub fn build(self) -> MessageView<'a> { diff --git a/crates/jacquard-api/src/place_stream/chat/message.rs b/crates/jacquard-api/src/place_stream/chat/message.rs index f9db244c..dc809afc 100644 --- a/crates/jacquard-api/src/place_stream/chat/message.rs +++ b/crates/jacquard-api/src/place_stream/chat/message.rs @@ -47,51 +47,51 @@ pub mod message_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Streamer; - type Text; type CreatedAt; + type Text; + type Streamer; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Streamer = Unset; - type Text = Unset; type CreatedAt = Unset; + type Text = Unset; + type Streamer = Unset; } - ///State transition - sets the `streamer` field to Set - pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStreamer<S> {} - impl<S: State> State for SetStreamer<S> { - type Streamer = Set<members::streamer>; + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; type Text = S::Text; - type CreatedAt = S::CreatedAt; + type Streamer = S::Streamer; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetText<S> {} impl<S: State> State for SetText<S> { - type Streamer = S::Streamer; - type Text = Set<members::text>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + type Text = Set<members::text>; type Streamer = S::Streamer; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type CreatedAt = S::CreatedAt; type Text = S::Text; - type CreatedAt = Set<members::created_at>; + type Streamer = Set<members::streamer>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `streamer` field - pub struct streamer(()); - ///Marker type for the `text` field - pub struct text(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `text` field + pub struct text(()); + ///Marker type for the `streamer` field + pub struct streamer(()); } } @@ -224,9 +224,9 @@ where impl<'a, S> MessageBuilder<'a, S> where S: message_state::State, - S::Streamer: message_state::IsSet, - S::Text: message_state::IsSet, S::CreatedAt: message_state::IsSet, + S::Text: message_state::IsSet, + S::Streamer: message_state::IsSet, { /// Build the final struct pub fn build(self) -> Message<'a> { @@ -564,37 +564,37 @@ pub mod reply_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Root; type Parent; + type Root; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Root = Unset; type Parent = Unset; - } - ///State transition - sets the `root` field to Set - pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRoot<S> {} - impl<S: State> State for SetRoot<S> { - type Root = Set<members::root>; - type Parent = S::Parent; + type Root = Unset; } ///State transition - sets the `parent` field to Set pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetParent<S> {} impl<S: State> State for SetParent<S> { - type Root = S::Root; type Parent = Set<members::parent>; + type Root = S::Root; + } + ///State transition - sets the `root` field to Set + pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRoot<S> {} + impl<S: State> State for SetRoot<S> { + type Parent = S::Parent; + type Root = Set<members::root>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `root` field - pub struct root(()); ///Marker type for the `parent` field pub struct parent(()); + ///Marker type for the `root` field + pub struct root(()); } } @@ -667,8 +667,8 @@ where impl<'a, S> ReplyRefBuilder<'a, S> where S: reply_ref_state::State, - S::Root: reply_ref_state::IsSet, S::Parent: reply_ref_state::IsSet, + S::Root: reply_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> ReplyRef<'a> { diff --git a/crates/jacquard-api/src/place_stream/chat/profile.rs b/crates/jacquard-api/src/place_stream/chat/profile.rs index 7e56ba45..d4a62ac1 100644 --- a/crates/jacquard-api/src/place_stream/chat/profile.rs +++ b/crates/jacquard-api/src/place_stream/chat/profile.rs @@ -34,50 +34,50 @@ pub mod color_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Red; - type Blue; type Green; + type Blue; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Red = Unset; - type Blue = Unset; type Green = Unset; + type Blue = Unset; } ///State transition - sets the `red` field to Set pub struct SetRed<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRed<S> {} impl<S: State> State for SetRed<S> { type Red = Set<members::red>; - type Blue = S::Blue; - type Green = S::Green; - } - ///State transition - sets the `blue` field to Set - pub struct SetBlue<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlue<S> {} - impl<S: State> State for SetBlue<S> { - type Red = S::Red; - type Blue = Set<members::blue>; type Green = S::Green; + type Blue = S::Blue; } ///State transition - sets the `green` field to Set pub struct SetGreen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGreen<S> {} impl<S: State> State for SetGreen<S> { type Red = S::Red; - type Blue = S::Blue; type Green = Set<members::green>; + type Blue = S::Blue; + } + ///State transition - sets the `blue` field to Set + pub struct SetBlue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlue<S> {} + impl<S: State> State for SetBlue<S> { + type Red = S::Red; + type Green = S::Green; + type Blue = Set<members::blue>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `red` field pub struct red(()); - ///Marker type for the `blue` field - pub struct blue(()); ///Marker type for the `green` field pub struct green(()); + ///Marker type for the `blue` field + pub struct blue(()); } } @@ -171,8 +171,8 @@ impl<'a, S> ColorBuilder<'a, S> where S: color_state::State, S::Red: color_state::IsSet, - S::Blue: color_state::IsSet, S::Green: color_state::IsSet, + S::Blue: color_state::IsSet, { /// Build the final struct pub fn build(self) -> Color<'a> { diff --git a/crates/jacquard-api/src/place_stream/graph/get_following_user.rs b/crates/jacquard-api/src/place_stream/graph/get_following_user.rs index 2cedc1ec..058333cf 100644 --- a/crates/jacquard-api/src/place_stream/graph/get_following_user.rs +++ b/crates/jacquard-api/src/place_stream/graph/get_following_user.rs @@ -32,37 +32,37 @@ pub mod get_following_user_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SubjectDid; type UserDid; + type SubjectDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SubjectDid = Unset; type UserDid = Unset; - } - ///State transition - sets the `subject_did` field to Set - pub struct SetSubjectDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubjectDid<S> {} - impl<S: State> State for SetSubjectDid<S> { - type SubjectDid = Set<members::subject_did>; - type UserDid = S::UserDid; + type SubjectDid = Unset; } ///State transition - sets the `user_did` field to Set pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUserDid<S> {} impl<S: State> State for SetUserDid<S> { - type SubjectDid = S::SubjectDid; type UserDid = Set<members::user_did>; + type SubjectDid = S::SubjectDid; + } + ///State transition - sets the `subject_did` field to Set + pub struct SetSubjectDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubjectDid<S> {} + impl<S: State> State for SetSubjectDid<S> { + type UserDid = S::UserDid; + type SubjectDid = Set<members::subject_did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject_did` field - pub struct subject_did(()); ///Marker type for the `user_did` field pub struct user_did(()); + ///Marker type for the `subject_did` field + pub struct subject_did(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetFollowingUserBuilder<'a, S> where S: get_following_user_state::State, - S::SubjectDid: get_following_user_state::IsSet, S::UserDid: get_following_user_state::IsSet, + S::SubjectDid: get_following_user_state::IsSet, { /// Build the final struct pub fn build(self) -> GetFollowingUser<'a> { diff --git a/crates/jacquard-api/src/place_stream/key.rs b/crates/jacquard-api/src/place_stream/key.rs index a061280f..0ef4cad8 100644 --- a/crates/jacquard-api/src/place_stream/key.rs +++ b/crates/jacquard-api/src/place_stream/key.rs @@ -39,37 +39,37 @@ pub mod key_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type SigningKey; type CreatedAt; + type SigningKey; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type SigningKey = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `signing_key` field to Set - pub struct SetSigningKey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSigningKey<S> {} - impl<S: State> State for SetSigningKey<S> { - type SigningKey = Set<members::signing_key>; - type CreatedAt = S::CreatedAt; + type SigningKey = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type SigningKey = S::SigningKey; type CreatedAt = Set<members::created_at>; + type SigningKey = S::SigningKey; + } + ///State transition - sets the `signing_key` field to Set + pub struct SetSigningKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSigningKey<S> {} + impl<S: State> State for SetSigningKey<S> { + type CreatedAt = S::CreatedAt; + type SigningKey = Set<members::signing_key>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `signing_key` field - pub struct signing_key(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `signing_key` field + pub struct signing_key(()); } } @@ -162,8 +162,8 @@ where impl<'a, S> KeyBuilder<'a, S> where S: key_state::State, - S::SigningKey: key_state::IsSet, S::CreatedAt: key_state::IsSet, + S::SigningKey: key_state::IsSet, { /// Build the final struct pub fn build(self) -> Key<'a> { diff --git a/crates/jacquard-api/src/place_stream/live/search_actors_typeahead.rs b/crates/jacquard-api/src/place_stream/live/search_actors_typeahead.rs index 2acddfa8..cd8989c8 100644 --- a/crates/jacquard-api/src/place_stream/live/search_actors_typeahead.rs +++ b/crates/jacquard-api/src/place_stream/live/search_actors_typeahead.rs @@ -35,37 +35,37 @@ pub mod actor_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Handle = S::Handle; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type Did = S::Did; type Handle = Set<members::handle>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Handle = S::Handle; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> ActorBuilder<'a, S> where S: actor_state::State, - S::Did: actor_state::IsSet, S::Handle: actor_state::IsSet, + S::Did: actor_state::IsSet, { /// Build the final struct pub fn build(self) -> Actor<'a> { diff --git a/crates/jacquard-api/src/place_stream/livestream.rs b/crates/jacquard-api/src/place_stream/livestream.rs index 80be0d41..7e2b6aae 100644 --- a/crates/jacquard-api/src/place_stream/livestream.rs +++ b/crates/jacquard-api/src/place_stream/livestream.rs @@ -44,85 +44,85 @@ pub mod livestream_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Author; type Cid; - type Record; type Uri; + type Author; type IndexedAt; + type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Author = Unset; type Cid = Unset; - type Record = Unset; type Uri = Unset; + type Author = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { - type Author = Set<members::author>; - type Cid = S::Cid; - type Record = S::Record; - type Uri = S::Uri; - type IndexedAt = S::IndexedAt; + type Record = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Author = S::Author; type Cid = Set<members::cid>; - type Record = S::Record; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { type Author = S::Author; - type Cid = S::Cid; - type Record = Set<members::record>; - type Uri = S::Uri; type IndexedAt = S::IndexedAt; + type Record = S::Record; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Author = S::Author; type Cid = S::Cid; - type Record = S::Record; type Uri = Set<members::uri>; + type Author = S::Author; + type IndexedAt = S::IndexedAt; + type Record = S::Record; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Cid = S::Cid; + type Uri = S::Uri; + type Author = Set<members::author>; type IndexedAt = S::IndexedAt; + type Record = S::Record; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Author = S::Author; type Cid = S::Cid; - type Record = S::Record; type Uri = S::Uri; + type Author = S::Author; type IndexedAt = Set<members::indexed_at>; + type Record = S::Record; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Cid = S::Cid; + type Uri = S::Uri; + type Author = S::Author; + type IndexedAt = S::IndexedAt; + type Record = Set<members::record>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `record` field - pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `author` field + pub struct author(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `record` field + pub struct record(()); } } @@ -275,11 +275,11 @@ impl<'a, S: livestream_view_state::State> LivestreamViewBuilder<'a, S> { impl<'a, S> LivestreamViewBuilder<'a, S> where S: livestream_view_state::State, - S::Author: livestream_view_state::IsSet, S::Cid: livestream_view_state::IsSet, - S::Record: livestream_view_state::IsSet, S::Uri: livestream_view_state::IsSet, + S::Author: livestream_view_state::IsSet, S::IndexedAt: livestream_view_state::IsSet, + S::Record: livestream_view_state::IsSet, { /// Build the final struct pub fn build(self) -> LivestreamView<'a> { diff --git a/crates/jacquard-api/src/place_stream/moderation.rs b/crates/jacquard-api/src/place_stream/moderation.rs new file mode 100644 index 00000000..e481621e --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation.rs @@ -0,0 +1,364 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.defs +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod create_block; +pub mod create_gate; +pub mod delete_block; +pub mod delete_gate; +pub mod permission; +pub mod update_livestream; + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PermissionView<'a> { + /// The streamer who granted these permissions + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// Content identifier of the permission record + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// The permission record itself + #[serde(borrow)] + pub record: jacquard_common::types::value::Data<'a>, + /// AT-URI of the permission record + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod permission_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Uri; + type Author; + type Record; + type Cid; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Uri = Unset; + type Author = Unset; + type Record = Unset; + type Cid = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type Author = S::Author; + type Record = S::Record; + type Cid = S::Cid; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Uri = S::Uri; + type Author = Set<members::author>; + type Record = S::Record; + type Cid = S::Cid; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Uri = S::Uri; + type Author = S::Author; + type Record = Set<members::record>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Uri = S::Uri; + type Author = S::Author; + type Record = S::Record; + type Cid = Set<members::cid>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `cid` field + pub struct cid(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PermissionViewBuilder<'a, S: permission_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> PermissionView<'a> { + /// Create a new builder for this type + pub fn new() -> PermissionViewBuilder<'a, permission_view_state::Empty> { + PermissionViewBuilder::new() + } +} + +impl<'a> PermissionViewBuilder<'a, permission_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PermissionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionViewBuilder<'a, S> +where + S: permission_view_state::State, + S::Author: permission_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> PermissionViewBuilder<'a, permission_view_state::SetAuthor<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PermissionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionViewBuilder<'a, S> +where + S: permission_view_state::State, + S::Cid: permission_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> PermissionViewBuilder<'a, permission_view_state::SetCid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + PermissionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionViewBuilder<'a, S> +where + S: permission_view_state::State, + S::Record: permission_view_state::IsUnset, +{ + /// Set the `record` field (required) + pub fn record( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> PermissionViewBuilder<'a, permission_view_state::SetRecord<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PermissionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionViewBuilder<'a, S> +where + S: permission_view_state::State, + S::Uri: permission_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> PermissionViewBuilder<'a, permission_view_state::SetUri<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + PermissionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionViewBuilder<'a, S> +where + S: permission_view_state::State, + S::Uri: permission_view_state::IsSet, + S::Author: permission_view_state::IsSet, + S::Record: permission_view_state::IsSet, + S::Cid: permission_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> PermissionView<'a> { + PermissionView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + record: self.__unsafe_private_named.2.unwrap(), + uri: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> PermissionView<'a> { + PermissionView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + record: self.__unsafe_private_named.2.unwrap(), + uri: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_place_stream_moderation_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("place.stream.moderation.defs"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("permissionView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("record") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Content identifier of the permission record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("record"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { + description: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the permission record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PermissionView<'a> { + fn nsid() -> &'static str { + "place.stream.moderation.defs" + } + fn def_name() -> &'static str { + "permissionView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_moderation_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/create_block.rs b/crates/jacquard-api/src/place_stream/moderation/create_block.rs new file mode 100644 index 00000000..ce2a91da --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/create_block.rs @@ -0,0 +1,294 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.createBlock +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateBlock<'a> { + /// Optional reason for the block. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub reason: std::option::Option<jacquard_common::CowStr<'a>>, + /// The DID of the streamer whose chat this block applies to. + #[serde(borrow)] + pub streamer: jacquard_common::types::string::Did<'a>, + /// The DID of the user being blocked from chat. + #[serde(borrow)] + pub subject: jacquard_common::types::string::Did<'a>, +} + +pub mod create_block_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Subject; + type Streamer; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Subject = Unset; + type Streamer = Unset; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Subject = Set<members::subject>; + type Streamer = S::Streamer; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type Subject = S::Subject; + type Streamer = Set<members::streamer>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `subject` field + pub struct subject(()); + ///Marker type for the `streamer` field + pub struct streamer(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CreateBlockBuilder<'a, S: create_block_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CreateBlock<'a> { + /// Create a new builder for this type + pub fn new() -> CreateBlockBuilder<'a, create_block_state::Empty> { + CreateBlockBuilder::new() + } +} + +impl<'a> CreateBlockBuilder<'a, create_block_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CreateBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: create_block_state::State> CreateBlockBuilder<'a, S> { + /// Set the `reason` field (optional) + pub fn reason( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `reason` field to an Option value (optional) + pub fn maybe_reason(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S> CreateBlockBuilder<'a, S> +where + S: create_block_state::State, + S::Streamer: create_block_state::IsUnset, +{ + /// Set the `streamer` field (required) + pub fn streamer( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> CreateBlockBuilder<'a, create_block_state::SetStreamer<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CreateBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateBlockBuilder<'a, S> +where + S: create_block_state::State, + S::Subject: create_block_state::IsUnset, +{ + /// Set the `subject` field (required) + pub fn subject( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> CreateBlockBuilder<'a, create_block_state::SetSubject<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + CreateBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateBlockBuilder<'a, S> +where + S: create_block_state::State, + S::Subject: create_block_state::IsSet, + S::Streamer: create_block_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CreateBlock<'a> { + CreateBlock { + reason: self.__unsafe_private_named.0, + streamer: self.__unsafe_private_named.1.unwrap(), + subject: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CreateBlock<'a> { + CreateBlock { + reason: self.__unsafe_private_named.0, + streamer: self.__unsafe_private_named.1.unwrap(), + subject: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateBlockOutput<'a> { + /// The CID of the created block record. + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// The AT-URI of the created block record. + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum CreateBlockError<'a> { + /// The request lacks valid authentication credentials. + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The caller does not have permission to create blocks for this streamer. + #[serde(rename = "Forbidden")] + Forbidden(std::option::Option<jacquard_common::CowStr<'a>>), + /// The streamer's OAuth session could not be found or is invalid. + #[serde(rename = "SessionNotFound")] + SessionNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for CreateBlockError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Forbidden(msg) => { + write!(f, "Forbidden")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SessionNotFound(msg) => { + write!(f, "SessionNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.moderation.createBlock +pub struct CreateBlockResponse; +impl jacquard_common::xrpc::XrpcResp for CreateBlockResponse { + const NSID: &'static str = "place.stream.moderation.createBlock"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CreateBlockOutput<'de>; + type Err<'de> = CreateBlockError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for CreateBlock<'a> { + const NSID: &'static str = "place.stream.moderation.createBlock"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = CreateBlockResponse; +} + +/// Endpoint type for +///place.stream.moderation.createBlock +pub struct CreateBlockRequest; +impl jacquard_common::xrpc::XrpcEndpoint for CreateBlockRequest { + const PATH: &'static str = "/xrpc/place.stream.moderation.createBlock"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = CreateBlock<'de>; + type Response = CreateBlockResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/create_gate.rs b/crates/jacquard-api/src/place_stream/moderation/create_gate.rs new file mode 100644 index 00000000..0f190146 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/create_gate.rs @@ -0,0 +1,271 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.createGate +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateGate<'a> { + /// The AT-URI of the chat message to hide. + #[serde(borrow)] + pub message_uri: jacquard_common::types::string::AtUri<'a>, + /// The DID of the streamer. + #[serde(borrow)] + pub streamer: jacquard_common::types::string::Did<'a>, +} + +pub mod create_gate_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type MessageUri; + type Streamer; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type MessageUri = Unset; + type Streamer = Unset; + } + ///State transition - sets the `message_uri` field to Set + pub struct SetMessageUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessageUri<S> {} + impl<S: State> State for SetMessageUri<S> { + type MessageUri = Set<members::message_uri>; + type Streamer = S::Streamer; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type MessageUri = S::MessageUri; + type Streamer = Set<members::streamer>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `message_uri` field + pub struct message_uri(()); + ///Marker type for the `streamer` field + pub struct streamer(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CreateGateBuilder<'a, S: create_gate_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CreateGate<'a> { + /// Create a new builder for this type + pub fn new() -> CreateGateBuilder<'a, create_gate_state::Empty> { + CreateGateBuilder::new() + } +} + +impl<'a> CreateGateBuilder<'a, create_gate_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CreateGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateGateBuilder<'a, S> +where + S: create_gate_state::State, + S::MessageUri: create_gate_state::IsUnset, +{ + /// Set the `messageUri` field (required) + pub fn message_uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> CreateGateBuilder<'a, create_gate_state::SetMessageUri<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CreateGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateGateBuilder<'a, S> +where + S: create_gate_state::State, + S::Streamer: create_gate_state::IsUnset, +{ + /// Set the `streamer` field (required) + pub fn streamer( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> CreateGateBuilder<'a, create_gate_state::SetStreamer<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CreateGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateGateBuilder<'a, S> +where + S: create_gate_state::State, + S::MessageUri: create_gate_state::IsSet, + S::Streamer: create_gate_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CreateGate<'a> { + CreateGate { + message_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CreateGate<'a> { + CreateGate { + message_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateGateOutput<'a> { + /// The CID of the created gate record. + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// The AT-URI of the created gate record. + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum CreateGateError<'a> { + /// The request lacks valid authentication credentials. + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The caller does not have permission to hide messages for this streamer. + #[serde(rename = "Forbidden")] + Forbidden(std::option::Option<jacquard_common::CowStr<'a>>), + /// The streamer's OAuth session could not be found or is invalid. + #[serde(rename = "SessionNotFound")] + SessionNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for CreateGateError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Forbidden(msg) => { + write!(f, "Forbidden")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SessionNotFound(msg) => { + write!(f, "SessionNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.moderation.createGate +pub struct CreateGateResponse; +impl jacquard_common::xrpc::XrpcResp for CreateGateResponse { + const NSID: &'static str = "place.stream.moderation.createGate"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CreateGateOutput<'de>; + type Err<'de> = CreateGateError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for CreateGate<'a> { + const NSID: &'static str = "place.stream.moderation.createGate"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = CreateGateResponse; +} + +/// Endpoint type for +///place.stream.moderation.createGate +pub struct CreateGateRequest; +impl jacquard_common::xrpc::XrpcEndpoint for CreateGateRequest { + const PATH: &'static str = "/xrpc/place.stream.moderation.createGate"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = CreateGate<'de>; + type Response = CreateGateResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/delete_block.rs b/crates/jacquard-api/src/place_stream/moderation/delete_block.rs new file mode 100644 index 00000000..06222b06 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/delete_block.rs @@ -0,0 +1,264 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.deleteBlock +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteBlock<'a> { + /// The AT-URI of the block record to delete. + #[serde(borrow)] + pub block_uri: jacquard_common::types::string::AtUri<'a>, + /// The DID of the streamer. + #[serde(borrow)] + pub streamer: jacquard_common::types::string::Did<'a>, +} + +pub mod delete_block_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Streamer; + type BlockUri; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Streamer = Unset; + type BlockUri = Unset; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type Streamer = Set<members::streamer>; + type BlockUri = S::BlockUri; + } + ///State transition - sets the `block_uri` field to Set + pub struct SetBlockUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlockUri<S> {} + impl<S: State> State for SetBlockUri<S> { + type Streamer = S::Streamer; + type BlockUri = Set<members::block_uri>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `streamer` field + pub struct streamer(()); + ///Marker type for the `block_uri` field + pub struct block_uri(()); + } +} + +/// Builder for constructing an instance of this type +pub struct DeleteBlockBuilder<'a, S: delete_block_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> DeleteBlock<'a> { + /// Create a new builder for this type + pub fn new() -> DeleteBlockBuilder<'a, delete_block_state::Empty> { + DeleteBlockBuilder::new() + } +} + +impl<'a> DeleteBlockBuilder<'a, delete_block_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + DeleteBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteBlockBuilder<'a, S> +where + S: delete_block_state::State, + S::BlockUri: delete_block_state::IsUnset, +{ + /// Set the `blockUri` field (required) + pub fn block_uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> DeleteBlockBuilder<'a, delete_block_state::SetBlockUri<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + DeleteBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteBlockBuilder<'a, S> +where + S: delete_block_state::State, + S::Streamer: delete_block_state::IsUnset, +{ + /// Set the `streamer` field (required) + pub fn streamer( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> DeleteBlockBuilder<'a, delete_block_state::SetStreamer<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + DeleteBlockBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteBlockBuilder<'a, S> +where + S: delete_block_state::State, + S::Streamer: delete_block_state::IsSet, + S::BlockUri: delete_block_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> DeleteBlock<'a> { + DeleteBlock { + block_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> DeleteBlock<'a> { + DeleteBlock { + block_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteBlockOutput<'a> {} +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum DeleteBlockError<'a> { + /// The request lacks valid authentication credentials. + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The caller does not have permission to delete blocks for this streamer. + #[serde(rename = "Forbidden")] + Forbidden(std::option::Option<jacquard_common::CowStr<'a>>), + /// The streamer's OAuth session could not be found or is invalid. + #[serde(rename = "SessionNotFound")] + SessionNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for DeleteBlockError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Forbidden(msg) => { + write!(f, "Forbidden")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SessionNotFound(msg) => { + write!(f, "SessionNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.moderation.deleteBlock +pub struct DeleteBlockResponse; +impl jacquard_common::xrpc::XrpcResp for DeleteBlockResponse { + const NSID: &'static str = "place.stream.moderation.deleteBlock"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DeleteBlockOutput<'de>; + type Err<'de> = DeleteBlockError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteBlock<'a> { + const NSID: &'static str = "place.stream.moderation.deleteBlock"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = DeleteBlockResponse; +} + +/// Endpoint type for +///place.stream.moderation.deleteBlock +pub struct DeleteBlockRequest; +impl jacquard_common::xrpc::XrpcEndpoint for DeleteBlockRequest { + const PATH: &'static str = "/xrpc/place.stream.moderation.deleteBlock"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = DeleteBlock<'de>; + type Response = DeleteBlockResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/delete_gate.rs b/crates/jacquard-api/src/place_stream/moderation/delete_gate.rs new file mode 100644 index 00000000..58bf5886 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/delete_gate.rs @@ -0,0 +1,264 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.deleteGate +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteGate<'a> { + /// The AT-URI of the gate record to delete. + #[serde(borrow)] + pub gate_uri: jacquard_common::types::string::AtUri<'a>, + /// The DID of the streamer. + #[serde(borrow)] + pub streamer: jacquard_common::types::string::Did<'a>, +} + +pub mod delete_gate_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Streamer; + type GateUri; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Streamer = Unset; + type GateUri = Unset; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type Streamer = Set<members::streamer>; + type GateUri = S::GateUri; + } + ///State transition - sets the `gate_uri` field to Set + pub struct SetGateUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetGateUri<S> {} + impl<S: State> State for SetGateUri<S> { + type Streamer = S::Streamer; + type GateUri = Set<members::gate_uri>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `streamer` field + pub struct streamer(()); + ///Marker type for the `gate_uri` field + pub struct gate_uri(()); + } +} + +/// Builder for constructing an instance of this type +pub struct DeleteGateBuilder<'a, S: delete_gate_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> DeleteGate<'a> { + /// Create a new builder for this type + pub fn new() -> DeleteGateBuilder<'a, delete_gate_state::Empty> { + DeleteGateBuilder::new() + } +} + +impl<'a> DeleteGateBuilder<'a, delete_gate_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + DeleteGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteGateBuilder<'a, S> +where + S: delete_gate_state::State, + S::GateUri: delete_gate_state::IsUnset, +{ + /// Set the `gateUri` field (required) + pub fn gate_uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> DeleteGateBuilder<'a, delete_gate_state::SetGateUri<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + DeleteGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteGateBuilder<'a, S> +where + S: delete_gate_state::State, + S::Streamer: delete_gate_state::IsUnset, +{ + /// Set the `streamer` field (required) + pub fn streamer( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> DeleteGateBuilder<'a, delete_gate_state::SetStreamer<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + DeleteGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteGateBuilder<'a, S> +where + S: delete_gate_state::State, + S::Streamer: delete_gate_state::IsSet, + S::GateUri: delete_gate_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> DeleteGate<'a> { + DeleteGate { + gate_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> DeleteGate<'a> { + DeleteGate { + gate_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteGateOutput<'a> {} +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum DeleteGateError<'a> { + /// The request lacks valid authentication credentials. + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The caller does not have permission to unhide messages for this streamer. + #[serde(rename = "Forbidden")] + Forbidden(std::option::Option<jacquard_common::CowStr<'a>>), + /// The streamer's OAuth session could not be found or is invalid. + #[serde(rename = "SessionNotFound")] + SessionNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for DeleteGateError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Forbidden(msg) => { + write!(f, "Forbidden")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SessionNotFound(msg) => { + write!(f, "SessionNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.moderation.deleteGate +pub struct DeleteGateResponse; +impl jacquard_common::xrpc::XrpcResp for DeleteGateResponse { + const NSID: &'static str = "place.stream.moderation.deleteGate"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DeleteGateOutput<'de>; + type Err<'de> = DeleteGateError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteGate<'a> { + const NSID: &'static str = "place.stream.moderation.deleteGate"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = DeleteGateResponse; +} + +/// Endpoint type for +///place.stream.moderation.deleteGate +pub struct DeleteGateRequest; +impl jacquard_common::xrpc::XrpcEndpoint for DeleteGateRequest { + const PATH: &'static str = "/xrpc/place.stream.moderation.deleteGate"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = DeleteGate<'de>; + type Response = DeleteGateResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/permission.rs b/crates/jacquard-api/src/place_stream/moderation/permission.rs new file mode 100644 index 00000000..06d17b28 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/permission.rs @@ -0,0 +1,446 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.permission +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Record granting moderation permissions to a user for this streamer's content. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Permission<'a> { + /// Client-declared timestamp when this moderator was added. + pub created_at: jacquard_common::types::string::Datetime, + /// Optional expiration time for this delegation. If set, the delegation is invalid after this time. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub expiration_time: std::option::Option<jacquard_common::types::string::Datetime>, + /// The DID of the user granted moderator permissions. + #[serde(borrow)] + pub moderator: jacquard_common::types::string::Did<'a>, + /// Array of permissions granted to this moderator. 'ban' covers blocks/bans (with optional expiration), 'hide' covers message gates, 'livestream.manage' allows updating livestream metadata. + #[serde(borrow)] + pub permissions: Vec<jacquard_common::CowStr<'a>>, +} + +pub mod permission_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Permissions; + type Moderator; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Permissions = Unset; + type Moderator = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `permissions` field to Set + pub struct SetPermissions<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPermissions<S> {} + impl<S: State> State for SetPermissions<S> { + type Permissions = Set<members::permissions>; + type Moderator = S::Moderator; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `moderator` field to Set + pub struct SetModerator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetModerator<S> {} + impl<S: State> State for SetModerator<S> { + type Permissions = S::Permissions; + type Moderator = Set<members::moderator>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Permissions = S::Permissions; + type Moderator = S::Moderator; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `permissions` field + pub struct permissions(()); + ///Marker type for the `moderator` field + pub struct moderator(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PermissionBuilder<'a, S: permission_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Permission<'a> { + /// Create a new builder for this type + pub fn new() -> PermissionBuilder<'a, permission_state::Empty> { + PermissionBuilder::new() + } +} + +impl<'a> PermissionBuilder<'a, permission_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PermissionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionBuilder<'a, S> +where + S: permission_state::State, + S::CreatedAt: permission_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> PermissionBuilder<'a, permission_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PermissionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: permission_state::State> PermissionBuilder<'a, S> { + /// Set the `expirationTime` field (optional) + pub fn expiration_time( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `expirationTime` field to an Option value (optional) + pub fn maybe_expiration_time( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> PermissionBuilder<'a, S> +where + S: permission_state::State, + S::Moderator: permission_state::IsUnset, +{ + /// Set the `moderator` field (required) + pub fn moderator( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> PermissionBuilder<'a, permission_state::SetModerator<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PermissionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionBuilder<'a, S> +where + S: permission_state::State, + S::Permissions: permission_state::IsUnset, +{ + /// Set the `permissions` field (required) + pub fn permissions( + mut self, + value: impl Into<Vec<jacquard_common::CowStr<'a>>>, + ) -> PermissionBuilder<'a, permission_state::SetPermissions<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + PermissionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PermissionBuilder<'a, S> +where + S: permission_state::State, + S::Permissions: permission_state::IsSet, + S::Moderator: permission_state::IsSet, + S::CreatedAt: permission_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Permission<'a> { + Permission { + created_at: self.__unsafe_private_named.0.unwrap(), + expiration_time: self.__unsafe_private_named.1, + moderator: self.__unsafe_private_named.2.unwrap(), + permissions: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Permission<'a> { + Permission { + created_at: self.__unsafe_private_named.0.unwrap(), + expiration_time: self.__unsafe_private_named.1, + moderator: self.__unsafe_private_named.2.unwrap(), + permissions: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Permission<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, PermissionRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PermissionGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Permission<'a>, +} + +impl From<PermissionGetRecordOutput<'_>> for Permission<'_> { + fn from(output: PermissionGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Permission<'_> { + const NSID: &'static str = "place.stream.moderation.permission"; + type Record = PermissionRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct PermissionRecord; +impl jacquard_common::xrpc::XrpcResp for PermissionRecord { + const NSID: &'static str = "place.stream.moderation.permission"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = PermissionGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for PermissionRecord { + const NSID: &'static str = "place.stream.moderation.permission"; + type Record = PermissionRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Permission<'a> { + fn nsid() -> &'static str { + "place.stream.moderation.permission" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_moderation_permission() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_place_stream_moderation_permission() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("place.stream.moderation.permission"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Record granting moderation permissions to a user for this streamer's content.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("moderator"), + ::jacquard_common::smol_str::SmolStr::new_static("permissions"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Client-declared timestamp when this moderator was added.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "expirationTime", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional expiration time for this delegation. If set, the delegation is invalid after this time.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "moderator", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The DID of the user granted moderator permissions.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "permissions", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Array of permissions granted to this moderator. 'ban' covers blocks/bans (with optional expiration), 'hide' covers message gates, 'livestream.manage' allows updating livestream metadata.", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/moderation/update_livestream.rs b/crates/jacquard-api/src/place_stream/moderation/update_livestream.rs new file mode 100644 index 00000000..37a940fd --- /dev/null +++ b/crates/jacquard-api/src/place_stream/moderation/update_livestream.rs @@ -0,0 +1,304 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.moderation.updateLivestream +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct UpdateLivestream<'a> { + /// The AT-URI of the livestream record to update. + #[serde(borrow)] + pub livestream_uri: jacquard_common::types::string::AtUri<'a>, + /// The DID of the streamer. + #[serde(borrow)] + pub streamer: jacquard_common::types::string::Did<'a>, + /// New title for the livestream. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub title: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod update_livestream_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type LivestreamUri; + type Streamer; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type LivestreamUri = Unset; + type Streamer = Unset; + } + ///State transition - sets the `livestream_uri` field to Set + pub struct SetLivestreamUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLivestreamUri<S> {} + impl<S: State> State for SetLivestreamUri<S> { + type LivestreamUri = Set<members::livestream_uri>; + type Streamer = S::Streamer; + } + ///State transition - sets the `streamer` field to Set + pub struct SetStreamer<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStreamer<S> {} + impl<S: State> State for SetStreamer<S> { + type LivestreamUri = S::LivestreamUri; + type Streamer = Set<members::streamer>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `livestream_uri` field + pub struct livestream_uri(()); + ///Marker type for the `streamer` field + pub struct streamer(()); + } +} + +/// Builder for constructing an instance of this type +pub struct UpdateLivestreamBuilder<'a, S: update_livestream_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> UpdateLivestream<'a> { + /// Create a new builder for this type + pub fn new() -> UpdateLivestreamBuilder<'a, update_livestream_state::Empty> { + UpdateLivestreamBuilder::new() + } +} + +impl<'a> UpdateLivestreamBuilder<'a, update_livestream_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + UpdateLivestreamBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> UpdateLivestreamBuilder<'a, S> +where + S: update_livestream_state::State, + S::LivestreamUri: update_livestream_state::IsUnset, +{ + /// Set the `livestreamUri` field (required) + pub fn livestream_uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> UpdateLivestreamBuilder<'a, update_livestream_state::SetLivestreamUri<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + UpdateLivestreamBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> UpdateLivestreamBuilder<'a, S> +where + S: update_livestream_state::State, + S::Streamer: update_livestream_state::IsUnset, +{ + /// Set the `streamer` field (required) + pub fn streamer( + mut self, + value: impl Into<jacquard_common::types::string::Did<'a>>, + ) -> UpdateLivestreamBuilder<'a, update_livestream_state::SetStreamer<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + UpdateLivestreamBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: update_livestream_state::State> UpdateLivestreamBuilder<'a, S> { + /// Set the `title` field (optional) + pub fn title( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `title` field to an Option value (optional) + pub fn maybe_title(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> UpdateLivestreamBuilder<'a, S> +where + S: update_livestream_state::State, + S::LivestreamUri: update_livestream_state::IsSet, + S::Streamer: update_livestream_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> UpdateLivestream<'a> { + UpdateLivestream { + livestream_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + title: self.__unsafe_private_named.2, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> UpdateLivestream<'a> { + UpdateLivestream { + livestream_uri: self.__unsafe_private_named.0.unwrap(), + streamer: self.__unsafe_private_named.1.unwrap(), + title: self.__unsafe_private_named.2, + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct UpdateLivestreamOutput<'a> { + /// The CID of the updated livestream record. + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// The AT-URI of the updated livestream record. + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum UpdateLivestreamError<'a> { + /// The request lacks valid authentication credentials. + #[serde(rename = "Unauthorized")] + Unauthorized(std::option::Option<jacquard_common::CowStr<'a>>), + /// The caller does not have permission to update livestream metadata for this streamer. + #[serde(rename = "Forbidden")] + Forbidden(std::option::Option<jacquard_common::CowStr<'a>>), + /// The streamer's OAuth session could not be found or is invalid. + #[serde(rename = "SessionNotFound")] + SessionNotFound(std::option::Option<jacquard_common::CowStr<'a>>), + /// The specified livestream record does not exist. + #[serde(rename = "RecordNotFound")] + RecordNotFound(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for UpdateLivestreamError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unauthorized(msg) => { + write!(f, "Unauthorized")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Forbidden(msg) => { + write!(f, "Forbidden")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::SessionNotFound(msg) => { + write!(f, "SessionNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::RecordNotFound(msg) => { + write!(f, "RecordNotFound")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.moderation.updateLivestream +pub struct UpdateLivestreamResponse; +impl jacquard_common::xrpc::XrpcResp for UpdateLivestreamResponse { + const NSID: &'static str = "place.stream.moderation.updateLivestream"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = UpdateLivestreamOutput<'de>; + type Err<'de> = UpdateLivestreamError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for UpdateLivestream<'a> { + const NSID: &'static str = "place.stream.moderation.updateLivestream"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = UpdateLivestreamResponse; +} + +/// Endpoint type for +///place.stream.moderation.updateLivestream +pub struct UpdateLivestreamRequest; +impl jacquard_common::xrpc::XrpcEndpoint for UpdateLivestreamRequest { + const PATH: &'static str = "/xrpc/place.stream.moderation.updateLivestream"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = UpdateLivestream<'de>; + type Response = UpdateLivestreamResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream.rs b/crates/jacquard-api/src/place_stream/multistream.rs new file mode 100644 index 00000000..e94c31ca --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream.rs @@ -0,0 +1,617 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.defs +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod create_target; +pub mod delete_target; +pub mod list_targets; +pub mod put_target; +pub mod target; + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Event<'a> { + pub created_at: jacquard_common::types::string::Datetime, + #[serde(borrow)] + pub message: jacquard_common::CowStr<'a>, + #[serde(borrow)] + pub status: jacquard_common::CowStr<'a>, +} + +pub mod event_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Message; + type Status; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Message = Unset; + type Status = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Message = S::Message; + type Status = S::Status; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type CreatedAt = S::CreatedAt; + type Message = Set<members::message>; + type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type CreatedAt = S::CreatedAt; + type Message = S::Message; + type Status = Set<members::status>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `message` field + pub struct message(()); + ///Marker type for the `status` field + pub struct status(()); + } +} + +/// Builder for constructing an instance of this type +pub struct EventBuilder<'a, S: event_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Event<'a> { + /// Create a new builder for this type + pub fn new() -> EventBuilder<'a, event_state::Empty> { + EventBuilder::new() + } +} + +impl<'a> EventBuilder<'a, event_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + EventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventBuilder<'a, S> +where + S: event_state::State, + S::CreatedAt: event_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> EventBuilder<'a, event_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + EventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventBuilder<'a, S> +where + S: event_state::State, + S::Message: event_state::IsUnset, +{ + /// Set the `message` field (required) + pub fn message( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> EventBuilder<'a, event_state::SetMessage<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + EventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventBuilder<'a, S> +where + S: event_state::State, + S::Status: event_state::IsUnset, +{ + /// Set the `status` field (required) + pub fn status( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> EventBuilder<'a, event_state::SetStatus<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + EventBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> EventBuilder<'a, S> +where + S: event_state::State, + S::CreatedAt: event_state::IsSet, + S::Message: event_state::IsSet, + S::Status: event_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Event<'a> { + Event { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1.unwrap(), + status: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Event<'a> { + Event { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1.unwrap(), + status: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_place_stream_multistream_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("place.stream.multistream.defs"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("event"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("message"), + ::jacquard_common::smol_str::SmolStr::new_static("status"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("message"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("status"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("targetView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("record") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "latestEvent", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "place.stream.multistream.defs#event", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("record"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { + description: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Event<'a> { + fn nsid() -> &'static str { + "place.stream.multistream.defs" + } + fn def_name() -> &'static str { + "event" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_multistream_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct TargetView<'a> { + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub latest_event: std::option::Option<crate::place_stream::multistream::Event<'a>>, + #[serde(borrow)] + pub record: jacquard_common::types::value::Data<'a>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod target_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Record; + type Uri; + type Cid; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Record = Unset; + type Uri = Unset; + type Cid = Unset; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Record = Set<members::record>; + type Uri = S::Uri; + type Cid = S::Cid; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Record = S::Record; + type Uri = Set<members::uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Record = S::Record; + type Uri = S::Uri; + type Cid = Set<members::cid>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); + } +} + +/// Builder for constructing an instance of this type +pub struct TargetViewBuilder<'a, S: target_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<crate::place_stream::multistream::Event<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> TargetView<'a> { + /// Create a new builder for this type + pub fn new() -> TargetViewBuilder<'a, target_view_state::Empty> { + TargetViewBuilder::new() + } +} + +impl<'a> TargetViewBuilder<'a, target_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + TargetViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetViewBuilder<'a, S> +where + S: target_view_state::State, + S::Cid: target_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> TargetViewBuilder<'a, target_view_state::SetCid<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + TargetViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: target_view_state::State> TargetViewBuilder<'a, S> { + /// Set the `latestEvent` field (optional) + pub fn latest_event( + mut self, + value: impl Into<Option<crate::place_stream::multistream::Event<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `latestEvent` field to an Option value (optional) + pub fn maybe_latest_event( + mut self, + value: Option<crate::place_stream::multistream::Event<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> TargetViewBuilder<'a, S> +where + S: target_view_state::State, + S::Record: target_view_state::IsUnset, +{ + /// Set the `record` field (required) + pub fn record( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> TargetViewBuilder<'a, target_view_state::SetRecord<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + TargetViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetViewBuilder<'a, S> +where + S: target_view_state::State, + S::Uri: target_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> TargetViewBuilder<'a, target_view_state::SetUri<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + TargetViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetViewBuilder<'a, S> +where + S: target_view_state::State, + S::Record: target_view_state::IsSet, + S::Uri: target_view_state::IsSet, + S::Cid: target_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> TargetView<'a> { + TargetView { + cid: self.__unsafe_private_named.0.unwrap(), + latest_event: self.__unsafe_private_named.1, + record: self.__unsafe_private_named.2.unwrap(), + uri: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> TargetView<'a> { + TargetView { + cid: self.__unsafe_private_named.0.unwrap(), + latest_event: self.__unsafe_private_named.1, + record: self.__unsafe_private_named.2.unwrap(), + uri: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TargetView<'a> { + fn nsid() -> &'static str { + "place.stream.multistream.defs" + } + fn def_name() -> &'static str { + "targetView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_multistream_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream/create_target.rs b/crates/jacquard-api/src/place_stream/multistream/create_target.rs new file mode 100644 index 00000000..c603bed4 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream/create_target.rs @@ -0,0 +1,209 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.createTarget +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateTarget<'a> { + #[serde(borrow)] + pub multistream_target: crate::place_stream::multistream::target::Target<'a>, +} + +pub mod create_target_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type MultistreamTarget; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type MultistreamTarget = Unset; + } + ///State transition - sets the `multistream_target` field to Set + pub struct SetMultistreamTarget<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMultistreamTarget<S> {} + impl<S: State> State for SetMultistreamTarget<S> { + type MultistreamTarget = Set<members::multistream_target>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `multistream_target` field + pub struct multistream_target(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CreateTargetBuilder<'a, S: create_target_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::place_stream::multistream::target::Target<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CreateTarget<'a> { + /// Create a new builder for this type + pub fn new() -> CreateTargetBuilder<'a, create_target_state::Empty> { + CreateTargetBuilder::new() + } +} + +impl<'a> CreateTargetBuilder<'a, create_target_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CreateTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateTargetBuilder<'a, S> +where + S: create_target_state::State, + S::MultistreamTarget: create_target_state::IsUnset, +{ + /// Set the `multistreamTarget` field (required) + pub fn multistream_target( + mut self, + value: impl Into<crate::place_stream::multistream::target::Target<'a>>, + ) -> CreateTargetBuilder<'a, create_target_state::SetMultistreamTarget<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CreateTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CreateTargetBuilder<'a, S> +where + S: create_target_state::State, + S::MultistreamTarget: create_target_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CreateTarget<'a> { + CreateTarget { + multistream_target: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CreateTarget<'a> { + CreateTarget { + multistream_target: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CreateTargetOutput<'a> { + #[serde(flatten)] + #[serde(borrow)] + pub value: crate::place_stream::multistream::TargetView<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum CreateTargetError<'a> { + /// The provided target URL is invalid or unreachable. + #[serde(rename = "InvalidTargetUrl")] + InvalidTargetUrl(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for CreateTargetError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::InvalidTargetUrl(msg) => { + write!(f, "InvalidTargetUrl")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.multistream.createTarget +pub struct CreateTargetResponse; +impl jacquard_common::xrpc::XrpcResp for CreateTargetResponse { + const NSID: &'static str = "place.stream.multistream.createTarget"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CreateTargetOutput<'de>; + type Err<'de> = CreateTargetError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for CreateTarget<'a> { + const NSID: &'static str = "place.stream.multistream.createTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = CreateTargetResponse; +} + +/// Endpoint type for +///place.stream.multistream.createTarget +pub struct CreateTargetRequest; +impl jacquard_common::xrpc::XrpcEndpoint for CreateTargetRequest { + const PATH: &'static str = "/xrpc/place.stream.multistream.createTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = CreateTarget<'de>; + type Response = CreateTargetResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream/delete_target.rs b/crates/jacquard-api/src/place_stream/multistream/delete_target.rs new file mode 100644 index 00000000..6e310782 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream/delete_target.rs @@ -0,0 +1,204 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.deleteTarget +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteTarget<'a> { + /// The Record Key of the target to delete. + #[serde(borrow)] + pub rkey: jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, +} + +pub mod delete_target_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Rkey; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Rkey = Unset; + } + ///State transition - sets the `rkey` field to Set + pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRkey<S> {} + impl<S: State> State for SetRkey<S> { + type Rkey = Set<members::rkey>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `rkey` field + pub struct rkey(()); + } +} + +/// Builder for constructing an instance of this type +pub struct DeleteTargetBuilder<'a, S: delete_target_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> DeleteTarget<'a> { + /// Create a new builder for this type + pub fn new() -> DeleteTargetBuilder<'a, delete_target_state::Empty> { + DeleteTargetBuilder::new() + } +} + +impl<'a> DeleteTargetBuilder<'a, delete_target_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + DeleteTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteTargetBuilder<'a, S> +where + S: delete_target_state::State, + S::Rkey: delete_target_state::IsUnset, +{ + /// Set the `rkey` field (required) + pub fn rkey( + mut self, + value: impl Into< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> DeleteTargetBuilder<'a, delete_target_state::SetRkey<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + DeleteTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> DeleteTargetBuilder<'a, S> +where + S: delete_target_state::State, + S::Rkey: delete_target_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> DeleteTarget<'a> { + DeleteTarget { + rkey: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> DeleteTarget<'a> { + DeleteTarget { + rkey: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct DeleteTargetOutput<'a> {} +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum DeleteTargetError<'a> {} +impl core::fmt::Display for DeleteTargetError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.multistream.deleteTarget +pub struct DeleteTargetResponse; +impl jacquard_common::xrpc::XrpcResp for DeleteTargetResponse { + const NSID: &'static str = "place.stream.multistream.deleteTarget"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = DeleteTargetOutput<'de>; + type Err<'de> = DeleteTargetError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteTarget<'a> { + const NSID: &'static str = "place.stream.multistream.deleteTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = DeleteTargetResponse; +} + +/// Endpoint type for +///place.stream.multistream.deleteTarget +pub struct DeleteTargetRequest; +impl jacquard_common::xrpc::XrpcEndpoint for DeleteTargetRequest { + const PATH: &'static str = "/xrpc/place.stream.multistream.deleteTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = DeleteTarget<'de>; + type Response = DeleteTargetResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream/list_targets.rs b/crates/jacquard-api/src/place_stream/multistream/list_targets.rs new file mode 100644 index 00000000..2856fe7f --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream/list_targets.rs @@ -0,0 +1,494 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.listTargets +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ListTargets<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, + ///(default: 50, min: 1, max: 100) + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub limit: std::option::Option<i64>, +} + +pub mod list_targets_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed {} + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty {} + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members {} +} + +/// Builder for constructing an instance of this type +pub struct ListTargetsBuilder<'a, S: list_targets_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<i64>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> ListTargets<'a> { + /// Create a new builder for this type + pub fn new() -> ListTargetsBuilder<'a, list_targets_state::Empty> { + ListTargetsBuilder::new() + } +} + +impl<'a> ListTargetsBuilder<'a, list_targets_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ListTargetsBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: list_targets_state::State> ListTargetsBuilder<'a, S> { + /// Set the `cursor` field (optional) + pub fn cursor( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.0 = value.into(); + self + } + /// Set the `cursor` field to an Option value (optional) + pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.0 = value; + self + } +} + +impl<'a, S: list_targets_state::State> ListTargetsBuilder<'a, S> { + /// Set the `limit` field (optional) + pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `limit` field to an Option value (optional) + pub fn maybe_limit(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> ListTargetsBuilder<'a, S> +where + S: list_targets_state::State, +{ + /// Build the final struct + pub fn build(self) -> ListTargets<'a> { + ListTargets { + cursor: self.__unsafe_private_named.0, + limit: self.__unsafe_private_named.1, + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ListTargetsOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, + #[serde(borrow)] + pub targets: Vec<crate::place_stream::multistream::TargetView<'a>>, +} + +/// Response type for +///place.stream.multistream.listTargets +pub struct ListTargetsResponse; +impl jacquard_common::xrpc::XrpcResp for ListTargetsResponse { + const NSID: &'static str = "place.stream.multistream.listTargets"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ListTargetsOutput<'de>; + type Err<'de> = jacquard_common::xrpc::GenericError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for ListTargets<'a> { + const NSID: &'static str = "place.stream.multistream.listTargets"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Response = ListTargetsResponse; +} + +/// Endpoint type for +///place.stream.multistream.listTargets +pub struct ListTargetsRequest; +impl jacquard_common::xrpc::XrpcEndpoint for ListTargetsRequest { + const PATH: &'static str = "/xrpc/place.stream.multistream.listTargets"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; + type Request<'de> = ListTargets<'de>; + type Response = ListTargetsResponse; +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Record<'a> { + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: jacquard_common::types::value::Data<'a>, +} + +pub mod record_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Value; + type Cid; + type Uri; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Value = Unset; + type Cid = Unset; + type Uri = Unset; + } + ///State transition - sets the `value` field to Set + pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValue<S> {} + impl<S: State> State for SetValue<S> { + type Value = Set<members::value>; + type Cid = S::Cid; + type Uri = S::Uri; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Value = S::Value; + type Cid = Set<members::cid>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Value = S::Value; + type Cid = S::Cid; + type Uri = Set<members::uri>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `value` field + pub struct value(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RecordBuilder<'a, S: record_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Record<'a> { + /// Create a new builder for this type + pub fn new() -> RecordBuilder<'a, record_state::Empty> { + RecordBuilder::new() + } +} + +impl<'a> RecordBuilder<'a, record_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RecordBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RecordBuilder<'a, S> +where + S: record_state::State, + S::Cid: record_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> RecordBuilder<'a, record_state::SetCid<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RecordBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RecordBuilder<'a, S> +where + S: record_state::State, + S::Uri: record_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> RecordBuilder<'a, record_state::SetUri<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + RecordBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RecordBuilder<'a, S> +where + S: record_state::State, + S::Value: record_state::IsUnset, +{ + /// Set the `value` field (required) + pub fn value( + mut self, + value: impl Into<jacquard_common::types::value::Data<'a>>, + ) -> RecordBuilder<'a, record_state::SetValue<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RecordBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RecordBuilder<'a, S> +where + S: record_state::State, + S::Value: record_state::IsSet, + S::Cid: record_state::IsSet, + S::Uri: record_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Record<'a> { + Record { + cid: self.__unsafe_private_named.0.unwrap(), + uri: self.__unsafe_private_named.1.unwrap(), + value: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Record<'a> { + Record { + cid: self.__unsafe_private_named.0.unwrap(), + uri: self.__unsafe_private_named.1.unwrap(), + value: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_place_stream_multistream_listTargets() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static( + "place.stream.multistream.listTargets", + ), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { + description: None, + parameters: Some( + ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { + description: None, + required: Some(vec![]), + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cursor"), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("limit"), + ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ), + output: None, + errors: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("record"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("value") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("value"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { + description: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Record<'a> { + fn nsid() -> &'static str { + "place.stream.multistream.listTargets" + } + fn def_name() -> &'static str { + "record" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_multistream_listTargets() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream/put_target.rs b/crates/jacquard-api/src/place_stream/multistream/put_target.rs new file mode 100644 index 00000000..cf9a1ff8 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream/put_target.rs @@ -0,0 +1,253 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.putTarget +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PutTarget<'a> { + #[serde(borrow)] + pub multistream_target: crate::place_stream::multistream::target::Target<'a>, + /// The Record Key. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub rkey: std::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, +} + +pub mod put_target_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type MultistreamTarget; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type MultistreamTarget = Unset; + } + ///State transition - sets the `multistream_target` field to Set + pub struct SetMultistreamTarget<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMultistreamTarget<S> {} + impl<S: State> State for SetMultistreamTarget<S> { + type MultistreamTarget = Set<members::multistream_target>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `multistream_target` field + pub struct multistream_target(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PutTargetBuilder<'a, S: put_target_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::place_stream::multistream::target::Target<'a>>, + ::core::option::Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> PutTarget<'a> { + /// Create a new builder for this type + pub fn new() -> PutTargetBuilder<'a, put_target_state::Empty> { + PutTargetBuilder::new() + } +} + +impl<'a> PutTargetBuilder<'a, put_target_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PutTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PutTargetBuilder<'a, S> +where + S: put_target_state::State, + S::MultistreamTarget: put_target_state::IsUnset, +{ + /// Set the `multistreamTarget` field (required) + pub fn multistream_target( + mut self, + value: impl Into<crate::place_stream::multistream::target::Target<'a>>, + ) -> PutTargetBuilder<'a, put_target_state::SetMultistreamTarget<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PutTargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: put_target_state::State> PutTargetBuilder<'a, S> { + /// Set the `rkey` field (optional) + pub fn rkey( + mut self, + value: impl Into< + Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + >, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `rkey` field to an Option value (optional) + pub fn maybe_rkey( + mut self, + value: Option< + jacquard_common::types::string::RecordKey< + jacquard_common::types::string::Rkey<'a>, + >, + >, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> PutTargetBuilder<'a, S> +where + S: put_target_state::State, + S::MultistreamTarget: put_target_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> PutTarget<'a> { + PutTarget { + multistream_target: self.__unsafe_private_named.0.unwrap(), + rkey: self.__unsafe_private_named.1, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> PutTarget<'a> { + PutTarget { + multistream_target: self.__unsafe_private_named.0.unwrap(), + rkey: self.__unsafe_private_named.1, + extra_data: Some(extra_data), + } + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PutTargetOutput<'a> { + #[serde(flatten)] + #[serde(borrow)] + pub value: crate::place_stream::multistream::TargetView<'a>, +} + +#[jacquard_derive::open_union] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic, + jacquard_derive::IntoStatic +)] +#[serde(tag = "error", content = "message")] +#[serde(bound(deserialize = "'de: 'a"))] +pub enum PutTargetError<'a> { + /// The provided target URL is invalid or unreachable. + #[serde(rename = "InvalidTargetUrl")] + InvalidTargetUrl(std::option::Option<jacquard_common::CowStr<'a>>), +} + +impl core::fmt::Display for PutTargetError<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::InvalidTargetUrl(msg) => { + write!(f, "InvalidTargetUrl")?; + if let Some(msg) = msg { + write!(f, ": {}", msg)?; + } + Ok(()) + } + Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), + } + } +} + +/// Response type for +///place.stream.multistream.putTarget +pub struct PutTargetResponse; +impl jacquard_common::xrpc::XrpcResp for PutTargetResponse { + const NSID: &'static str = "place.stream.multistream.putTarget"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = PutTargetOutput<'de>; + type Err<'de> = PutTargetError<'de>; +} + +impl<'a> jacquard_common::xrpc::XrpcRequest for PutTarget<'a> { + const NSID: &'static str = "place.stream.multistream.putTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Response = PutTargetResponse; +} + +/// Endpoint type for +///place.stream.multistream.putTarget +pub struct PutTargetRequest; +impl jacquard_common::xrpc::XrpcEndpoint for PutTargetRequest { + const PATH: &'static str = "/xrpc/place.stream.multistream.putTarget"; + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); + type Request<'de> = PutTarget<'de>; + type Response = PutTargetResponse; +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/multistream/target.rs b/crates/jacquard-api/src/place_stream/multistream/target.rs new file mode 100644 index 00000000..5d113c84 --- /dev/null +++ b/crates/jacquard-api/src/place_stream/multistream/target.rs @@ -0,0 +1,431 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: place.stream.multistream.target +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An external server for rebroadcasting a Streamplace stream +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Target<'a> { + /// Whether this target is currently active. + pub active: bool, + /// When this target was created. + pub created_at: jacquard_common::types::string::Datetime, + /// A user-friendly name for this target. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub name: std::option::Option<jacquard_common::CowStr<'a>>, + /// The rtmp:// or rtmps:// url of the target server. + #[serde(borrow)] + pub url: jacquard_common::types::string::Uri<'a>, +} + +pub mod target_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Active; + type Url; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Active = Unset; + type Url = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `active` field to Set + pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActive<S> {} + impl<S: State> State for SetActive<S> { + type Active = Set<members::active>; + type Url = S::Url; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Active = S::Active; + type Url = Set<members::url>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Active = S::Active; + type Url = S::Url; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `active` field + pub struct active(()); + ///Marker type for the `url` field + pub struct url(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct TargetBuilder<'a, S: target_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<bool>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Target<'a> { + /// Create a new builder for this type + pub fn new() -> TargetBuilder<'a, target_state::Empty> { + TargetBuilder::new() + } +} + +impl<'a> TargetBuilder<'a, target_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + TargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetBuilder<'a, S> +where + S: target_state::State, + S::Active: target_state::IsUnset, +{ + /// Set the `active` field (required) + pub fn active( + mut self, + value: impl Into<bool>, + ) -> TargetBuilder<'a, target_state::SetActive<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + TargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetBuilder<'a, S> +where + S: target_state::State, + S::CreatedAt: target_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> TargetBuilder<'a, target_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + TargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: target_state::State> TargetBuilder<'a, S> { + /// Set the `name` field (optional) + pub fn name( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `name` field to an Option value (optional) + pub fn maybe_name(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> TargetBuilder<'a, S> +where + S: target_state::State, + S::Url: target_state::IsUnset, +{ + /// Set the `url` field (required) + pub fn url( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> TargetBuilder<'a, target_state::SetUrl<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + TargetBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> TargetBuilder<'a, S> +where + S: target_state::State, + S::Active: target_state::IsSet, + S::Url: target_state::IsSet, + S::CreatedAt: target_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Target<'a> { + Target { + active: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2, + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Target<'a> { + Target { + active: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + name: self.__unsafe_private_named.2, + url: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Target<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, TargetRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct TargetGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Target<'a>, +} + +impl From<TargetGetRecordOutput<'_>> for Target<'_> { + fn from(output: TargetGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Target<'_> { + const NSID: &'static str = "place.stream.multistream.target"; + type Record = TargetRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct TargetRecord; +impl jacquard_common::xrpc::XrpcResp for TargetRecord { + const NSID: &'static str = "place.stream.multistream.target"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = TargetGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for TargetRecord { + const NSID: &'static str = "place.stream.multistream.target"; + type Record = TargetRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Target<'a> { + fn nsid() -> &'static str { + "place.stream.multistream.target" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_place_stream_multistream_target() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.name { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 100usize, + actual: <str>::len(value.as_ref()), + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_place_stream_multistream_target() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("place.stream.multistream.target"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "An external server for rebroadcasting a Streamplace stream", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_common::smol_str::SmolStr::new_static("active"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("active"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "When this target was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "A user-friendly name for this target.", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("url"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The rtmp:// or rtmps:// url of the target server.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/place_stream/richtext/facet.rs b/crates/jacquard-api/src/place_stream/richtext/facet.rs index 5ba61ae9..11a4257a 100644 --- a/crates/jacquard-api/src/place_stream/richtext/facet.rs +++ b/crates/jacquard-api/src/place_stream/richtext/facet.rs @@ -34,37 +34,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Features; type Index; + type Features; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Features = Unset; type Index = Unset; - } - ///State transition - sets the `features` field to Set - pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFeatures<S> {} - impl<S: State> State for SetFeatures<S> { - type Features = Set<members::features>; - type Index = S::Index; + type Features = Unset; } ///State transition - sets the `index` field to Set pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndex<S> {} impl<S: State> State for SetIndex<S> { - type Features = S::Features; type Index = Set<members::index>; + type Features = S::Features; + } + ///State transition - sets the `features` field to Set + pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFeatures<S> {} + impl<S: State> State for SetFeatures<S> { + type Index = S::Index; + type Features = Set<members::features>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `features` field - pub struct features(()); ///Marker type for the `index` field pub struct index(()); + ///Marker type for the `features` field + pub struct features(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Features: facet_state::IsSet, S::Index: facet_state::IsSet, + S::Features: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { diff --git a/crates/jacquard-api/src/place_stream/segment.rs b/crates/jacquard-api/src/place_stream/segment.rs index bc521cbb..a8afcead 100644 --- a/crates/jacquard-api/src/place_stream/segment.rs +++ b/crates/jacquard-api/src/place_stream/segment.rs @@ -33,51 +33,51 @@ pub mod audio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Channels; type Codec; type Rate; - type Channels; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Channels = Unset; type Codec = Unset; type Rate = Unset; - type Channels = Unset; + } + ///State transition - sets the `channels` field to Set + pub struct SetChannels<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetChannels<S> {} + impl<S: State> State for SetChannels<S> { + type Channels = Set<members::channels>; + type Codec = S::Codec; + type Rate = S::Rate; } ///State transition - sets the `codec` field to Set pub struct SetCodec<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCodec<S> {} impl<S: State> State for SetCodec<S> { + type Channels = S::Channels; type Codec = Set<members::codec>; type Rate = S::Rate; - type Channels = S::Channels; } ///State transition - sets the `rate` field to Set pub struct SetRate<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRate<S> {} impl<S: State> State for SetRate<S> { - type Codec = S::Codec; - type Rate = Set<members::rate>; type Channels = S::Channels; - } - ///State transition - sets the `channels` field to Set - pub struct SetChannels<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetChannels<S> {} - impl<S: State> State for SetChannels<S> { type Codec = S::Codec; - type Rate = S::Rate; - type Channels = Set<members::channels>; + type Rate = Set<members::rate>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `channels` field + pub struct channels(()); ///Marker type for the `codec` field pub struct codec(()); ///Marker type for the `rate` field pub struct rate(()); - ///Marker type for the `channels` field - pub struct channels(()); } } @@ -170,9 +170,9 @@ where impl<'a, S> AudioBuilder<'a, S> where S: audio_state::State, + S::Channels: audio_state::IsSet, S::Codec: audio_state::IsSet, S::Rate: audio_state::IsSet, - S::Channels: audio_state::IsSet, { /// Build the final struct pub fn build(self) -> Audio<'a> { @@ -863,67 +863,67 @@ pub mod segment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Id; + type Creator; type SigningKey; + type Id; type StartTime; - type Creator; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Id = Unset; + type Creator = Unset; type SigningKey = Unset; + type Id = Unset; type StartTime = Unset; - type Creator = Unset; } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { - type Id = Set<members::id>; + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type Creator = Set<members::creator>; type SigningKey = S::SigningKey; + type Id = S::Id; type StartTime = S::StartTime; - type Creator = S::Creator; } ///State transition - sets the `signing_key` field to Set pub struct SetSigningKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSigningKey<S> {} impl<S: State> State for SetSigningKey<S> { - type Id = S::Id; + type Creator = S::Creator; type SigningKey = Set<members::signing_key>; + type Id = S::Id; type StartTime = S::StartTime; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { type Creator = S::Creator; + type SigningKey = S::SigningKey; + type Id = Set<members::id>; + type StartTime = S::StartTime; } ///State transition - sets the `start_time` field to Set pub struct SetStartTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStartTime<S> {} impl<S: State> State for SetStartTime<S> { - type Id = S::Id; - type SigningKey = S::SigningKey; - type StartTime = Set<members::start_time>; type Creator = S::Creator; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { - type Id = S::Id; type SigningKey = S::SigningKey; - type StartTime = S::StartTime; - type Creator = Set<members::creator>; + type Id = S::Id; + type StartTime = Set<members::start_time>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `id` field - pub struct id(()); + ///Marker type for the `creator` field + pub struct creator(()); ///Marker type for the `signing_key` field pub struct signing_key(()); + ///Marker type for the `id` field + pub struct id(()); ///Marker type for the `start_time` field pub struct start_time(()); - ///Marker type for the `creator` field - pub struct creator(()); } } @@ -1196,10 +1196,10 @@ impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { impl<'a, S> SegmentBuilder<'a, S> where S: segment_state::State, - S::Id: segment_state::IsSet, + S::Creator: segment_state::IsSet, S::SigningKey: segment_state::IsSet, + S::Id: segment_state::IsSet, S::StartTime: segment_state::IsSet, - S::Creator: segment_state::IsSet, { /// Build the final struct pub fn build(self) -> Segment<'a> { @@ -1349,37 +1349,37 @@ pub mod segment_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Record; type Cid; + type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Record = Unset; type Cid = Unset; - } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { - type Record = Set<members::record>; - type Cid = S::Cid; + type Record = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Record = S::Record; type Cid = Set<members::cid>; + type Record = S::Record; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Cid = S::Cid; + type Record = Set<members::record>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `record` field - pub struct record(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `record` field + pub struct record(()); } } @@ -1452,8 +1452,8 @@ where impl<'a, S> SegmentViewBuilder<'a, S> where S: segment_view_state::State, - S::Record: segment_view_state::IsSet, S::Cid: segment_view_state::IsSet, + S::Record: segment_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SegmentView<'a> { diff --git a/crates/jacquard-api/src/place_stream/server.rs b/crates/jacquard-api/src/place_stream/server.rs index 4286d2e3..901cf790 100644 --- a/crates/jacquard-api/src/place_stream/server.rs +++ b/crates/jacquard-api/src/place_stream/server.rs @@ -531,83 +531,83 @@ pub mod webhook_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Events; type Url; - type Id; type Active; + type Id; + type Events; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Events = Unset; type Url = Unset; - type Id = Unset; type Active = Unset; + type Id = Unset; + type Events = Unset; type CreatedAt = Unset; } - ///State transition - sets the `events` field to Set - pub struct SetEvents<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEvents<S> {} - impl<S: State> State for SetEvents<S> { - type Events = Set<members::events>; - type Url = S::Url; - type Id = S::Id; - type Active = S::Active; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type Events = S::Events; type Url = Set<members::url>; - type Id = S::Id; type Active = S::Active; + type Id = S::Id; + type Events = S::Events; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `active` field to Set + pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActive<S> {} + impl<S: State> State for SetActive<S> { + type Url = S::Url; + type Active = Set<members::active>; + type Id = S::Id; + type Events = S::Events; type CreatedAt = S::CreatedAt; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { - type Events = S::Events; type Url = S::Url; - type Id = Set<members::id>; type Active = S::Active; + type Id = Set<members::id>; + type Events = S::Events; type CreatedAt = S::CreatedAt; } - ///State transition - sets the `active` field to Set - pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetActive<S> {} - impl<S: State> State for SetActive<S> { - type Events = S::Events; + ///State transition - sets the `events` field to Set + pub struct SetEvents<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEvents<S> {} + impl<S: State> State for SetEvents<S> { type Url = S::Url; + type Active = S::Active; type Id = S::Id; - type Active = Set<members::active>; + type Events = Set<members::events>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Events = S::Events; type Url = S::Url; - type Id = S::Id; type Active = S::Active; + type Id = S::Id; + type Events = S::Events; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `events` field - pub struct events(()); ///Marker type for the `url` field pub struct url(()); - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `active` field pub struct active(()); + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `events` field + pub struct events(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -922,10 +922,10 @@ where impl<'a, S> WebhookBuilder<'a, S> where S: webhook_state::State, - S::Events: webhook_state::IsSet, S::Url: webhook_state::IsSet, - S::Id: webhook_state::IsSet, S::Active: webhook_state::IsSet, + S::Id: webhook_state::IsSet, + S::Events: webhook_state::IsSet, S::CreatedAt: webhook_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/place_stream/server/create_webhook.rs b/crates/jacquard-api/src/place_stream/server/create_webhook.rs index 18d7e385..8df1f913 100644 --- a/crates/jacquard-api/src/place_stream/server/create_webhook.rs +++ b/crates/jacquard-api/src/place_stream/server/create_webhook.rs @@ -62,37 +62,37 @@ pub mod create_webhook_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; type Events; + type Url; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; type Events = Unset; - } - ///State transition - sets the `url` field to Set - pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUrl<S> {} - impl<S: State> State for SetUrl<S> { - type Url = Set<members::url>; - type Events = S::Events; + type Url = Unset; } ///State transition - sets the `events` field to Set pub struct SetEvents<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEvents<S> {} impl<S: State> State for SetEvents<S> { - type Url = S::Url; type Events = Set<members::events>; + type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Events = S::Events; + type Url = Set<members::url>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); ///Marker type for the `events` field pub struct events(()); + ///Marker type for the `url` field + pub struct url(()); } } @@ -300,8 +300,8 @@ where impl<'a, S> CreateWebhookBuilder<'a, S> where S: create_webhook_state::State, - S::Url: create_webhook_state::IsSet, S::Events: create_webhook_state::IsSet, + S::Url: create_webhook_state::IsSet, { /// Build the final struct pub fn build(self) -> CreateWebhook<'a> { diff --git a/crates/jacquard-api/src/place_wisp/fs.rs b/crates/jacquard-api/src/place_wisp/fs.rs index 4605d395..58ef448c 100644 --- a/crates/jacquard-api/src/place_wisp/fs.rs +++ b/crates/jacquard-api/src/place_wisp/fs.rs @@ -33,37 +33,37 @@ pub mod directory_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Entries; type Type; + type Entries; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Entries = Unset; type Type = Unset; - } - ///State transition - sets the `entries` field to Set - pub struct SetEntries<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEntries<S> {} - impl<S: State> State for SetEntries<S> { - type Entries = Set<members::entries>; - type Type = S::Type; + type Entries = Unset; } ///State transition - sets the `type` field to Set pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetType<S> {} impl<S: State> State for SetType<S> { - type Entries = S::Entries; type Type = Set<members::r#type>; + type Entries = S::Entries; + } + ///State transition - sets the `entries` field to Set + pub struct SetEntries<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEntries<S> {} + impl<S: State> State for SetEntries<S> { + type Type = S::Type; + type Entries = Set<members::entries>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `entries` field - pub struct entries(()); ///Marker type for the `type` field pub struct r#type(()); + ///Marker type for the `entries` field + pub struct entries(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> DirectoryBuilder<'a, S> where S: directory_state::State, - S::Entries: directory_state::IsSet, S::Type: directory_state::IsSet, + S::Entries: directory_state::IsSet, { /// Build the final struct pub fn build(self) -> Directory<'a> { @@ -554,37 +554,37 @@ pub mod entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Node; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Node = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Node = S::Node; + type Name = Unset; } ///State transition - sets the `node` field to Set pub struct SetNode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNode<S> {} impl<S: State> State for SetNode<S> { - type Name = S::Name; type Node = Set<members::node>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Node = S::Node; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `node` field pub struct node(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -657,8 +657,8 @@ where impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, - S::Name: entry_state::IsSet, S::Node: entry_state::IsSet, + S::Name: entry_state::IsSet, { /// Build the final struct pub fn build(self) -> Entry<'a> { @@ -1011,49 +1011,49 @@ pub mod fs_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Site; type Root; + type Site; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Site = Unset; type Root = Unset; + type Site = Unset; type CreatedAt = Unset; } - ///State transition - sets the `site` field to Set - pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSite<S> {} - impl<S: State> State for SetSite<S> { - type Site = Set<members::site>; - type Root = S::Root; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `root` field to Set pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRoot<S> {} impl<S: State> State for SetRoot<S> { - type Site = S::Site; type Root = Set<members::root>; + type Site = S::Site; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `site` field to Set + pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSite<S> {} + impl<S: State> State for SetSite<S> { + type Root = S::Root; + type Site = Set<members::site>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Site = S::Site; type Root = S::Root; + type Site = S::Site; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `site` field - pub struct site(()); ///Marker type for the `root` field pub struct root(()); + ///Marker type for the `site` field + pub struct site(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -1162,8 +1162,8 @@ where impl<'a, S> FsBuilder<'a, S> where S: fs_state::State, - S::Site: fs_state::IsSet, S::Root: fs_state::IsSet, + S::Site: fs_state::IsSet, S::CreatedAt: fs_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/pub_leaflet/blocks/image.rs b/crates/jacquard-api/src/pub_leaflet/blocks/image.rs index 823750df..ee8f544e 100644 --- a/crates/jacquard-api/src/pub_leaflet/blocks/image.rs +++ b/crates/jacquard-api/src/pub_leaflet/blocks/image.rs @@ -31,37 +31,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Height; type Width; + type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Height = Unset; type Width = Unset; - } - ///State transition - sets the `height` field to Set - pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHeight<S> {} - impl<S: State> State for SetHeight<S> { - type Height = Set<members::height>; - type Width = S::Width; + type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWidth<S> {} impl<S: State> State for SetWidth<S> { - type Height = S::Height; type Width = Set<members::width>; + type Height = S::Height; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHeight<S> {} + impl<S: State> State for SetHeight<S> { + type Width = S::Width; + type Height = Set<members::height>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `height` field - pub struct height(()); ///Marker type for the `width` field pub struct width(()); + ///Marker type for the `height` field + pub struct height(()); } } @@ -131,8 +131,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Height: aspect_ratio_state::IsSet, S::Width: aspect_ratio_state::IsSet, + S::Height: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { diff --git a/crates/jacquard-api/src/pub_leaflet/blocks/text.rs b/crates/jacquard-api/src/pub_leaflet/blocks/text.rs index 98f8d62b..8246813d 100644 --- a/crates/jacquard-api/src/pub_leaflet/blocks/text.rs +++ b/crates/jacquard-api/src/pub_leaflet/blocks/text.rs @@ -23,6 +23,9 @@ pub struct Text<'a> { pub facets: std::option::Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>, #[serde(borrow)] pub plaintext: jacquard_common::CowStr<'a>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub text_size: std::option::Option<jacquard_common::CowStr<'a>>, } fn lexicon_doc_pub_leaflet_blocks_text() -> ::jacquard_lexicon::lexicon::LexiconDoc< @@ -79,6 +82,21 @@ fn lexicon_doc_pub_leaflet_blocks_text() -> ::jacquard_lexicon::lexicon::Lexicon known_values: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("textSize"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); map }, }), diff --git a/crates/jacquard-api/src/pub_leaflet/comment.rs b/crates/jacquard-api/src/pub_leaflet/comment.rs index 0e3ee34b..19245625 100644 --- a/crates/jacquard-api/src/pub_leaflet/comment.rs +++ b/crates/jacquard-api/src/pub_leaflet/comment.rs @@ -33,37 +33,37 @@ pub mod linear_document_quote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Quote; type Document; + type Quote; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Quote = Unset; type Document = Unset; - } - ///State transition - sets the `quote` field to Set - pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetQuote<S> {} - impl<S: State> State for SetQuote<S> { - type Quote = Set<members::quote>; - type Document = S::Document; + type Quote = Unset; } ///State transition - sets the `document` field to Set pub struct SetDocument<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDocument<S> {} impl<S: State> State for SetDocument<S> { - type Quote = S::Quote; type Document = Set<members::document>; + type Quote = S::Quote; + } + ///State transition - sets the `quote` field to Set + pub struct SetQuote<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetQuote<S> {} + impl<S: State> State for SetQuote<S> { + type Document = S::Document; + type Quote = Set<members::quote>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `quote` field - pub struct quote(()); ///Marker type for the `document` field pub struct document(()); + ///Marker type for the `quote` field + pub struct quote(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> LinearDocumentQuoteBuilder<'a, S> where S: linear_document_quote_state::State, - S::Quote: linear_document_quote_state::IsSet, S::Document: linear_document_quote_state::IsSet, + S::Quote: linear_document_quote_state::IsSet, { /// Build the final struct pub fn build(self) -> LinearDocumentQuote<'a> { diff --git a/crates/jacquard-api/src/pub_leaflet/document.rs b/crates/jacquard-api/src/pub_leaflet/document.rs index 570b8476..0e2fe917 100644 --- a/crates/jacquard-api/src/pub_leaflet/document.rs +++ b/crates/jacquard-api/src/pub_leaflet/document.rs @@ -58,51 +58,51 @@ pub mod document_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Title; type Pages; type Author; - type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Title = Unset; type Pages = Unset; type Author = Unset; - type Title = Unset; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; + type Pages = S::Pages; + type Author = S::Author; } ///State transition - sets the `pages` field to Set pub struct SetPages<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPages<S> {} impl<S: State> State for SetPages<S> { + type Title = S::Title; type Pages = Set<members::pages>; type Author = S::Author; - type Title = S::Title; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Pages = S::Pages; - type Author = Set<members::author>; type Title = S::Title; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { type Pages = S::Pages; - type Author = S::Author; - type Title = Set<members::title>; + type Author = Set<members::author>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `title` field + pub struct title(()); ///Marker type for the `pages` field pub struct pages(()); ///Marker type for the `author` field pub struct author(()); - ///Marker type for the `title` field - pub struct title(()); } } @@ -346,9 +346,9 @@ where impl<'a, S> DocumentBuilder<'a, S> where S: document_state::State, + S::Title: document_state::IsSet, S::Pages: document_state::IsSet, S::Author: document_state::IsSet, - S::Title: document_state::IsSet, { /// Build the final struct pub fn build(self) -> Document<'a> { diff --git a/crates/jacquard-api/src/pub_leaflet/pages/canvas.rs b/crates/jacquard-api/src/pub_leaflet/pages/canvas.rs index 0cdaf5b1..59a73c16 100644 --- a/crates/jacquard-api/src/pub_leaflet/pages/canvas.rs +++ b/crates/jacquard-api/src/pub_leaflet/pages/canvas.rs @@ -39,8 +39,8 @@ pub mod block_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Width; type Y; + type Width; type Block; type X; } @@ -48,26 +48,26 @@ pub mod block_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Width = Unset; type Y = Unset; + type Width = Unset; type Block = Unset; type X = Unset; } - ///State transition - sets the `width` field to Set - pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWidth<S> {} - impl<S: State> State for SetWidth<S> { - type Width = Set<members::width>; - type Y = S::Y; - type Block = S::Block; - type X = S::X; - } ///State transition - sets the `y` field to Set pub struct SetY<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetY<S> {} impl<S: State> State for SetY<S> { - type Width = S::Width; type Y = Set<members::y>; + type Width = S::Width; + type Block = S::Block; + type X = S::X; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWidth<S> {} + impl<S: State> State for SetWidth<S> { + type Y = S::Y; + type Width = Set<members::width>; type Block = S::Block; type X = S::X; } @@ -75,8 +75,8 @@ pub mod block_state { pub struct SetBlock<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlock<S> {} impl<S: State> State for SetBlock<S> { - type Width = S::Width; type Y = S::Y; + type Width = S::Width; type Block = Set<members::block>; type X = S::X; } @@ -84,18 +84,18 @@ pub mod block_state { pub struct SetX<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetX<S> {} impl<S: State> State for SetX<S> { - type Width = S::Width; type Y = S::Y; + type Width = S::Width; type Block = S::Block; type X = Set<members::x>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `width` field - pub struct width(()); ///Marker type for the `y` field pub struct y(()); + ///Marker type for the `width` field + pub struct width(()); ///Marker type for the `block` field pub struct block(()); ///Marker type for the `x` field @@ -234,8 +234,8 @@ where impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, - S::Width: block_state::IsSet, S::Y: block_state::IsSet, + S::Width: block_state::IsSet, S::Block: block_state::IsSet, S::X: block_state::IsSet, { diff --git a/crates/jacquard-api/src/pub_leaflet/poll/vote.rs b/crates/jacquard-api/src/pub_leaflet/poll/vote.rs index 9e9c9e43..0c9cf82e 100644 --- a/crates/jacquard-api/src/pub_leaflet/poll/vote.rs +++ b/crates/jacquard-api/src/pub_leaflet/poll/vote.rs @@ -34,37 +34,37 @@ pub mod vote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Option; type Poll; + type Option; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Option = Unset; type Poll = Unset; - } - ///State transition - sets the `option` field to Set - pub struct SetOption<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetOption<S> {} - impl<S: State> State for SetOption<S> { - type Option = Set<members::option>; - type Poll = S::Poll; + type Option = Unset; } ///State transition - sets the `poll` field to Set pub struct SetPoll<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPoll<S> {} impl<S: State> State for SetPoll<S> { - type Option = S::Option; type Poll = Set<members::poll>; + type Option = S::Option; + } + ///State transition - sets the `option` field to Set + pub struct SetOption<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOption<S> {} + impl<S: State> State for SetOption<S> { + type Poll = S::Poll; + type Option = Set<members::option>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `option` field - pub struct option(()); ///Marker type for the `poll` field pub struct poll(()); + ///Marker type for the `option` field + pub struct option(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> VoteBuilder<'a, S> where S: vote_state::State, - S::Option: vote_state::IsSet, S::Poll: vote_state::IsSet, + S::Option: vote_state::IsSet, { /// Build the final struct pub fn build(self) -> Vote<'a> { diff --git a/crates/jacquard-api/src/pub_leaflet/publication.rs b/crates/jacquard-api/src/pub_leaflet/publication.rs index 9fcd055f..4f961876 100644 --- a/crates/jacquard-api/src/pub_leaflet/publication.rs +++ b/crates/jacquard-api/src/pub_leaflet/publication.rs @@ -570,6 +570,19 @@ fn lexicon_doc_pub_leaflet_publication() -> ::jacquard_lexicon::lexicon::Lexicon closed: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "pageWidth", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: Some(1600i64), + r#enum: None, + r#const: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("primary"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { @@ -667,6 +680,8 @@ pub struct Theme<'a> { #[serde(borrow)] pub page_background: std::option::Option<ThemePageBackground<'a>>, #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub page_width: std::option::Option<i64>, + #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub primary: std::option::Option<ThemePrimary<'a>>, #[serde(skip_serializing_if = "std::option::Option::is_none")] @@ -781,6 +796,28 @@ impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> { fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.page_width { + if *value > 1600i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "page_width", + ), + max: 1600i64, + actual: *value, + }); + } + } + if let Some(ref value) = self.page_width { + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "page_width", + ), + min: 0i64, + actual: *value, + }); + } + } Ok(()) } } \ No newline at end of file diff --git a/crates/jacquard-api/src/pub_leaflet/richtext/facet.rs b/crates/jacquard-api/src/pub_leaflet/richtext/facet.rs index 3b5a73c8..488179a9 100644 --- a/crates/jacquard-api/src/pub_leaflet/richtext/facet.rs +++ b/crates/jacquard-api/src/pub_leaflet/richtext/facet.rs @@ -556,37 +556,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteStart; type ByteEnd; + type ByteStart; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteStart = Unset; type ByteEnd = Unset; - } - ///State transition - sets the `byte_start` field to Set - pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetByteStart<S> {} - impl<S: State> State for SetByteStart<S> { - type ByteStart = Set<members::byte_start>; - type ByteEnd = S::ByteEnd; + type ByteStart = Unset; } ///State transition - sets the `byte_end` field to Set pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetByteEnd<S> {} impl<S: State> State for SetByteEnd<S> { - type ByteStart = S::ByteStart; type ByteEnd = Set<members::byte_end>; + type ByteStart = S::ByteStart; + } + ///State transition - sets the `byte_start` field to Set + pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetByteStart<S> {} + impl<S: State> State for SetByteStart<S> { + type ByteEnd = S::ByteEnd; + type ByteStart = Set<members::byte_start>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_start` field - pub struct byte_start(()); ///Marker type for the `byte_end` field pub struct byte_end(()); + ///Marker type for the `byte_start` field + pub struct byte_start(()); } } @@ -656,8 +656,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteStart: byte_slice_state::IsSet, S::ByteEnd: byte_slice_state::IsSet, + S::ByteStart: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -1056,37 +1056,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Features; type Index; + type Features; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Features = Unset; type Index = Unset; - } - ///State transition - sets the `features` field to Set - pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFeatures<S> {} - impl<S: State> State for SetFeatures<S> { - type Features = Set<members::features>; - type Index = S::Index; + type Features = Unset; } ///State transition - sets the `index` field to Set pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndex<S> {} impl<S: State> State for SetIndex<S> { - type Features = S::Features; type Index = Set<members::index>; + type Features = S::Features; + } + ///State transition - sets the `features` field to Set + pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFeatures<S> {} + impl<S: State> State for SetFeatures<S> { + type Index = S::Index; + type Features = Set<members::features>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `features` field - pub struct features(()); ///Marker type for the `index` field pub struct index(()); + ///Marker type for the `features` field + pub struct features(()); } } @@ -1159,8 +1159,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Features: facet_state::IsSet, S::Index: facet_state::IsSet, + S::Features: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { diff --git a/crates/jacquard-api/src/pub_leaflet/theme/color.rs b/crates/jacquard-api/src/pub_leaflet/theme/color.rs index 1c2ac028..decaaa8b 100644 --- a/crates/jacquard-api/src/pub_leaflet/theme/color.rs +++ b/crates/jacquard-api/src/pub_leaflet/theme/color.rs @@ -33,50 +33,50 @@ pub mod rgb_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type R; - type B; type G; + type B; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type R = Unset; - type B = Unset; type G = Unset; + type B = Unset; } ///State transition - sets the `r` field to Set pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetR<S> {} impl<S: State> State for SetR<S> { type R = Set<members::r>; - type B = S::B; - type G = S::G; - } - ///State transition - sets the `b` field to Set - pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetB<S> {} - impl<S: State> State for SetB<S> { - type R = S::R; - type B = Set<members::b>; type G = S::G; + type B = S::B; } ///State transition - sets the `g` field to Set pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetG<S> {} impl<S: State> State for SetG<S> { type R = S::R; - type B = S::B; type G = Set<members::g>; + type B = S::B; + } + ///State transition - sets the `b` field to Set + pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetB<S> {} + impl<S: State> State for SetB<S> { + type R = S::R; + type G = S::G; + type B = Set<members::b>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `r` field pub struct r(()); - ///Marker type for the `b` field - pub struct b(()); ///Marker type for the `g` field pub struct g(()); + ///Marker type for the `b` field + pub struct b(()); } } @@ -161,8 +161,8 @@ impl<'a, S> RgbBuilder<'a, S> where S: rgb_state::State, S::R: rgb_state::IsSet, - S::B: rgb_state::IsSet, S::G: rgb_state::IsSet, + S::B: rgb_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgb<'a> { @@ -439,66 +439,66 @@ pub mod rgba_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type G; - type B; type A; type R; + type B; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type G = Unset; - type B = Unset; type A = Unset; type R = Unset; + type B = Unset; } ///State transition - sets the `g` field to Set pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetG<S> {} impl<S: State> State for SetG<S> { type G = Set<members::g>; - type B = S::B; - type A = S::A; - type R = S::R; - } - ///State transition - sets the `b` field to Set - pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetB<S> {} - impl<S: State> State for SetB<S> { - type G = S::G; - type B = Set<members::b>; type A = S::A; type R = S::R; + type B = S::B; } ///State transition - sets the `a` field to Set pub struct SetA<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetA<S> {} impl<S: State> State for SetA<S> { type G = S::G; - type B = S::B; type A = Set<members::a>; type R = S::R; + type B = S::B; } ///State transition - sets the `r` field to Set pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetR<S> {} impl<S: State> State for SetR<S> { type G = S::G; - type B = S::B; type A = S::A; type R = Set<members::r>; + type B = S::B; + } + ///State transition - sets the `b` field to Set + pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetB<S> {} + impl<S: State> State for SetB<S> { + type G = S::G; + type A = S::A; + type R = S::R; + type B = Set<members::b>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `g` field pub struct g(()); - ///Marker type for the `b` field - pub struct b(()); ///Marker type for the `a` field pub struct a(()); ///Marker type for the `r` field pub struct r(()); + ///Marker type for the `b` field + pub struct b(()); } } @@ -600,9 +600,9 @@ impl<'a, S> RgbaBuilder<'a, S> where S: rgba_state::State, S::G: rgba_state::IsSet, - S::B: rgba_state::IsSet, S::A: rgba_state::IsSet, S::R: rgba_state::IsSet, + S::B: rgba_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgba<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/feed/star.rs b/crates/jacquard-api/src/sh_tangled/feed/star.rs index fbb44d64..a0820844 100644 --- a/crates/jacquard-api/src/sh_tangled/feed/star.rs +++ b/crates/jacquard-api/src/sh_tangled/feed/star.rs @@ -32,37 +32,37 @@ pub mod star_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> StarBuilder<'a, S> where S: star_state::State, - S::CreatedAt: star_state::IsSet, S::Subject: star_state::IsSet, + S::CreatedAt: star_state::IsSet, { /// Build the final struct pub fn build(self) -> Star<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/git/ref_update.rs b/crates/jacquard-api/src/sh_tangled/git/ref_update.rs index 605c50f4..055efe50 100644 --- a/crates/jacquard-api/src/sh_tangled/git/ref_update.rs +++ b/crates/jacquard-api/src/sh_tangled/git/ref_update.rs @@ -432,37 +432,37 @@ pub mod individual_email_commit_count_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Count; type Email; + type Count; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Count = Unset; type Email = Unset; - } - ///State transition - sets the `count` field to Set - pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCount<S> {} - impl<S: State> State for SetCount<S> { - type Count = Set<members::count>; - type Email = S::Email; + type Count = Unset; } ///State transition - sets the `email` field to Set pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEmail<S> {} impl<S: State> State for SetEmail<S> { - type Count = S::Count; type Email = Set<members::email>; + type Count = S::Count; + } + ///State transition - sets the `count` field to Set + pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCount<S> {} + impl<S: State> State for SetCount<S> { + type Email = S::Email; + type Count = Set<members::count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `count` field - pub struct count(()); ///Marker type for the `email` field pub struct email(()); + ///Marker type for the `count` field + pub struct count(()); } } @@ -549,8 +549,8 @@ where impl<'a, S> IndividualEmailCommitCountBuilder<'a, S> where S: individual_email_commit_count_state::State, - S::Count: individual_email_commit_count_state::IsSet, S::Email: individual_email_commit_count_state::IsSet, + S::Count: individual_email_commit_count_state::IsSet, { /// Build the final struct pub fn build(self) -> IndividualEmailCommitCount<'a> { @@ -852,127 +852,127 @@ pub mod ref_update_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type RepoDid; - type NewSha; - type Meta; - type Ref; type CommitterDid; type RepoName; + type Meta; type OldSha; + type Ref; + type RepoDid; + type NewSha; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type RepoDid = Unset; - type NewSha = Unset; - type Meta = Unset; - type Ref = Unset; type CommitterDid = Unset; type RepoName = Unset; + type Meta = Unset; type OldSha = Unset; + type Ref = Unset; + type RepoDid = Unset; + type NewSha = Unset; } - ///State transition - sets the `repo_did` field to Set - pub struct SetRepoDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepoDid<S> {} - impl<S: State> State for SetRepoDid<S> { - type RepoDid = Set<members::repo_did>; - type NewSha = S::NewSha; - type Meta = S::Meta; - type Ref = S::Ref; - type CommitterDid = S::CommitterDid; + ///State transition - sets the `committer_did` field to Set + pub struct SetCommitterDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCommitterDid<S> {} + impl<S: State> State for SetCommitterDid<S> { + type CommitterDid = Set<members::committer_did>; type RepoName = S::RepoName; - type OldSha = S::OldSha; - } - ///State transition - sets the `new_sha` field to Set - pub struct SetNewSha<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNewSha<S> {} - impl<S: State> State for SetNewSha<S> { - type RepoDid = S::RepoDid; - type NewSha = Set<members::new_sha>; type Meta = S::Meta; + type OldSha = S::OldSha; type Ref = S::Ref; + type RepoDid = S::RepoDid; + type NewSha = S::NewSha; + } + ///State transition - sets the `repo_name` field to Set + pub struct SetRepoName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepoName<S> {} + impl<S: State> State for SetRepoName<S> { type CommitterDid = S::CommitterDid; - type RepoName = S::RepoName; + type RepoName = Set<members::repo_name>; + type Meta = S::Meta; type OldSha = S::OldSha; + type Ref = S::Ref; + type RepoDid = S::RepoDid; + type NewSha = S::NewSha; } ///State transition - sets the `meta` field to Set pub struct SetMeta<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMeta<S> {} impl<S: State> State for SetMeta<S> { - type RepoDid = S::RepoDid; - type NewSha = S::NewSha; + type CommitterDid = S::CommitterDid; + type RepoName = S::RepoName; type Meta = Set<members::meta>; + type OldSha = S::OldSha; type Ref = S::Ref; + type RepoDid = S::RepoDid; + type NewSha = S::NewSha; + } + ///State transition - sets the `old_sha` field to Set + pub struct SetOldSha<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOldSha<S> {} + impl<S: State> State for SetOldSha<S> { type CommitterDid = S::CommitterDid; type RepoName = S::RepoName; - type OldSha = S::OldSha; + type Meta = S::Meta; + type OldSha = Set<members::old_sha>; + type Ref = S::Ref; + type RepoDid = S::RepoDid; + type NewSha = S::NewSha; } ///State transition - sets the `ref` field to Set pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRef<S> {} impl<S: State> State for SetRef<S> { - type RepoDid = S::RepoDid; - type NewSha = S::NewSha; - type Meta = S::Meta; - type Ref = Set<members::r#ref>; type CommitterDid = S::CommitterDid; type RepoName = S::RepoName; - type OldSha = S::OldSha; - } - ///State transition - sets the `committer_did` field to Set - pub struct SetCommitterDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCommitterDid<S> {} - impl<S: State> State for SetCommitterDid<S> { - type RepoDid = S::RepoDid; - type NewSha = S::NewSha; type Meta = S::Meta; - type Ref = S::Ref; - type CommitterDid = Set<members::committer_did>; - type RepoName = S::RepoName; type OldSha = S::OldSha; - } - ///State transition - sets the `repo_name` field to Set - pub struct SetRepoName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepoName<S> {} - impl<S: State> State for SetRepoName<S> { + type Ref = Set<members::r#ref>; type RepoDid = S::RepoDid; type NewSha = S::NewSha; - type Meta = S::Meta; - type Ref = S::Ref; - type CommitterDid = S::CommitterDid; - type RepoName = Set<members::repo_name>; - type OldSha = S::OldSha; } - ///State transition - sets the `old_sha` field to Set - pub struct SetOldSha<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetOldSha<S> {} - impl<S: State> State for SetOldSha<S> { - type RepoDid = S::RepoDid; - type NewSha = S::NewSha; + ///State transition - sets the `repo_did` field to Set + pub struct SetRepoDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepoDid<S> {} + impl<S: State> State for SetRepoDid<S> { + type CommitterDid = S::CommitterDid; + type RepoName = S::RepoName; type Meta = S::Meta; + type OldSha = S::OldSha; type Ref = S::Ref; + type RepoDid = Set<members::repo_did>; + type NewSha = S::NewSha; + } + ///State transition - sets the `new_sha` field to Set + pub struct SetNewSha<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNewSha<S> {} + impl<S: State> State for SetNewSha<S> { type CommitterDid = S::CommitterDid; type RepoName = S::RepoName; - type OldSha = Set<members::old_sha>; + type Meta = S::Meta; + type OldSha = S::OldSha; + type Ref = S::Ref; + type RepoDid = S::RepoDid; + type NewSha = Set<members::new_sha>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo_did` field - pub struct repo_did(()); - ///Marker type for the `new_sha` field - pub struct new_sha(()); - ///Marker type for the `meta` field - pub struct meta(()); - ///Marker type for the `ref` field - pub struct r#ref(()); ///Marker type for the `committer_did` field pub struct committer_did(()); ///Marker type for the `repo_name` field pub struct repo_name(()); + ///Marker type for the `meta` field + pub struct meta(()); ///Marker type for the `old_sha` field pub struct old_sha(()); + ///Marker type for the `ref` field + pub struct r#ref(()); + ///Marker type for the `repo_did` field + pub struct repo_did(()); + ///Marker type for the `new_sha` field + pub struct new_sha(()); } } @@ -1145,13 +1145,13 @@ where impl<'a, S> RefUpdateBuilder<'a, S> where S: ref_update_state::State, - S::RepoDid: ref_update_state::IsSet, - S::NewSha: ref_update_state::IsSet, - S::Meta: ref_update_state::IsSet, - S::Ref: ref_update_state::IsSet, S::CommitterDid: ref_update_state::IsSet, S::RepoName: ref_update_state::IsSet, + S::Meta: ref_update_state::IsSet, S::OldSha: ref_update_state::IsSet, + S::Ref: ref_update_state::IsSet, + S::RepoDid: ref_update_state::IsSet, + S::NewSha: ref_update_state::IsSet, { /// Build the final struct pub fn build(self) -> RefUpdate<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/graph/follow.rs b/crates/jacquard-api/src/sh_tangled/graph/follow.rs index 86c64bc6..560a0202 100644 --- a/crates/jacquard-api/src/sh_tangled/graph/follow.rs +++ b/crates/jacquard-api/src/sh_tangled/graph/follow.rs @@ -32,37 +32,37 @@ pub mod follow_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> FollowBuilder<'a, S> where S: follow_state::State, - S::CreatedAt: follow_state::IsSet, S::Subject: follow_state::IsSet, + S::CreatedAt: follow_state::IsSet, { /// Build the final struct pub fn build(self) -> Follow<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/knot/list_keys.rs b/crates/jacquard-api/src/sh_tangled/knot/list_keys.rs index 9e3d4bf1..22d3d403 100644 --- a/crates/jacquard-api/src/sh_tangled/knot/list_keys.rs +++ b/crates/jacquard-api/src/sh_tangled/knot/list_keys.rs @@ -226,49 +226,49 @@ pub mod public_key_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Key; type CreatedAt; + type Key; type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Key = Unset; type CreatedAt = Unset; + type Key = Unset; type Did = Unset; } - ///State transition - sets the `key` field to Set - pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetKey<S> {} - impl<S: State> State for SetKey<S> { - type Key = Set<members::key>; - type CreatedAt = S::CreatedAt; - type Did = S::Did; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Key = S::Key; type CreatedAt = Set<members::created_at>; + type Key = S::Key; + type Did = S::Did; + } + ///State transition - sets the `key` field to Set + pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKey<S> {} + impl<S: State> State for SetKey<S> { + type CreatedAt = S::CreatedAt; + type Key = Set<members::key>; type Did = S::Did; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Key = S::Key; type CreatedAt = S::CreatedAt; + type Key = S::Key; type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `key` field - pub struct key(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `key` field + pub struct key(()); ///Marker type for the `did` field pub struct did(()); } @@ -363,8 +363,8 @@ where impl<'a, S> PublicKeyBuilder<'a, S> where S: public_key_state::State, - S::Key: public_key_state::IsSet, S::CreatedAt: public_key_state::IsSet, + S::Key: public_key_state::IsSet, S::Did: public_key_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/label/definition.rs b/crates/jacquard-api/src/sh_tangled/label/definition.rs index ec31fc10..68e4a647 100644 --- a/crates/jacquard-api/src/sh_tangled/label/definition.rs +++ b/crates/jacquard-api/src/sh_tangled/label/definition.rs @@ -47,8 +47,8 @@ pub mod definition_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Name; - type Scope; type CreatedAt; + type Scope; type ValueType; } /// Empty state - all required fields are unset @@ -56,8 +56,8 @@ pub mod definition_state { impl sealed::Sealed for Empty {} impl State for Empty { type Name = Unset; - type Scope = Unset; type CreatedAt = Unset; + type Scope = Unset; type ValueType = Unset; } ///State transition - sets the `name` field to Set @@ -65,17 +65,8 @@ pub mod definition_state { impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type Name = Set<members::name>; - type Scope = S::Scope; - type CreatedAt = S::CreatedAt; - type ValueType = S::ValueType; - } - ///State transition - sets the `scope` field to Set - pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetScope<S> {} - impl<S: State> State for SetScope<S> { - type Name = S::Name; - type Scope = Set<members::scope>; type CreatedAt = S::CreatedAt; + type Scope = S::Scope; type ValueType = S::ValueType; } ///State transition - sets the `created_at` field to Set @@ -83,8 +74,17 @@ pub mod definition_state { impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Name = S::Name; - type Scope = S::Scope; type CreatedAt = Set<members::created_at>; + type Scope = S::Scope; + type ValueType = S::ValueType; + } + ///State transition - sets the `scope` field to Set + pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetScope<S> {} + impl<S: State> State for SetScope<S> { + type Name = S::Name; + type CreatedAt = S::CreatedAt; + type Scope = Set<members::scope>; type ValueType = S::ValueType; } ///State transition - sets the `value_type` field to Set @@ -92,8 +92,8 @@ pub mod definition_state { impl<S: State> sealed::Sealed for SetValueType<S> {} impl<S: State> State for SetValueType<S> { type Name = S::Name; - type Scope = S::Scope; type CreatedAt = S::CreatedAt; + type Scope = S::Scope; type ValueType = Set<members::value_type>; } /// Marker types for field names @@ -101,10 +101,10 @@ pub mod definition_state { pub mod members { ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `scope` field - pub struct scope(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `scope` field + pub struct scope(()); ///Marker type for the `value_type` field pub struct value_type(()); } @@ -251,8 +251,8 @@ impl<'a, S> DefinitionBuilder<'a, S> where S: definition_state::State, S::Name: definition_state::IsSet, - S::Scope: definition_state::IsSet, S::CreatedAt: definition_state::IsSet, + S::Scope: definition_state::IsSet, S::ValueType: definition_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/label/op.rs b/crates/jacquard-api/src/sh_tangled/label/op.rs index 7df0b01a..135cdeb6 100644 --- a/crates/jacquard-api/src/sh_tangled/label/op.rs +++ b/crates/jacquard-api/src/sh_tangled/label/op.rs @@ -38,8 +38,8 @@ pub mod op_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Add; - type Delete; type Subject; + type Delete; type PerformedAt; } /// Empty state - all required fields are unset @@ -47,8 +47,8 @@ pub mod op_state { impl sealed::Sealed for Empty {} impl State for Empty { type Add = Unset; - type Delete = Unset; type Subject = Unset; + type Delete = Unset; type PerformedAt = Unset; } ///State transition - sets the `add` field to Set @@ -56,17 +56,8 @@ pub mod op_state { impl<S: State> sealed::Sealed for SetAdd<S> {} impl<S: State> State for SetAdd<S> { type Add = Set<members::add>; - type Delete = S::Delete; - type Subject = S::Subject; - type PerformedAt = S::PerformedAt; - } - ///State transition - sets the `delete` field to Set - pub struct SetDelete<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDelete<S> {} - impl<S: State> State for SetDelete<S> { - type Add = S::Add; - type Delete = Set<members::delete>; type Subject = S::Subject; + type Delete = S::Delete; type PerformedAt = S::PerformedAt; } ///State transition - sets the `subject` field to Set @@ -74,8 +65,17 @@ pub mod op_state { impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { type Add = S::Add; - type Delete = S::Delete; type Subject = Set<members::subject>; + type Delete = S::Delete; + type PerformedAt = S::PerformedAt; + } + ///State transition - sets the `delete` field to Set + pub struct SetDelete<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDelete<S> {} + impl<S: State> State for SetDelete<S> { + type Add = S::Add; + type Subject = S::Subject; + type Delete = Set<members::delete>; type PerformedAt = S::PerformedAt; } ///State transition - sets the `performed_at` field to Set @@ -83,8 +83,8 @@ pub mod op_state { impl<S: State> sealed::Sealed for SetPerformedAt<S> {} impl<S: State> State for SetPerformedAt<S> { type Add = S::Add; - type Delete = S::Delete; type Subject = S::Subject; + type Delete = S::Delete; type PerformedAt = Set<members::performed_at>; } /// Marker types for field names @@ -92,10 +92,10 @@ pub mod op_state { pub mod members { ///Marker type for the `add` field pub struct add(()); - ///Marker type for the `delete` field - pub struct delete(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `delete` field + pub struct delete(()); ///Marker type for the `performed_at` field pub struct performed_at(()); } @@ -211,8 +211,8 @@ impl<'a, S> OpBuilder<'a, S> where S: op_state::State, S::Add: op_state::IsSet, - S::Delete: op_state::IsSet, S::Subject: op_state::IsSet, + S::Delete: op_state::IsSet, S::PerformedAt: op_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/pipeline.rs b/crates/jacquard-api/src/sh_tangled/pipeline.rs index 74522d72..d327c135 100644 --- a/crates/jacquard-api/src/sh_tangled/pipeline.rs +++ b/crates/jacquard-api/src/sh_tangled/pipeline.rs @@ -34,51 +34,51 @@ pub mod clone_opts_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Submodules; type Skip; type Depth; - type Submodules; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Submodules = Unset; type Skip = Unset; type Depth = Unset; - type Submodules = Unset; + } + ///State transition - sets the `submodules` field to Set + pub struct SetSubmodules<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubmodules<S> {} + impl<S: State> State for SetSubmodules<S> { + type Submodules = Set<members::submodules>; + type Skip = S::Skip; + type Depth = S::Depth; } ///State transition - sets the `skip` field to Set pub struct SetSkip<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSkip<S> {} impl<S: State> State for SetSkip<S> { + type Submodules = S::Submodules; type Skip = Set<members::skip>; type Depth = S::Depth; - type Submodules = S::Submodules; } ///State transition - sets the `depth` field to Set pub struct SetDepth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDepth<S> {} impl<S: State> State for SetDepth<S> { - type Skip = S::Skip; - type Depth = Set<members::depth>; type Submodules = S::Submodules; - } - ///State transition - sets the `submodules` field to Set - pub struct SetSubmodules<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubmodules<S> {} - impl<S: State> State for SetSubmodules<S> { type Skip = S::Skip; - type Depth = S::Depth; - type Submodules = Set<members::submodules>; + type Depth = Set<members::depth>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `submodules` field + pub struct submodules(()); ///Marker type for the `skip` field pub struct skip(()); ///Marker type for the `depth` field pub struct depth(()); - ///Marker type for the `submodules` field - pub struct submodules(()); } } @@ -171,9 +171,9 @@ where impl<'a, S> CloneOptsBuilder<'a, S> where S: clone_opts_state::State, + S::Submodules: clone_opts_state::IsSet, S::Skip: clone_opts_state::IsSet, S::Depth: clone_opts_state::IsSet, - S::Submodules: clone_opts_state::IsSet, { /// Build the final struct pub fn build(self) -> CloneOpts<'a> { @@ -806,37 +806,37 @@ pub mod pipeline_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type TriggerMetadata; type Workflows; + type TriggerMetadata; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type TriggerMetadata = Unset; type Workflows = Unset; - } - ///State transition - sets the `trigger_metadata` field to Set - pub struct SetTriggerMetadata<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTriggerMetadata<S> {} - impl<S: State> State for SetTriggerMetadata<S> { - type TriggerMetadata = Set<members::trigger_metadata>; - type Workflows = S::Workflows; + type TriggerMetadata = Unset; } ///State transition - sets the `workflows` field to Set pub struct SetWorkflows<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWorkflows<S> {} impl<S: State> State for SetWorkflows<S> { - type TriggerMetadata = S::TriggerMetadata; type Workflows = Set<members::workflows>; + type TriggerMetadata = S::TriggerMetadata; + } + ///State transition - sets the `trigger_metadata` field to Set + pub struct SetTriggerMetadata<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTriggerMetadata<S> {} + impl<S: State> State for SetTriggerMetadata<S> { + type Workflows = S::Workflows; + type TriggerMetadata = Set<members::trigger_metadata>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `trigger_metadata` field - pub struct trigger_metadata(()); ///Marker type for the `workflows` field pub struct workflows(()); + ///Marker type for the `trigger_metadata` field + pub struct trigger_metadata(()); } } @@ -909,8 +909,8 @@ where impl<'a, S> PipelineBuilder<'a, S> where S: pipeline_state::State, - S::TriggerMetadata: pipeline_state::IsSet, S::Workflows: pipeline_state::IsSet, + S::TriggerMetadata: pipeline_state::IsSet, { /// Build the final struct pub fn build(self) -> Pipeline<'a> { @@ -1280,37 +1280,37 @@ pub mod trigger_metadata_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Kind; type Repo; + type Kind; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Kind = Unset; type Repo = Unset; - } - ///State transition - sets the `kind` field to Set - pub struct SetKind<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetKind<S> {} - impl<S: State> State for SetKind<S> { - type Kind = Set<members::kind>; - type Repo = S::Repo; + type Kind = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Kind = S::Kind; type Repo = Set<members::repo>; + type Kind = S::Kind; + } + ///State transition - sets the `kind` field to Set + pub struct SetKind<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKind<S> {} + impl<S: State> State for SetKind<S> { + type Repo = S::Repo; + type Kind = Set<members::kind>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `kind` field - pub struct kind(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `kind` field + pub struct kind(()); } } @@ -1443,8 +1443,8 @@ where impl<'a, S> TriggerMetadataBuilder<'a, S> where S: trigger_metadata_state::State, - S::Kind: trigger_metadata_state::IsSet, S::Repo: trigger_metadata_state::IsSet, + S::Kind: trigger_metadata_state::IsSet, { /// Build the final struct pub fn build(self) -> TriggerMetadata<'a> { @@ -1525,67 +1525,67 @@ pub mod trigger_repo_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; type Knot; - type DefaultBranch; + type Repo; type Did; + type DefaultBranch; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; type Knot = Unset; - type DefaultBranch = Unset; + type Repo = Unset; type Did = Unset; - } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { - type Repo = Set<members::repo>; - type Knot = S::Knot; - type DefaultBranch = S::DefaultBranch; - type Did = S::Did; + type DefaultBranch = Unset; } ///State transition - sets the `knot` field to Set pub struct SetKnot<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKnot<S> {} impl<S: State> State for SetKnot<S> { - type Repo = S::Repo; type Knot = Set<members::knot>; - type DefaultBranch = S::DefaultBranch; + type Repo = S::Repo; type Did = S::Did; + type DefaultBranch = S::DefaultBranch; } - ///State transition - sets the `default_branch` field to Set - pub struct SetDefaultBranch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDefaultBranch<S> {} - impl<S: State> State for SetDefaultBranch<S> { - type Repo = S::Repo; + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { type Knot = S::Knot; - type DefaultBranch = Set<members::default_branch>; + type Repo = Set<members::repo>; type Did = S::Did; + type DefaultBranch = S::DefaultBranch; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Repo = S::Repo; type Knot = S::Knot; - type DefaultBranch = S::DefaultBranch; + type Repo = S::Repo; type Did = Set<members::did>; + type DefaultBranch = S::DefaultBranch; + } + ///State transition - sets the `default_branch` field to Set + pub struct SetDefaultBranch<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDefaultBranch<S> {} + impl<S: State> State for SetDefaultBranch<S> { + type Knot = S::Knot; + type Repo = S::Repo; + type Did = S::Did; + type DefaultBranch = Set<members::default_branch>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); ///Marker type for the `knot` field pub struct knot(()); - ///Marker type for the `default_branch` field - pub struct default_branch(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `default_branch` field + pub struct default_branch(()); } } @@ -1698,10 +1698,10 @@ where impl<'a, S> TriggerRepoBuilder<'a, S> where S: trigger_repo_state::State, - S::Repo: trigger_repo_state::IsSet, S::Knot: trigger_repo_state::IsSet, - S::DefaultBranch: trigger_repo_state::IsSet, + S::Repo: trigger_repo_state::IsSet, S::Did: trigger_repo_state::IsSet, + S::DefaultBranch: trigger_repo_state::IsSet, { /// Build the final struct pub fn build(self) -> TriggerRepo<'a> { @@ -1780,65 +1780,65 @@ pub mod workflow_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Raw; type Engine; + type Name; type Clone; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Raw = Unset; type Engine = Unset; + type Name = Unset; type Clone = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Raw = S::Raw; - type Engine = S::Engine; - type Clone = S::Clone; - } ///State transition - sets the `raw` field to Set pub struct SetRaw<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRaw<S> {} impl<S: State> State for SetRaw<S> { - type Name = S::Name; type Raw = Set<members::raw>; type Engine = S::Engine; + type Name = S::Name; type Clone = S::Clone; } ///State transition - sets the `engine` field to Set pub struct SetEngine<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEngine<S> {} impl<S: State> State for SetEngine<S> { - type Name = S::Name; type Raw = S::Raw; type Engine = Set<members::engine>; + type Name = S::Name; + type Clone = S::Clone; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Raw = S::Raw; + type Engine = S::Engine; + type Name = Set<members::name>; type Clone = S::Clone; } ///State transition - sets the `clone` field to Set pub struct SetClone<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetClone<S> {} impl<S: State> State for SetClone<S> { - type Name = S::Name; type Raw = S::Raw; type Engine = S::Engine; + type Name = S::Name; type Clone = Set<members::clone>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `raw` field pub struct raw(()); ///Marker type for the `engine` field pub struct engine(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `clone` field pub struct clone(()); } @@ -1953,9 +1953,9 @@ where impl<'a, S> WorkflowBuilder<'a, S> where S: workflow_state::State, - S::Name: workflow_state::IsSet, S::Raw: workflow_state::IsSet, S::Engine: workflow_state::IsSet, + S::Name: workflow_state::IsSet, S::Clone: workflow_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/pipeline/status.rs b/crates/jacquard-api/src/sh_tangled/pipeline/status.rs index a8567f3c..e160a0a6 100644 --- a/crates/jacquard-api/src/sh_tangled/pipeline/status.rs +++ b/crates/jacquard-api/src/sh_tangled/pipeline/status.rs @@ -47,67 +47,67 @@ pub mod status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Pipeline; type Workflow; - type CreatedAt; type Status; - type Pipeline; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Pipeline = Unset; type Workflow = Unset; - type CreatedAt = Unset; type Status = Unset; - type Pipeline = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `pipeline` field to Set + pub struct SetPipeline<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPipeline<S> {} + impl<S: State> State for SetPipeline<S> { + type Pipeline = Set<members::pipeline>; + type Workflow = S::Workflow; + type Status = S::Status; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `workflow` field to Set pub struct SetWorkflow<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWorkflow<S> {} impl<S: State> State for SetWorkflow<S> { - type Workflow = Set<members::workflow>; - type CreatedAt = S::CreatedAt; - type Status = S::Status; type Pipeline = S::Pipeline; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Workflow = S::Workflow; - type CreatedAt = Set<members::created_at>; + type Workflow = Set<members::workflow>; type Status = S::Status; - type Pipeline = S::Pipeline; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { + type Pipeline = S::Pipeline; type Workflow = S::Workflow; - type CreatedAt = S::CreatedAt; type Status = Set<members::status>; - type Pipeline = S::Pipeline; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `pipeline` field to Set - pub struct SetPipeline<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPipeline<S> {} - impl<S: State> State for SetPipeline<S> { + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Pipeline = S::Pipeline; type Workflow = S::Workflow; - type CreatedAt = S::CreatedAt; type Status = S::Status; - type Pipeline = Set<members::pipeline>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `pipeline` field + pub struct pipeline(()); ///Marker type for the `workflow` field pub struct workflow(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `status` field pub struct status(()); - ///Marker type for the `pipeline` field - pub struct pipeline(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -251,10 +251,10 @@ where impl<'a, S> StatusBuilder<'a, S> where S: status_state::State, + S::Pipeline: status_state::IsSet, S::Workflow: status_state::IsSet, - S::CreatedAt: status_state::IsSet, S::Status: status_state::IsSet, - S::Pipeline: status_state::IsSet, + S::CreatedAt: status_state::IsSet, { /// Build the final struct pub fn build(self) -> Status<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/public_key.rs b/crates/jacquard-api/src/sh_tangled/public_key.rs index a48b899f..005b650f 100644 --- a/crates/jacquard-api/src/sh_tangled/public_key.rs +++ b/crates/jacquard-api/src/sh_tangled/public_key.rs @@ -37,51 +37,51 @@ pub mod public_key_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Key; type Name; type CreatedAt; + type Key; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Key = Unset; type Name = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `key` field to Set - pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetKey<S> {} - impl<S: State> State for SetKey<S> { - type Key = Set<members::key>; - type Name = S::Name; - type CreatedAt = S::CreatedAt; + type Key = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Key = S::Key; type Name = Set<members::name>; type CreatedAt = S::CreatedAt; + type Key = S::Key; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Key = S::Key; type Name = S::Name; type CreatedAt = Set<members::created_at>; + type Key = S::Key; + } + ///State transition - sets the `key` field to Set + pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKey<S> {} + impl<S: State> State for SetKey<S> { + type Name = S::Name; + type CreatedAt = S::CreatedAt; + type Key = Set<members::key>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `key` field - pub struct key(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `key` field + pub struct key(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> PublicKeyBuilder<'a, S> where S: public_key_state::State, - S::Key: public_key_state::IsSet, S::Name: public_key_state::IsSet, S::CreatedAt: public_key_state::IsSet, + S::Key: public_key_state::IsSet, { /// Build the final struct pub fn build(self) -> PublicKey<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/add_secret.rs b/crates/jacquard-api/src/sh_tangled/repo/add_secret.rs index 6293d01a..98e2648e 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/add_secret.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/add_secret.rs @@ -35,49 +35,49 @@ pub mod add_secret_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; type Value; + type Repo; type Key; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; type Value = Unset; + type Repo = Unset; type Key = Unset; } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { - type Repo = Set<members::repo>; - type Value = S::Value; - type Key = S::Key; - } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Repo = S::Repo; type Value = Set<members::value>; + type Repo = S::Repo; + type Key = S::Key; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { + type Value = S::Value; + type Repo = Set<members::repo>; type Key = S::Key; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { - type Repo = S::Repo; type Value = S::Value; + type Repo = S::Repo; type Key = Set<members::key>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `repo` field + pub struct repo(()); ///Marker type for the `key` field pub struct key(()); } @@ -172,8 +172,8 @@ where impl<'a, S> AddSecretBuilder<'a, S> where S: add_secret_state::State, - S::Repo: add_secret_state::IsSet, S::Value: add_secret_state::IsSet, + S::Repo: add_secret_state::IsSet, S::Key: add_secret_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/repo/artifact.rs b/crates/jacquard-api/src/sh_tangled/repo/artifact.rs index b67a1ea3..3f0f1e75 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/artifact.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/artifact.rs @@ -43,85 +43,85 @@ pub mod artifact_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Repo; type Name; - type Tag; type CreatedAt; + type Tag; type Artifact; + type Repo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Repo = Unset; type Name = Unset; - type Tag = Unset; type CreatedAt = Unset; + type Tag = Unset; type Artifact = Unset; - } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { - type Repo = Set<members::repo>; - type Name = S::Name; - type Tag = S::Tag; - type CreatedAt = S::CreatedAt; - type Artifact = S::Artifact; + type Repo = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Repo = S::Repo; type Name = Set<members::name>; - type Tag = S::Tag; type CreatedAt = S::CreatedAt; + type Tag = S::Tag; type Artifact = S::Artifact; - } - ///State transition - sets the `tag` field to Set - pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTag<S> {} - impl<S: State> State for SetTag<S> { type Repo = S::Repo; - type Name = S::Name; - type Tag = Set<members::tag>; - type CreatedAt = S::CreatedAt; - type Artifact = S::Artifact; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Repo = S::Repo; type Name = S::Name; - type Tag = S::Tag; type CreatedAt = Set<members::created_at>; + type Tag = S::Tag; + type Artifact = S::Artifact; + type Repo = S::Repo; + } + ///State transition - sets the `tag` field to Set + pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTag<S> {} + impl<S: State> State for SetTag<S> { + type Name = S::Name; + type CreatedAt = S::CreatedAt; + type Tag = Set<members::tag>; type Artifact = S::Artifact; + type Repo = S::Repo; } ///State transition - sets the `artifact` field to Set pub struct SetArtifact<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetArtifact<S> {} impl<S: State> State for SetArtifact<S> { - type Repo = S::Repo; type Name = S::Name; - type Tag = S::Tag; type CreatedAt = S::CreatedAt; + type Tag = S::Tag; type Artifact = Set<members::artifact>; + type Repo = S::Repo; + } + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { + type Name = S::Name; + type CreatedAt = S::CreatedAt; + type Tag = S::Tag; + type Artifact = S::Artifact; + type Repo = Set<members::repo>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `repo` field - pub struct repo(()); ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `tag` field - pub struct tag(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `tag` field + pub struct tag(()); ///Marker type for the `artifact` field pub struct artifact(()); + ///Marker type for the `repo` field + pub struct repo(()); } } @@ -254,11 +254,11 @@ where impl<'a, S> ArtifactBuilder<'a, S> where S: artifact_state::State, - S::Repo: artifact_state::IsSet, S::Name: artifact_state::IsSet, - S::Tag: artifact_state::IsSet, S::CreatedAt: artifact_state::IsSet, + S::Tag: artifact_state::IsSet, S::Artifact: artifact_state::IsSet, + S::Repo: artifact_state::IsSet, { /// Build the final struct pub fn build(self) -> Artifact<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/blob.rs b/crates/jacquard-api/src/sh_tangled/repo/blob.rs index 7eea125f..00b90b74 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/blob.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/blob.rs @@ -44,51 +44,51 @@ pub mod last_commit_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Message; - type Hash; type When; + type Hash; + type Message; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Message = Unset; - type Hash = Unset; type When = Unset; + type Hash = Unset; + type Message = Unset; } - ///State transition - sets the `message` field to Set - pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMessage<S> {} - impl<S: State> State for SetMessage<S> { - type Message = Set<members::message>; + ///State transition - sets the `when` field to Set + pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWhen<S> {} + impl<S: State> State for SetWhen<S> { + type When = Set<members::when>; type Hash = S::Hash; - type When = S::When; + type Message = S::Message; } ///State transition - sets the `hash` field to Set pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHash<S> {} impl<S: State> State for SetHash<S> { - type Message = S::Message; - type Hash = Set<members::hash>; type When = S::When; - } - ///State transition - sets the `when` field to Set - pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWhen<S> {} - impl<S: State> State for SetWhen<S> { + type Hash = Set<members::hash>; type Message = S::Message; + } + ///State transition - sets the `message` field to Set + pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMessage<S> {} + impl<S: State> State for SetMessage<S> { + type When = S::When; type Hash = S::Hash; - type When = Set<members::when>; + type Message = Set<members::message>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `message` field - pub struct message(()); - ///Marker type for the `hash` field - pub struct hash(()); ///Marker type for the `when` field pub struct when(()); + ///Marker type for the `hash` field + pub struct hash(()); + ///Marker type for the `message` field + pub struct message(()); } } @@ -221,9 +221,9 @@ where impl<'a, S> LastCommitBuilder<'a, S> where S: last_commit_state::State, - S::Message: last_commit_state::IsSet, - S::Hash: last_commit_state::IsSet, S::When: last_commit_state::IsSet, + S::Hash: last_commit_state::IsSet, + S::Message: last_commit_state::IsSet, { /// Build the final struct pub fn build(self) -> LastCommit<'a> { @@ -988,50 +988,50 @@ pub mod signature_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Name; - type When; type Email; + type When; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Name = Unset; - type When = Unset; type Email = Unset; + type When = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type Name = Set<members::name>; - type When = S::When; - type Email = S::Email; - } - ///State transition - sets the `when` field to Set - pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWhen<S> {} - impl<S: State> State for SetWhen<S> { - type Name = S::Name; - type When = Set<members::when>; type Email = S::Email; + type When = S::When; } ///State transition - sets the `email` field to Set pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEmail<S> {} impl<S: State> State for SetEmail<S> { type Name = S::Name; - type When = S::When; type Email = Set<members::email>; + type When = S::When; + } + ///State transition - sets the `when` field to Set + pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWhen<S> {} + impl<S: State> State for SetWhen<S> { + type Name = S::Name; + type Email = S::Email; + type When = Set<members::when>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `when` field - pub struct when(()); ///Marker type for the `email` field pub struct email(()); + ///Marker type for the `when` field + pub struct when(()); } } @@ -1125,8 +1125,8 @@ impl<'a, S> SignatureBuilder<'a, S> where S: signature_state::State, S::Name: signature_state::IsSet, - S::When: signature_state::IsSet, S::Email: signature_state::IsSet, + S::When: signature_state::IsSet, { /// Build the final struct pub fn build(self) -> Signature<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/branch.rs b/crates/jacquard-api/src/sh_tangled/repo/branch.rs index 98af903d..10855ee3 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/branch.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/branch.rs @@ -296,51 +296,51 @@ pub mod signature_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; - type Email; type When; + type Email; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; - type Email = Unset; type When = Unset; + type Email = Unset; + type Name = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; + ///State transition - sets the `when` field to Set + pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWhen<S> {} + impl<S: State> State for SetWhen<S> { + type When = Set<members::when>; type Email = S::Email; - type When = S::When; + type Name = S::Name; } ///State transition - sets the `email` field to Set pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEmail<S> {} impl<S: State> State for SetEmail<S> { - type Name = S::Name; - type Email = Set<members::email>; type When = S::When; - } - ///State transition - sets the `when` field to Set - pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWhen<S> {} - impl<S: State> State for SetWhen<S> { + type Email = Set<members::email>; type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type When = S::When; type Email = S::Email; - type When = Set<members::when>; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); - ///Marker type for the `email` field - pub struct email(()); ///Marker type for the `when` field pub struct when(()); + ///Marker type for the `email` field + pub struct email(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -433,9 +433,9 @@ where impl<'a, S> SignatureBuilder<'a, S> where S: signature_state::State, - S::Name: signature_state::IsSet, - S::Email: signature_state::IsSet, S::When: signature_state::IsSet, + S::Email: signature_state::IsSet, + S::Name: signature_state::IsSet, { /// Build the final struct pub fn build(self) -> Signature<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/compare.rs b/crates/jacquard-api/src/sh_tangled/repo/compare.rs index e1a47481..da57063c 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/compare.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/compare.rs @@ -34,51 +34,51 @@ pub mod compare_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Rev1; - type Rev2; type Repo; + type Rev2; + type Rev1; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Rev1 = Unset; - type Rev2 = Unset; type Repo = Unset; + type Rev2 = Unset; + type Rev1 = Unset; } - ///State transition - sets the `rev1` field to Set - pub struct SetRev1<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRev1<S> {} - impl<S: State> State for SetRev1<S> { - type Rev1 = Set<members::rev1>; + ///State transition - sets the `repo` field to Set + pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRepo<S> {} + impl<S: State> State for SetRepo<S> { + type Repo = Set<members::repo>; type Rev2 = S::Rev2; - type Repo = S::Repo; + type Rev1 = S::Rev1; } ///State transition - sets the `rev2` field to Set pub struct SetRev2<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRev2<S> {} impl<S: State> State for SetRev2<S> { - type Rev1 = S::Rev1; - type Rev2 = Set<members::rev2>; type Repo = S::Repo; - } - ///State transition - sets the `repo` field to Set - pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRepo<S> {} - impl<S: State> State for SetRepo<S> { + type Rev2 = Set<members::rev2>; type Rev1 = S::Rev1; + } + ///State transition - sets the `rev1` field to Set + pub struct SetRev1<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRev1<S> {} + impl<S: State> State for SetRev1<S> { + type Repo = S::Repo; type Rev2 = S::Rev2; - type Repo = Set<members::repo>; + type Rev1 = Set<members::rev1>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `rev1` field - pub struct rev1(()); - ///Marker type for the `rev2` field - pub struct rev2(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `rev2` field + pub struct rev2(()); + ///Marker type for the `rev1` field + pub struct rev1(()); } } @@ -171,9 +171,9 @@ where impl<'a, S> CompareBuilder<'a, S> where S: compare_state::State, - S::Rev1: compare_state::IsSet, - S::Rev2: compare_state::IsSet, S::Repo: compare_state::IsSet, + S::Rev2: compare_state::IsSet, + S::Rev1: compare_state::IsSet, { /// Build the final struct pub fn build(self) -> Compare<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/delete.rs b/crates/jacquard-api/src/sh_tangled/repo/delete.rs index 1a6cc138..cf232421 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/delete.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/delete.rs @@ -38,49 +38,49 @@ pub mod delete_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Rkey; + type Did; type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Rkey = Unset; + type Did = Unset; type Name = Unset; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Rkey = S::Rkey; - type Name = S::Name; - } ///State transition - sets the `rkey` field to Set pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRkey<S> {} impl<S: State> State for SetRkey<S> { - type Did = S::Did; type Rkey = Set<members::rkey>; + type Did = S::Did; + type Name = S::Name; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Rkey = S::Rkey; + type Did = Set<members::did>; type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Did = S::Did; type Rkey = S::Rkey; + type Did = S::Did; type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `rkey` field pub struct rkey(()); + ///Marker type for the `did` field + pub struct did(()); ///Marker type for the `name` field pub struct name(()); } @@ -175,8 +175,8 @@ where impl<'a, S> DeleteBuilder<'a, S> where S: delete_state::State, - S::Did: delete_state::IsSet, S::Rkey: delete_state::IsSet, + S::Did: delete_state::IsSet, S::Name: delete_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/repo/fork_status.rs b/crates/jacquard-api/src/sh_tangled/repo/fork_status.rs index 650db34a..0e9a0ba9 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/fork_status.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/fork_status.rs @@ -44,85 +44,85 @@ pub mod fork_status_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; - type Branch; type HiddenRef; - type Source; + type Name; type Did; + type Source; + type Branch; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; - type Branch = Unset; type HiddenRef = Unset; - type Source = Unset; + type Name = Unset; type Did = Unset; + type Source = Unset; + type Branch = Unset; + } + ///State transition - sets the `hidden_ref` field to Set + pub struct SetHiddenRef<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHiddenRef<S> {} + impl<S: State> State for SetHiddenRef<S> { + type HiddenRef = Set<members::hidden_ref>; + type Name = S::Name; + type Did = S::Did; + type Source = S::Source; + type Branch = S::Branch; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Branch = S::Branch; type HiddenRef = S::HiddenRef; - type Source = S::Source; + type Name = Set<members::name>; type Did = S::Did; - } - ///State transition - sets the `branch` field to Set - pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBranch<S> {} - impl<S: State> State for SetBranch<S> { - type Name = S::Name; - type Branch = Set<members::branch>; - type HiddenRef = S::HiddenRef; type Source = S::Source; - type Did = S::Did; + type Branch = S::Branch; } - ///State transition - sets the `hidden_ref` field to Set - pub struct SetHiddenRef<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHiddenRef<S> {} - impl<S: State> State for SetHiddenRef<S> { + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type HiddenRef = S::HiddenRef; type Name = S::Name; - type Branch = S::Branch; - type HiddenRef = Set<members::hidden_ref>; + type Did = Set<members::did>; type Source = S::Source; - type Did = S::Did; + type Branch = S::Branch; } ///State transition - sets the `source` field to Set pub struct SetSource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSource<S> {} impl<S: State> State for SetSource<S> { - type Name = S::Name; - type Branch = S::Branch; type HiddenRef = S::HiddenRef; - type Source = Set<members::source>; - type Did = S::Did; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { type Name = S::Name; + type Did = S::Did; + type Source = Set<members::source>; type Branch = S::Branch; + } + ///State transition - sets the `branch` field to Set + pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBranch<S> {} + impl<S: State> State for SetBranch<S> { type HiddenRef = S::HiddenRef; + type Name = S::Name; + type Did = S::Did; type Source = S::Source; - type Did = Set<members::did>; + type Branch = Set<members::branch>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); - ///Marker type for the `branch` field - pub struct branch(()); ///Marker type for the `hidden_ref` field pub struct hidden_ref(()); - ///Marker type for the `source` field - pub struct source(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `source` field + pub struct source(()); + ///Marker type for the `branch` field + pub struct branch(()); } } @@ -255,11 +255,11 @@ where impl<'a, S> ForkStatusBuilder<'a, S> where S: fork_status_state::State, - S::Name: fork_status_state::IsSet, - S::Branch: fork_status_state::IsSet, S::HiddenRef: fork_status_state::IsSet, - S::Source: fork_status_state::IsSet, + S::Name: fork_status_state::IsSet, S::Did: fork_status_state::IsSet, + S::Source: fork_status_state::IsSet, + S::Branch: fork_status_state::IsSet, { /// Build the final struct pub fn build(self) -> ForkStatus<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/fork_sync.rs b/crates/jacquard-api/src/sh_tangled/repo/fork_sync.rs index 449b1349..4b624a97 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/fork_sync.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/fork_sync.rs @@ -42,66 +42,66 @@ pub mod fork_sync_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; + type Branch; type Name; type Source; - type Branch; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; + type Branch = Unset; type Name = Unset; type Source = Unset; - type Branch = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Did = Set<members::did>; + type Branch = S::Branch; + type Name = S::Name; + type Source = S::Source; + } + ///State transition - sets the `branch` field to Set + pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBranch<S> {} + impl<S: State> State for SetBranch<S> { + type Did = S::Did; + type Branch = Set<members::branch>; type Name = S::Name; type Source = S::Source; - type Branch = S::Branch; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type Did = S::Did; + type Branch = S::Branch; type Name = Set<members::name>; type Source = S::Source; - type Branch = S::Branch; } ///State transition - sets the `source` field to Set pub struct SetSource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSource<S> {} impl<S: State> State for SetSource<S> { type Did = S::Did; - type Name = S::Name; - type Source = Set<members::source>; type Branch = S::Branch; - } - ///State transition - sets the `branch` field to Set - pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBranch<S> {} - impl<S: State> State for SetBranch<S> { - type Did = S::Did; type Name = S::Name; - type Source = S::Source; - type Branch = Set<members::branch>; + type Source = Set<members::source>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `branch` field + pub struct branch(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `source` field pub struct source(()); - ///Marker type for the `branch` field - pub struct branch(()); } } @@ -215,9 +215,9 @@ impl<'a, S> ForkSyncBuilder<'a, S> where S: fork_sync_state::State, S::Did: fork_sync_state::IsSet, + S::Branch: fork_sync_state::IsSet, S::Name: fork_sync_state::IsSet, S::Source: fork_sync_state::IsSet, - S::Branch: fork_sync_state::IsSet, { /// Build the final struct pub fn build(self) -> ForkSync<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/get_default_branch.rs b/crates/jacquard-api/src/sh_tangled/repo/get_default_branch.rs index 7471f47d..b8094758 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/get_default_branch.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/get_default_branch.rs @@ -247,51 +247,51 @@ pub mod signature_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Email; type When; type Name; + type Email; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Email = Unset; type When = Unset; type Name = Unset; - } - ///State transition - sets the `email` field to Set - pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEmail<S> {} - impl<S: State> State for SetEmail<S> { - type Email = Set<members::email>; - type When = S::When; - type Name = S::Name; + type Email = Unset; } ///State transition - sets the `when` field to Set pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWhen<S> {} impl<S: State> State for SetWhen<S> { - type Email = S::Email; type When = Set<members::when>; type Name = S::Name; + type Email = S::Email; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Email = S::Email; type When = S::When; type Name = Set<members::name>; + type Email = S::Email; + } + ///State transition - sets the `email` field to Set + pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEmail<S> {} + impl<S: State> State for SetEmail<S> { + type When = S::When; + type Name = S::Name; + type Email = Set<members::email>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `email` field - pub struct email(()); ///Marker type for the `when` field pub struct when(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `email` field + pub struct email(()); } } @@ -384,9 +384,9 @@ where impl<'a, S> SignatureBuilder<'a, S> where S: signature_state::State, - S::Email: signature_state::IsSet, S::When: signature_state::IsSet, S::Name: signature_state::IsSet, + S::Email: signature_state::IsSet, { /// Build the final struct pub fn build(self) -> Signature<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/issue.rs b/crates/jacquard-api/src/sh_tangled/repo/issue.rs index d4d88483..ab5967be 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/issue.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/issue.rs @@ -47,50 +47,50 @@ pub mod issue_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Title; - type CreatedAt; type Repo; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Title = Unset; - type CreatedAt = Unset; type Repo = Unset; + type CreatedAt = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { type Title = Set<members::title>; - type CreatedAt = S::CreatedAt; - type Repo = S::Repo; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Title = S::Title; - type CreatedAt = Set<members::created_at>; type Repo = S::Repo; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { type Title = S::Title; - type CreatedAt = S::CreatedAt; type Repo = Set<members::repo>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Title = S::Title; + type Repo = S::Repo; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `title` field pub struct title(()); - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -241,8 +241,8 @@ impl<'a, S> IssueBuilder<'a, S> where S: issue_state::State, S::Title: issue_state::IsSet, - S::CreatedAt: issue_state::IsSet, S::Repo: issue_state::IsSet, + S::CreatedAt: issue_state::IsSet, { /// Build the final struct pub fn build(self) -> Issue<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/issue/comment.rs b/crates/jacquard-api/src/sh_tangled/repo/issue/comment.rs index 18c72566..a9ad4adb 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/issue/comment.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/issue/comment.rs @@ -43,51 +43,51 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Body; type CreatedAt; type Issue; + type Body; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Body = Unset; type CreatedAt = Unset; type Issue = Unset; - } - ///State transition - sets the `body` field to Set - pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBody<S> {} - impl<S: State> State for SetBody<S> { - type Body = Set<members::body>; - type CreatedAt = S::CreatedAt; - type Issue = S::Issue; + type Body = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Body = S::Body; type CreatedAt = Set<members::created_at>; type Issue = S::Issue; + type Body = S::Body; } ///State transition - sets the `issue` field to Set pub struct SetIssue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIssue<S> {} impl<S: State> State for SetIssue<S> { - type Body = S::Body; type CreatedAt = S::CreatedAt; type Issue = Set<members::issue>; + type Body = S::Body; + } + ///State transition - sets the `body` field to Set + pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBody<S> {} + impl<S: State> State for SetBody<S> { + type CreatedAt = S::CreatedAt; + type Issue = S::Issue; + type Body = Set<members::body>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `body` field - pub struct body(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `issue` field pub struct issue(()); + ///Marker type for the `body` field + pub struct body(()); } } @@ -240,9 +240,9 @@ impl<'a, S: comment_state::State> CommentBuilder<'a, S> { impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::Body: comment_state::IsSet, S::CreatedAt: comment_state::IsSet, S::Issue: comment_state::IsSet, + S::Body: comment_state::IsSet, { /// Build the final struct pub fn build(self) -> Comment<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/list_secrets.rs b/crates/jacquard-api/src/sh_tangled/repo/list_secrets.rs index 75b34f95..512f3cb5 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/list_secrets.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/list_secrets.rs @@ -184,67 +184,67 @@ pub mod secret_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; + type CreatedBy; type Key; type Repo; - type CreatedBy; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; + type CreatedBy = Unset; type Key = Unset; type Repo = Unset; - type CreatedBy = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type CreatedBy = S::CreatedBy; + type Key = S::Key; + type Repo = S::Repo; + } + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedBy<S> {} + impl<S: State> State for SetCreatedBy<S> { + type CreatedAt = S::CreatedAt; + type CreatedBy = Set<members::created_by>; + type Key = S::Key; + type Repo = S::Repo; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { + type CreatedAt = S::CreatedAt; + type CreatedBy = S::CreatedBy; type Key = Set<members::key>; type Repo = S::Repo; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Key = S::Key; - type Repo = Set<members::repo>; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedBy<S> {} - impl<S: State> State for SetCreatedBy<S> { - type Key = S::Key; - type Repo = S::Repo; - type CreatedBy = Set<members::created_by>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Key = S::Key; - type Repo = S::Repo; type CreatedBy = S::CreatedBy; - type CreatedAt = Set<members::created_at>; + type Key = S::Key; + type Repo = Set<members::repo>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `created_by` field + pub struct created_by(()); ///Marker type for the `key` field pub struct key(()); ///Marker type for the `repo` field pub struct repo(()); - ///Marker type for the `created_by` field - pub struct created_by(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -357,10 +357,10 @@ where impl<'a, S> SecretBuilder<'a, S> where S: secret_state::State, + S::CreatedAt: secret_state::IsSet, + S::CreatedBy: secret_state::IsSet, S::Key: secret_state::IsSet, S::Repo: secret_state::IsSet, - S::CreatedBy: secret_state::IsSet, - S::CreatedAt: secret_state::IsSet, { /// Build the final struct pub fn build(self) -> Secret<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/merge.rs b/crates/jacquard-api/src/sh_tangled/repo/merge.rs index f4693fa4..b554567c 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/merge.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/merge.rs @@ -58,66 +58,66 @@ pub mod merge_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Did; - type Branch; - type Name; type Patch; + type Name; + type Branch; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; - type Branch = Unset; - type Name = Unset; type Patch = Unset; + type Name = Unset; + type Branch = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Did = Set<members::did>; - type Branch = S::Branch; - type Name = S::Name; type Patch = S::Patch; + type Name = S::Name; + type Branch = S::Branch; } - ///State transition - sets the `branch` field to Set - pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBranch<S> {} - impl<S: State> State for SetBranch<S> { + ///State transition - sets the `patch` field to Set + pub struct SetPatch<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPatch<S> {} + impl<S: State> State for SetPatch<S> { type Did = S::Did; - type Branch = Set<members::branch>; + type Patch = Set<members::patch>; type Name = S::Name; - type Patch = S::Patch; + type Branch = S::Branch; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type Did = S::Did; - type Branch = S::Branch; - type Name = Set<members::name>; type Patch = S::Patch; + type Name = Set<members::name>; + type Branch = S::Branch; } - ///State transition - sets the `patch` field to Set - pub struct SetPatch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPatch<S> {} - impl<S: State> State for SetPatch<S> { + ///State transition - sets the `branch` field to Set + pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBranch<S> {} + impl<S: State> State for SetBranch<S> { type Did = S::Did; - type Branch = S::Branch; + type Patch = S::Patch; type Name = S::Name; - type Patch = Set<members::patch>; + type Branch = Set<members::branch>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `branch` field - pub struct branch(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `patch` field pub struct patch(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `branch` field + pub struct branch(()); } } @@ -311,9 +311,9 @@ impl<'a, S> MergeBuilder<'a, S> where S: merge_state::State, S::Did: merge_state::IsSet, - S::Branch: merge_state::IsSet, - S::Name: merge_state::IsSet, S::Patch: merge_state::IsSet, + S::Name: merge_state::IsSet, + S::Branch: merge_state::IsSet, { /// Build the final struct pub fn build(self) -> Merge<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/repo/merge_check.rs b/crates/jacquard-api/src/sh_tangled/repo/merge_check.rs index c20a2866..06e4b6c9 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/merge_check.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/merge_check.rs @@ -262,65 +262,65 @@ pub mod merge_check_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; - type Patch; type Did; + type Patch; + type Name; type Branch; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; - type Patch = Unset; type Did = Unset; + type Patch = Unset; + type Name = Unset; type Branch = Unset; } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Did = Set<members::did>; type Patch = S::Patch; - type Did = S::Did; + type Name = S::Name; type Branch = S::Branch; } ///State transition - sets the `patch` field to Set pub struct SetPatch<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPatch<S> {} impl<S: State> State for SetPatch<S> { - type Name = S::Name; - type Patch = Set<members::patch>; type Did = S::Did; + type Patch = Set<members::patch>; + type Name = S::Name; type Branch = S::Branch; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Name = S::Name; + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Did = S::Did; type Patch = S::Patch; - type Did = Set<members::did>; + type Name = Set<members::name>; type Branch = S::Branch; } ///State transition - sets the `branch` field to Set pub struct SetBranch<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBranch<S> {} impl<S: State> State for SetBranch<S> { - type Name = S::Name; - type Patch = S::Patch; type Did = S::Did; + type Patch = S::Patch; + type Name = S::Name; type Branch = Set<members::branch>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); - ///Marker type for the `patch` field - pub struct patch(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `patch` field + pub struct patch(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `branch` field pub struct branch(()); } @@ -435,9 +435,9 @@ where impl<'a, S> MergeCheckBuilder<'a, S> where S: merge_check_state::State, - S::Name: merge_check_state::IsSet, - S::Patch: merge_check_state::IsSet, S::Did: merge_check_state::IsSet, + S::Patch: merge_check_state::IsSet, + S::Name: merge_check_state::IsSet, S::Branch: merge_check_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/repo/pull.rs b/crates/jacquard-api/src/sh_tangled/repo/pull.rs index b4cd0fbf..4b3af44d 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/pull.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/pull.rs @@ -27,8 +27,13 @@ pub struct Pull<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub mentions: std::option::Option<Vec<jacquard_common::types::string::Did<'a>>>, + /// (deprecated) use patchBlob instead + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub patch: std::option::Option<jacquard_common::CowStr<'a>>, + /// patch content #[serde(borrow)] - pub patch: jacquard_common::CowStr<'a>, + pub patch_blob: jacquard_common::types::blob::BlobRef<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub references: std::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, @@ -51,8 +56,8 @@ pub mod pull_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Patch; type Title; + type PatchBlob; type CreatedAt; type Target; } @@ -60,26 +65,26 @@ pub mod pull_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Patch = Unset; type Title = Unset; + type PatchBlob = Unset; type CreatedAt = Unset; type Target = Unset; } - ///State transition - sets the `patch` field to Set - pub struct SetPatch<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPatch<S> {} - impl<S: State> State for SetPatch<S> { - type Patch = Set<members::patch>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - type Target = S::Target; - } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Patch = S::Patch; type Title = Set<members::title>; + type PatchBlob = S::PatchBlob; + type CreatedAt = S::CreatedAt; + type Target = S::Target; + } + ///State transition - sets the `patch_blob` field to Set + pub struct SetPatchBlob<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPatchBlob<S> {} + impl<S: State> State for SetPatchBlob<S> { + type Title = S::Title; + type PatchBlob = Set<members::patch_blob>; type CreatedAt = S::CreatedAt; type Target = S::Target; } @@ -87,8 +92,8 @@ pub mod pull_state { pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Patch = S::Patch; type Title = S::Title; + type PatchBlob = S::PatchBlob; type CreatedAt = Set<members::created_at>; type Target = S::Target; } @@ -96,18 +101,18 @@ pub mod pull_state { pub struct SetTarget<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTarget<S> {} impl<S: State> State for SetTarget<S> { - type Patch = S::Patch; type Title = S::Title; + type PatchBlob = S::PatchBlob; type CreatedAt = S::CreatedAt; type Target = Set<members::target>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `patch` field - pub struct patch(()); ///Marker type for the `title` field pub struct title(()); + ///Marker type for the `patch_blob` field + pub struct patch_blob(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `target` field @@ -123,6 +128,7 @@ pub struct PullBuilder<'a, S: pull_state::State> { ::core::option::Option<jacquard_common::types::string::Datetime>, ::core::option::Option<Vec<jacquard_common::types::string::Did<'a>>>, ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, ::core::option::Option<Vec<jacquard_common::types::string::AtUri<'a>>>, ::core::option::Option<crate::sh_tangled::repo::pull::Source<'a>>, ::core::option::Option<crate::sh_tangled::repo::pull::Target<'a>>, @@ -143,7 +149,17 @@ impl<'a> PullBuilder<'a, pull_state::Empty> { pub fn new() -> Self { PullBuilder { _phantom_state: ::core::marker::PhantomData, - __unsafe_private_named: (None, None, None, None, None, None, None, None), + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), _phantom: ::core::marker::PhantomData, } } @@ -203,17 +219,33 @@ impl<'a, S: pull_state::State> PullBuilder<'a, S> { } } +impl<'a, S: pull_state::State> PullBuilder<'a, S> { + /// Set the `patch` field (optional) + pub fn patch( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `patch` field to an Option value (optional) + pub fn maybe_patch(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + impl<'a, S> PullBuilder<'a, S> where S: pull_state::State, - S::Patch: pull_state::IsUnset, + S::PatchBlob: pull_state::IsUnset, { - /// Set the `patch` field (required) - pub fn patch( + /// Set the `patchBlob` field (required) + pub fn patch_blob( mut self, - value: impl Into<jacquard_common::CowStr<'a>>, - ) -> PullBuilder<'a, pull_state::SetPatch<S>> { - self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + value: impl Into<jacquard_common::types::blob::BlobRef<'a>>, + ) -> PullBuilder<'a, pull_state::SetPatchBlob<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); PullBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -228,7 +260,7 @@ impl<'a, S: pull_state::State> PullBuilder<'a, S> { mut self, value: impl Into<Option<Vec<jacquard_common::types::string::AtUri<'a>>>>, ) -> Self { - self.__unsafe_private_named.4 = value.into(); + self.__unsafe_private_named.5 = value.into(); self } /// Set the `references` field to an Option value (optional) @@ -236,7 +268,7 @@ impl<'a, S: pull_state::State> PullBuilder<'a, S> { mut self, value: Option<Vec<jacquard_common::types::string::AtUri<'a>>>, ) -> Self { - self.__unsafe_private_named.4 = value; + self.__unsafe_private_named.5 = value; self } } @@ -247,7 +279,7 @@ impl<'a, S: pull_state::State> PullBuilder<'a, S> { mut self, value: impl Into<Option<crate::sh_tangled::repo::pull::Source<'a>>>, ) -> Self { - self.__unsafe_private_named.5 = value.into(); + self.__unsafe_private_named.6 = value.into(); self } /// Set the `source` field to an Option value (optional) @@ -255,7 +287,7 @@ impl<'a, S: pull_state::State> PullBuilder<'a, S> { mut self, value: Option<crate::sh_tangled::repo::pull::Source<'a>>, ) -> Self { - self.__unsafe_private_named.5 = value; + self.__unsafe_private_named.6 = value; self } } @@ -270,7 +302,7 @@ where mut self, value: impl Into<crate::sh_tangled::repo::pull::Target<'a>>, ) -> PullBuilder<'a, pull_state::SetTarget<S>> { - self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); + self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); PullBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -289,7 +321,7 @@ where mut self, value: impl Into<jacquard_common::CowStr<'a>>, ) -> PullBuilder<'a, pull_state::SetTitle<S>> { - self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); + self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); PullBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, @@ -301,8 +333,8 @@ where impl<'a, S> PullBuilder<'a, S> where S: pull_state::State, - S::Patch: pull_state::IsSet, S::Title: pull_state::IsSet, + S::PatchBlob: pull_state::IsSet, S::CreatedAt: pull_state::IsSet, S::Target: pull_state::IsSet, { @@ -312,11 +344,12 @@ where body: self.__unsafe_private_named.0, created_at: self.__unsafe_private_named.1.unwrap(), mentions: self.__unsafe_private_named.2, - patch: self.__unsafe_private_named.3.unwrap(), - references: self.__unsafe_private_named.4, - source: self.__unsafe_private_named.5, - target: self.__unsafe_private_named.6.unwrap(), - title: self.__unsafe_private_named.7.unwrap(), + patch: self.__unsafe_private_named.3, + patch_blob: self.__unsafe_private_named.4.unwrap(), + references: self.__unsafe_private_named.5, + source: self.__unsafe_private_named.6, + target: self.__unsafe_private_named.7.unwrap(), + title: self.__unsafe_private_named.8.unwrap(), extra_data: Default::default(), } } @@ -332,11 +365,12 @@ where body: self.__unsafe_private_named.0, created_at: self.__unsafe_private_named.1.unwrap(), mentions: self.__unsafe_private_named.2, - patch: self.__unsafe_private_named.3.unwrap(), - references: self.__unsafe_private_named.4, - source: self.__unsafe_private_named.5, - target: self.__unsafe_private_named.6.unwrap(), - title: self.__unsafe_private_named.7.unwrap(), + patch: self.__unsafe_private_named.3, + patch_blob: self.__unsafe_private_named.4.unwrap(), + references: self.__unsafe_private_named.5, + source: self.__unsafe_private_named.6, + target: self.__unsafe_private_named.7.unwrap(), + title: self.__unsafe_private_named.8.unwrap(), extra_data: Some(extra_data), } } @@ -441,7 +475,7 @@ fn lexicon_doc_sh_tangled_repo_pull() -> ::jacquard_lexicon::lexicon::LexiconDoc vec![ ::jacquard_common::smol_str::SmolStr::new_static("target"), ::jacquard_common::smol_str::SmolStr::new_static("title"), - ::jacquard_common::smol_str::SmolStr::new_static("patch"), + ::jacquard_common::smol_str::SmolStr::new_static("patchBlob"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt") ], ), @@ -510,7 +544,11 @@ fn lexicon_doc_sh_tangled_repo_pull() -> ::jacquard_lexicon::lexicon::LexiconDoc map.insert( ::jacquard_common::smol_str::SmolStr::new_static("patch"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "(deprecated) use patchBlob instead", + ), + ), format: None, default: None, min_length: None, @@ -522,6 +560,16 @@ fn lexicon_doc_sh_tangled_repo_pull() -> ::jacquard_lexicon::lexicon::LexiconDoc known_values: None, }), ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "patchBlob", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "references", diff --git a/crates/jacquard-api/src/sh_tangled/repo/pull/comment.rs b/crates/jacquard-api/src/sh_tangled/repo/pull/comment.rs index e6ad6a92..46190f15 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/pull/comment.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/pull/comment.rs @@ -40,49 +40,49 @@ pub mod comment_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Body; type CreatedAt; + type Body; type Pull; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Body = Unset; type CreatedAt = Unset; + type Body = Unset; type Pull = Unset; } - ///State transition - sets the `body` field to Set - pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBody<S> {} - impl<S: State> State for SetBody<S> { - type Body = Set<members::body>; - type CreatedAt = S::CreatedAt; - type Pull = S::Pull; - } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Body = S::Body; type CreatedAt = Set<members::created_at>; + type Body = S::Body; + type Pull = S::Pull; + } + ///State transition - sets the `body` field to Set + pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBody<S> {} + impl<S: State> State for SetBody<S> { + type CreatedAt = S::CreatedAt; + type Body = Set<members::body>; type Pull = S::Pull; } ///State transition - sets the `pull` field to Set pub struct SetPull<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPull<S> {} impl<S: State> State for SetPull<S> { - type Body = S::Body; type CreatedAt = S::CreatedAt; + type Body = S::Body; type Pull = Set<members::pull>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `body` field - pub struct body(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `body` field + pub struct body(()); ///Marker type for the `pull` field pub struct pull(()); } @@ -217,8 +217,8 @@ impl<'a, S: comment_state::State> CommentBuilder<'a, S> { impl<'a, S> CommentBuilder<'a, S> where S: comment_state::State, - S::Body: comment_state::IsSet, S::CreatedAt: comment_state::IsSet, + S::Body: comment_state::IsSet, S::Pull: comment_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/repo/tree.rs b/crates/jacquard-api/src/sh_tangled/repo/tree.rs index e7db7962..db88bba1 100644 --- a/crates/jacquard-api/src/sh_tangled/repo/tree.rs +++ b/crates/jacquard-api/src/sh_tangled/repo/tree.rs @@ -37,51 +37,51 @@ pub mod last_commit_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type When; - type Message; type Hash; + type Message; + type When; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type When = Unset; - type Message = Unset; type Hash = Unset; + type Message = Unset; + type When = Unset; } - ///State transition - sets the `when` field to Set - pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWhen<S> {} - impl<S: State> State for SetWhen<S> { - type When = Set<members::when>; + ///State transition - sets the `hash` field to Set + pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHash<S> {} + impl<S: State> State for SetHash<S> { + type Hash = Set<members::hash>; type Message = S::Message; - type Hash = S::Hash; + type When = S::When; } ///State transition - sets the `message` field to Set pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMessage<S> {} impl<S: State> State for SetMessage<S> { - type When = S::When; - type Message = Set<members::message>; type Hash = S::Hash; - } - ///State transition - sets the `hash` field to Set - pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHash<S> {} - impl<S: State> State for SetHash<S> { + type Message = Set<members::message>; type When = S::When; + } + ///State transition - sets the `when` field to Set + pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWhen<S> {} + impl<S: State> State for SetWhen<S> { + type Hash = S::Hash; type Message = S::Message; - type Hash = Set<members::hash>; + type When = Set<members::when>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `when` field - pub struct when(()); - ///Marker type for the `message` field - pub struct message(()); ///Marker type for the `hash` field pub struct hash(()); + ///Marker type for the `message` field + pub struct message(()); + ///Marker type for the `when` field + pub struct when(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> LastCommitBuilder<'a, S> where S: last_commit_state::State, - S::When: last_commit_state::IsSet, - S::Message: last_commit_state::IsSet, S::Hash: last_commit_state::IsSet, + S::Message: last_commit_state::IsSet, + S::When: last_commit_state::IsSet, { /// Build the final struct pub fn build(self) -> LastCommit<'a> { @@ -879,49 +879,49 @@ pub mod tree_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Size; type Mode; + type Size; type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Size = Unset; type Mode = Unset; + type Size = Unset; type Name = Unset; } - ///State transition - sets the `size` field to Set - pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSize<S> {} - impl<S: State> State for SetSize<S> { - type Size = Set<members::size>; - type Mode = S::Mode; - type Name = S::Name; - } ///State transition - sets the `mode` field to Set pub struct SetMode<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMode<S> {} impl<S: State> State for SetMode<S> { - type Size = S::Size; type Mode = Set<members::mode>; + type Size = S::Size; + type Name = S::Name; + } + ///State transition - sets the `size` field to Set + pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSize<S> {} + impl<S: State> State for SetSize<S> { + type Mode = S::Mode; + type Size = Set<members::size>; type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Size = S::Size; type Mode = S::Mode; + type Size = S::Size; type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `size` field - pub struct size(()); ///Marker type for the `mode` field pub struct mode(()); + ///Marker type for the `size` field + pub struct size(()); ///Marker type for the `name` field pub struct name(()); } @@ -1036,8 +1036,8 @@ where impl<'a, S> TreeEntryBuilder<'a, S> where S: tree_entry_state::State, - S::Size: tree_entry_state::IsSet, S::Mode: tree_entry_state::IsSet, + S::Size: tree_entry_state::IsSet, S::Name: tree_entry_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_tangled/spindle/member.rs b/crates/jacquard-api/src/sh_tangled/spindle/member.rs index 700169a8..4c84ab73 100644 --- a/crates/jacquard-api/src/sh_tangled/spindle/member.rs +++ b/crates/jacquard-api/src/sh_tangled/spindle/member.rs @@ -35,51 +35,51 @@ pub mod member_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; type Instance; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; type Instance = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; - type Instance = S::Instance; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; type Instance = S::Instance; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `instance` field to Set pub struct SetInstance<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetInstance<S> {} impl<S: State> State for SetInstance<S> { - type CreatedAt = S::CreatedAt; type Subject = S::Subject; type Instance = Set<members::instance>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type Instance = S::Instance; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `instance` field pub struct instance(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -172,9 +172,9 @@ where impl<'a, S> MemberBuilder<'a, S> where S: member_state::State, - S::CreatedAt: member_state::IsSet, S::Subject: member_state::IsSet, S::Instance: member_state::IsSet, + S::CreatedAt: member_state::IsSet, { /// Build the final struct pub fn build(self) -> Member<'a> { diff --git a/crates/jacquard-api/src/sh_tangled/string.rs b/crates/jacquard-api/src/sh_tangled/string.rs index bf2fb988..28122572 100644 --- a/crates/jacquard-api/src/sh_tangled/string.rs +++ b/crates/jacquard-api/src/sh_tangled/string.rs @@ -37,8 +37,8 @@ pub mod tangled_string_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Contents; - type Filename; type Description; + type Filename; type CreatedAt; } /// Empty state - all required fields are unset @@ -46,8 +46,8 @@ pub mod tangled_string_state { impl sealed::Sealed for Empty {} impl State for Empty { type Contents = Unset; - type Filename = Unset; type Description = Unset; + type Filename = Unset; type CreatedAt = Unset; } ///State transition - sets the `contents` field to Set @@ -55,17 +55,8 @@ pub mod tangled_string_state { impl<S: State> sealed::Sealed for SetContents<S> {} impl<S: State> State for SetContents<S> { type Contents = Set<members::contents>; - type Filename = S::Filename; - type Description = S::Description; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `filename` field to Set - pub struct SetFilename<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFilename<S> {} - impl<S: State> State for SetFilename<S> { - type Contents = S::Contents; - type Filename = Set<members::filename>; type Description = S::Description; + type Filename = S::Filename; type CreatedAt = S::CreatedAt; } ///State transition - sets the `description` field to Set @@ -73,8 +64,17 @@ pub mod tangled_string_state { impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { type Contents = S::Contents; - type Filename = S::Filename; type Description = Set<members::description>; + type Filename = S::Filename; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `filename` field to Set + pub struct SetFilename<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFilename<S> {} + impl<S: State> State for SetFilename<S> { + type Contents = S::Contents; + type Description = S::Description; + type Filename = Set<members::filename>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set @@ -82,8 +82,8 @@ pub mod tangled_string_state { impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Contents = S::Contents; - type Filename = S::Filename; type Description = S::Description; + type Filename = S::Filename; type CreatedAt = Set<members::created_at>; } /// Marker types for field names @@ -91,10 +91,10 @@ pub mod tangled_string_state { pub mod members { ///Marker type for the `contents` field pub struct contents(()); - ///Marker type for the `filename` field - pub struct filename(()); ///Marker type for the `description` field pub struct description(()); + ///Marker type for the `filename` field + pub struct filename(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -210,8 +210,8 @@ impl<'a, S> TangledStringBuilder<'a, S> where S: tangled_string_state::State, S::Contents: tangled_string_state::IsSet, - S::Filename: tangled_string_state::IsSet, S::Description: tangled_string_state::IsSet, + S::Filename: tangled_string_state::IsSet, S::CreatedAt: tangled_string_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_weaver/actor.rs b/crates/jacquard-api/src/sh_weaver/actor.rs index ae21bf19..cfa1fb0c 100644 --- a/crates/jacquard-api/src/sh_weaver/actor.rs +++ b/crates/jacquard-api/src/sh_weaver/actor.rs @@ -1979,37 +1979,37 @@ pub mod profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Handle = S::Handle; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type Did = S::Did; type Handle = Set<members::handle>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Handle = S::Handle; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -2388,8 +2388,8 @@ impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> { impl<'a, S> ProfileViewBuilder<'a, S> where S: profile_view_state::State, - S::Did: profile_view_state::IsSet, S::Handle: profile_view_state::IsSet, + S::Did: profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileView<'a> { @@ -2623,37 +2623,37 @@ pub mod profile_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Handle = S::Handle; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type Did = S::Did; type Handle = Set<members::handle>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Handle = S::Handle; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -2846,8 +2846,8 @@ impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> { impl<'a, S> ProfileViewBasicBuilder<'a, S> where S: profile_view_basic_state::State, - S::Did: profile_view_basic_state::IsSet, S::Handle: profile_view_basic_state::IsSet, + S::Did: profile_view_basic_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileViewBasic<'a> { @@ -3166,51 +3166,51 @@ pub mod tangled_profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Handle; type Did; type Bluesky; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Handle = Unset; type Did = Unset; type Bluesky = Unset; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type Handle = Set<members::handle>; - type Did = S::Did; - type Bluesky = S::Bluesky; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Handle = S::Handle; type Did = Set<members::did>; type Bluesky = S::Bluesky; + type Handle = S::Handle; } ///State transition - sets the `bluesky` field to Set pub struct SetBluesky<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBluesky<S> {} impl<S: State> State for SetBluesky<S> { - type Handle = S::Handle; type Did = S::Did; type Bluesky = Set<members::bluesky>; + type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { + type Did = S::Did; + type Bluesky = S::Bluesky; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `bluesky` field pub struct bluesky(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -3400,9 +3400,9 @@ impl<'a, S: tangled_profile_view_state::State> TangledProfileViewBuilder<'a, S> impl<'a, S> TangledProfileViewBuilder<'a, S> where S: tangled_profile_view_state::State, - S::Handle: tangled_profile_view_state::IsSet, S::Did: tangled_profile_view_state::IsSet, S::Bluesky: tangled_profile_view_state::IsSet, + S::Handle: tangled_profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TangledProfileView<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/collab.rs b/crates/jacquard-api/src/sh_weaver/collab.rs index 78979b46..03959956 100644 --- a/crates/jacquard-api/src/sh_weaver/collab.rs +++ b/crates/jacquard-api/src/sh_weaver/collab.rs @@ -1612,8 +1612,8 @@ pub mod former_collaborator_view_state { pub trait State: sealed::Sealed { type EndReason; type WasActiveUntil; - type User; type WasActiveFrom; + type User; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -1621,8 +1621,8 @@ pub mod former_collaborator_view_state { impl State for Empty { type EndReason = Unset; type WasActiveUntil = Unset; - type User = Unset; type WasActiveFrom = Unset; + type User = Unset; } ///State transition - sets the `end_reason` field to Set pub struct SetEndReason<S: State = Empty>(PhantomData<fn() -> S>); @@ -1630,8 +1630,8 @@ pub mod former_collaborator_view_state { impl<S: State> State for SetEndReason<S> { type EndReason = Set<members::end_reason>; type WasActiveUntil = S::WasActiveUntil; - type User = S::User; type WasActiveFrom = S::WasActiveFrom; + type User = S::User; } ///State transition - sets the `was_active_until` field to Set pub struct SetWasActiveUntil<S: State = Empty>(PhantomData<fn() -> S>); @@ -1639,17 +1639,8 @@ pub mod former_collaborator_view_state { impl<S: State> State for SetWasActiveUntil<S> { type EndReason = S::EndReason; type WasActiveUntil = Set<members::was_active_until>; - type User = S::User; - type WasActiveFrom = S::WasActiveFrom; - } - ///State transition - sets the `user` field to Set - pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUser<S> {} - impl<S: State> State for SetUser<S> { - type EndReason = S::EndReason; - type WasActiveUntil = S::WasActiveUntil; - type User = Set<members::user>; type WasActiveFrom = S::WasActiveFrom; + type User = S::User; } ///State transition - sets the `was_active_from` field to Set pub struct SetWasActiveFrom<S: State = Empty>(PhantomData<fn() -> S>); @@ -1657,8 +1648,17 @@ pub mod former_collaborator_view_state { impl<S: State> State for SetWasActiveFrom<S> { type EndReason = S::EndReason; type WasActiveUntil = S::WasActiveUntil; - type User = S::User; type WasActiveFrom = Set<members::was_active_from>; + type User = S::User; + } + ///State transition - sets the `user` field to Set + pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUser<S> {} + impl<S: State> State for SetUser<S> { + type EndReason = S::EndReason; + type WasActiveUntil = S::WasActiveUntil; + type WasActiveFrom = S::WasActiveFrom; + type User = Set<members::user>; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -1667,10 +1667,10 @@ pub mod former_collaborator_view_state { pub struct end_reason(()); ///Marker type for the `was_active_until` field pub struct was_active_until(()); - ///Marker type for the `user` field - pub struct user(()); ///Marker type for the `was_active_from` field pub struct was_active_from(()); + ///Marker type for the `user` field + pub struct user(()); } } @@ -1845,8 +1845,8 @@ where S: former_collaborator_view_state::State, S::EndReason: former_collaborator_view_state::IsSet, S::WasActiveUntil: former_collaborator_view_state::IsSet, - S::User: former_collaborator_view_state::IsSet, S::WasActiveFrom: former_collaborator_view_state::IsSet, + S::User: former_collaborator_view_state::IsSet, { /// Build the final struct pub fn build(self) -> FormerCollaboratorView<'a> { @@ -2061,127 +2061,127 @@ pub mod invite_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; - type CreatedAt; - type Inviter; - type Uri; type Cid; type Invitee; type Resource; + type Uri; + type CreatedAt; + type Inviter; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; - type CreatedAt = Unset; - type Inviter = Unset; - type Uri = Unset; type Cid = Unset; type Invitee = Unset; type Resource = Unset; + type Uri = Unset; + type CreatedAt = Unset; + type Inviter = Unset; + type Status = Unset; } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; + type Invitee = S::Invitee; + type Resource = S::Resource; + type Uri = S::Uri; type CreatedAt = S::CreatedAt; type Inviter = S::Inviter; + type Status = S::Status; + } + ///State transition - sets the `invitee` field to Set + pub struct SetInvitee<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetInvitee<S> {} + impl<S: State> State for SetInvitee<S> { + type Cid = S::Cid; + type Invitee = Set<members::invitee>; + type Resource = S::Resource; type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + type Inviter = S::Inviter; + type Status = S::Status; + } + ///State transition - sets the `resource` field to Set + pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetResource<S> {} + impl<S: State> State for SetResource<S> { + type Cid = S::Cid; + type Invitee = S::Invitee; + type Resource = Set<members::resource>; + type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + type Inviter = S::Inviter; + type Status = S::Status; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Cid = S::Cid; type Invitee = S::Invitee; type Resource = S::Resource; + type Uri = Set<members::uri>; + type CreatedAt = S::CreatedAt; + type Inviter = S::Inviter; + type Status = S::Status; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Status = S::Status; - type CreatedAt = Set<members::created_at>; - type Inviter = S::Inviter; - type Uri = S::Uri; type Cid = S::Cid; type Invitee = S::Invitee; type Resource = S::Resource; + type Uri = S::Uri; + type CreatedAt = Set<members::created_at>; + type Inviter = S::Inviter; + type Status = S::Status; } ///State transition - sets the `inviter` field to Set pub struct SetInviter<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetInviter<S> {} impl<S: State> State for SetInviter<S> { - type Status = S::Status; - type CreatedAt = S::CreatedAt; - type Inviter = Set<members::inviter>; - type Uri = S::Uri; type Cid = S::Cid; type Invitee = S::Invitee; type Resource = S::Resource; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Status = S::Status; + type Uri = S::Uri; type CreatedAt = S::CreatedAt; - type Inviter = S::Inviter; - type Uri = Set<members::uri>; - type Cid = S::Cid; - type Invitee = S::Invitee; - type Resource = S::Resource; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + type Inviter = Set<members::inviter>; type Status = S::Status; - type CreatedAt = S::CreatedAt; - type Inviter = S::Inviter; - type Uri = S::Uri; - type Cid = Set<members::cid>; - type Invitee = S::Invitee; - type Resource = S::Resource; } - ///State transition - sets the `invitee` field to Set - pub struct SetInvitee<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetInvitee<S> {} - impl<S: State> State for SetInvitee<S> { - type Status = S::Status; - type CreatedAt = S::CreatedAt; - type Inviter = S::Inviter; - type Uri = S::Uri; + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { type Cid = S::Cid; - type Invitee = Set<members::invitee>; + type Invitee = S::Invitee; type Resource = S::Resource; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetResource<S> {} - impl<S: State> State for SetResource<S> { - type Status = S::Status; + type Uri = S::Uri; type CreatedAt = S::CreatedAt; type Inviter = S::Inviter; - type Uri = S::Uri; - type Cid = S::Cid; - type Invitee = S::Invitee; - type Resource = Set<members::resource>; + type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `inviter` field - pub struct inviter(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `invitee` field pub struct invitee(()); ///Marker type for the `resource` field pub struct resource(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `inviter` field + pub struct inviter(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -2479,13 +2479,13 @@ where impl<'a, S> InviteViewBuilder<'a, S> where S: invite_view_state::State, - S::Status: invite_view_state::IsSet, - S::CreatedAt: invite_view_state::IsSet, - S::Inviter: invite_view_state::IsSet, - S::Uri: invite_view_state::IsSet, S::Cid: invite_view_state::IsSet, S::Invitee: invite_view_state::IsSet, S::Resource: invite_view_state::IsSet, + S::Uri: invite_view_state::IsSet, + S::CreatedAt: invite_view_state::IsSet, + S::Inviter: invite_view_state::IsSet, + S::Status: invite_view_state::IsSet, { /// Build the final struct pub fn build(self) -> InviteView<'a> { @@ -2821,51 +2821,51 @@ pub mod participant_state_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type User; type Status; type Role; - type User; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type User = Unset; type Status = Unset; type Role = Unset; - type User = Unset; + } + ///State transition - sets the `user` field to Set + pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUser<S> {} + impl<S: State> State for SetUser<S> { + type User = Set<members::user>; + type Status = S::Status; + type Role = S::Role; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { + type User = S::User; type Status = Set<members::status>; type Role = S::Role; - type User = S::User; } ///State transition - sets the `role` field to Set pub struct SetRole<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRole<S> {} impl<S: State> State for SetRole<S> { - type Status = S::Status; - type Role = Set<members::role>; type User = S::User; - } - ///State transition - sets the `user` field to Set - pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUser<S> {} - impl<S: State> State for SetUser<S> { type Status = S::Status; - type Role = S::Role; - type User = Set<members::user>; + type Role = Set<members::role>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `user` field + pub struct user(()); ///Marker type for the `status` field pub struct status(()); ///Marker type for the `role` field pub struct role(()); - ///Marker type for the `user` field - pub struct user(()); } } @@ -3127,9 +3127,9 @@ impl<'a, S: participant_state_view_state::State> ParticipantStateViewBuilder<'a, impl<'a, S> ParticipantStateViewBuilder<'a, S> where S: participant_state_view_state::State, + S::User: participant_state_view_state::IsSet, S::Status: participant_state_view_state::IsSet, S::Role: participant_state_view_state::IsSet, - S::User: participant_state_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ParticipantStateView<'a> { @@ -3543,85 +3543,85 @@ pub mod session_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NodeId; - type Resource; - type Uri; type User; + type Uri; + type NodeId; type CreatedAt; + type Resource; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NodeId = Unset; - type Resource = Unset; - type Uri = Unset; type User = Unset; + type Uri = Unset; + type NodeId = Unset; type CreatedAt = Unset; + type Resource = Unset; } - ///State transition - sets the `node_id` field to Set - pub struct SetNodeId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNodeId<S> {} - impl<S: State> State for SetNodeId<S> { - type NodeId = Set<members::node_id>; - type Resource = S::Resource; + ///State transition - sets the `user` field to Set + pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUser<S> {} + impl<S: State> State for SetUser<S> { + type User = Set<members::user>; type Uri = S::Uri; - type User = S::User; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetResource<S> {} - impl<S: State> State for SetResource<S> { type NodeId = S::NodeId; - type Resource = Set<members::resource>; - type Uri = S::Uri; - type User = S::User; type CreatedAt = S::CreatedAt; + type Resource = S::Resource; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type NodeId = S::NodeId; - type Resource = S::Resource; - type Uri = Set<members::uri>; type User = S::User; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `user` field to Set - pub struct SetUser<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUser<S> {} - impl<S: State> State for SetUser<S> { + type Uri = Set<members::uri>; type NodeId = S::NodeId; + type CreatedAt = S::CreatedAt; type Resource = S::Resource; + } + ///State transition - sets the `node_id` field to Set + pub struct SetNodeId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNodeId<S> {} + impl<S: State> State for SetNodeId<S> { + type User = S::User; type Uri = S::Uri; - type User = Set<members::user>; + type NodeId = Set<members::node_id>; type CreatedAt = S::CreatedAt; + type Resource = S::Resource; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type User = S::User; + type Uri = S::Uri; type NodeId = S::NodeId; + type CreatedAt = Set<members::created_at>; type Resource = S::Resource; - type Uri = S::Uri; + } + ///State transition - sets the `resource` field to Set + pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetResource<S> {} + impl<S: State> State for SetResource<S> { type User = S::User; - type CreatedAt = Set<members::created_at>; + type Uri = S::Uri; + type NodeId = S::NodeId; + type CreatedAt = S::CreatedAt; + type Resource = Set<members::resource>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `node_id` field - pub struct node_id(()); - ///Marker type for the `resource` field - pub struct resource(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `user` field pub struct user(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `node_id` field + pub struct node_id(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `resource` field + pub struct resource(()); } } @@ -3794,11 +3794,11 @@ where impl<'a, S> SessionViewBuilder<'a, S> where S: session_view_state::State, - S::NodeId: session_view_state::IsSet, - S::Resource: session_view_state::IsSet, - S::Uri: session_view_state::IsSet, S::User: session_view_state::IsSet, + S::Uri: session_view_state::IsSet, + S::NodeId: session_view_state::IsSet, S::CreatedAt: session_view_state::IsSet, + S::Resource: session_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SessionView<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/collab/accept.rs b/crates/jacquard-api/src/sh_weaver/collab/accept.rs index b7e6103d..34260ebf 100644 --- a/crates/jacquard-api/src/sh_weaver/collab/accept.rs +++ b/crates/jacquard-api/src/sh_weaver/collab/accept.rs @@ -37,51 +37,51 @@ pub mod accept_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Resource; type CreatedAt; type Invite; - type Resource; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Resource = Unset; type CreatedAt = Unset; type Invite = Unset; - type Resource = Unset; + } + ///State transition - sets the `resource` field to Set + pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetResource<S> {} + impl<S: State> State for SetResource<S> { + type Resource = Set<members::resource>; + type CreatedAt = S::CreatedAt; + type Invite = S::Invite; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Resource = S::Resource; type CreatedAt = Set<members::created_at>; type Invite = S::Invite; - type Resource = S::Resource; } ///State transition - sets the `invite` field to Set pub struct SetInvite<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetInvite<S> {} impl<S: State> State for SetInvite<S> { - type CreatedAt = S::CreatedAt; - type Invite = Set<members::invite>; type Resource = S::Resource; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetResource<S> {} - impl<S: State> State for SetResource<S> { type CreatedAt = S::CreatedAt; - type Invite = S::Invite; - type Resource = Set<members::resource>; + type Invite = Set<members::invite>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `resource` field + pub struct resource(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `invite` field pub struct invite(()); - ///Marker type for the `resource` field - pub struct resource(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> AcceptBuilder<'a, S> where S: accept_state::State, + S::Resource: accept_state::IsSet, S::CreatedAt: accept_state::IsSet, S::Invite: accept_state::IsSet, - S::Resource: accept_state::IsSet, { /// Build the final struct pub fn build(self) -> Accept<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/collab/invite.rs b/crates/jacquard-api/src/sh_weaver/collab/invite.rs index 26802df2..ef516615 100644 --- a/crates/jacquard-api/src/sh_weaver/collab/invite.rs +++ b/crates/jacquard-api/src/sh_weaver/collab/invite.rs @@ -140,51 +140,51 @@ pub mod invite_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Invitee; type Resource; type CreatedAt; - type Invitee; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Invitee = Unset; type Resource = Unset; type CreatedAt = Unset; - type Invitee = Unset; + } + ///State transition - sets the `invitee` field to Set + pub struct SetInvitee<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetInvitee<S> {} + impl<S: State> State for SetInvitee<S> { + type Invitee = Set<members::invitee>; + type Resource = S::Resource; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `resource` field to Set pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetResource<S> {} impl<S: State> State for SetResource<S> { + type Invitee = S::Invitee; type Resource = Set<members::resource>; type CreatedAt = S::CreatedAt; - type Invitee = S::Invitee; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Resource = S::Resource; - type CreatedAt = Set<members::created_at>; type Invitee = S::Invitee; - } - ///State transition - sets the `invitee` field to Set - pub struct SetInvitee<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetInvitee<S> {} - impl<S: State> State for SetInvitee<S> { type Resource = S::Resource; - type CreatedAt = S::CreatedAt; - type Invitee = Set<members::invitee>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `invitee` field + pub struct invitee(()); ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `invitee` field - pub struct invitee(()); } } @@ -334,9 +334,9 @@ impl<'a, S: invite_state::State> InviteBuilder<'a, S> { impl<'a, S> InviteBuilder<'a, S> where S: invite_state::State, + S::Invitee: invite_state::IsSet, S::Resource: invite_state::IsSet, S::CreatedAt: invite_state::IsSet, - S::Invitee: invite_state::IsSet, { /// Build the final struct pub fn build(self) -> Invite<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/collab/session.rs b/crates/jacquard-api/src/sh_weaver/collab/session.rs index c0ffe28d..85912a80 100644 --- a/crates/jacquard-api/src/sh_weaver/collab/session.rs +++ b/crates/jacquard-api/src/sh_weaver/collab/session.rs @@ -44,51 +44,51 @@ pub mod session_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type NodeId; type CreatedAt; type Resource; + type NodeId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type NodeId = Unset; type CreatedAt = Unset; type Resource = Unset; - } - ///State transition - sets the `node_id` field to Set - pub struct SetNodeId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNodeId<S> {} - impl<S: State> State for SetNodeId<S> { - type NodeId = Set<members::node_id>; - type CreatedAt = S::CreatedAt; - type Resource = S::Resource; + type NodeId = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type NodeId = S::NodeId; type CreatedAt = Set<members::created_at>; type Resource = S::Resource; + type NodeId = S::NodeId; } ///State transition - sets the `resource` field to Set pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetResource<S> {} impl<S: State> State for SetResource<S> { - type NodeId = S::NodeId; type CreatedAt = S::CreatedAt; type Resource = Set<members::resource>; + type NodeId = S::NodeId; + } + ///State transition - sets the `node_id` field to Set + pub struct SetNodeId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNodeId<S> {} + impl<S: State> State for SetNodeId<S> { + type CreatedAt = S::CreatedAt; + type Resource = S::Resource; + type NodeId = Set<members::node_id>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `node_id` field - pub struct node_id(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `resource` field pub struct resource(()); + ///Marker type for the `node_id` field + pub struct node_id(()); } } @@ -221,9 +221,9 @@ where impl<'a, S> SessionBuilder<'a, S> where S: session_state::State, - S::NodeId: session_state::IsSet, S::CreatedAt: session_state::IsSet, S::Resource: session_state::IsSet, + S::NodeId: session_state::IsSet, { /// Build the final struct pub fn build(self) -> Session<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/edit.rs b/crates/jacquard-api/src/sh_weaver/edit.rs index 0473fbfd..9981cc34 100644 --- a/crates/jacquard-api/src/sh_weaver/edit.rs +++ b/crates/jacquard-api/src/sh_weaver/edit.rs @@ -721,67 +721,67 @@ pub mod edit_branch_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Length; + type Head; type Author; type LastUpdated; - type Head; + type Length; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Length = Unset; + type Head = Unset; type Author = Unset; type LastUpdated = Unset; - type Head = Unset; + type Length = Unset; } - ///State transition - sets the `length` field to Set - pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLength<S> {} - impl<S: State> State for SetLength<S> { - type Length = Set<members::length>; + ///State transition - sets the `head` field to Set + pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHead<S> {} + impl<S: State> State for SetHead<S> { + type Head = Set<members::head>; type Author = S::Author; type LastUpdated = S::LastUpdated; - type Head = S::Head; + type Length = S::Length; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { - type Length = S::Length; + type Head = S::Head; type Author = Set<members::author>; type LastUpdated = S::LastUpdated; - type Head = S::Head; + type Length = S::Length; } ///State transition - sets the `last_updated` field to Set pub struct SetLastUpdated<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLastUpdated<S> {} impl<S: State> State for SetLastUpdated<S> { - type Length = S::Length; + type Head = S::Head; type Author = S::Author; type LastUpdated = Set<members::last_updated>; - type Head = S::Head; - } - ///State transition - sets the `head` field to Set - pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHead<S> {} - impl<S: State> State for SetHead<S> { type Length = S::Length; + } + ///State transition - sets the `length` field to Set + pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLength<S> {} + impl<S: State> State for SetLength<S> { + type Head = S::Head; type Author = S::Author; type LastUpdated = S::LastUpdated; - type Head = Set<members::head>; + type Length = Set<members::length>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `length` field - pub struct length(()); + ///Marker type for the `head` field + pub struct head(()); ///Marker type for the `author` field pub struct author(()); ///Marker type for the `last_updated` field pub struct last_updated(()); - ///Marker type for the `head` field - pub struct head(()); + ///Marker type for the `length` field + pub struct length(()); } } @@ -948,10 +948,10 @@ impl<'a, S: edit_branch_view_state::State> EditBranchViewBuilder<'a, S> { impl<'a, S> EditBranchViewBuilder<'a, S> where S: edit_branch_view_state::State, - S::Length: edit_branch_view_state::IsSet, + S::Head: edit_branch_view_state::IsSet, S::Author: edit_branch_view_state::IsSet, S::LastUpdated: edit_branch_view_state::IsSet, - S::Head: edit_branch_view_state::IsSet, + S::Length: edit_branch_view_state::IsSet, { /// Build the final struct pub fn build(self) -> EditBranchView<'a> { @@ -1053,85 +1053,85 @@ pub mod edit_history_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Type; - type Author; type CreatedAt; + type Type; + type Uri; type Cid; + type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Type = Unset; - type Author = Unset; type CreatedAt = Unset; + type Type = Unset; + type Uri = Unset; type Cid = Unset; + type Author = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; type Type = S::Type; - type Author = S::Author; - type CreatedAt = S::CreatedAt; + type Uri = S::Uri; type Cid = S::Cid; + type Author = S::Author; } ///State transition - sets the `type` field to Set pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetType<S> {} impl<S: State> State for SetType<S> { - type Uri = S::Uri; - type Type = Set<members::r#type>; - type Author = S::Author; type CreatedAt = S::CreatedAt; - type Cid = S::Cid; - } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { + type Type = Set<members::r#type>; type Uri = S::Uri; - type Type = S::Type; - type Author = Set<members::author>; - type CreatedAt = S::CreatedAt; type Cid = S::Cid; + type Author = S::Author; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type CreatedAt = S::CreatedAt; type Type = S::Type; - type Author = S::Author; - type CreatedAt = Set<members::created_at>; + type Uri = Set<members::uri>; type Cid = S::Cid; + type Author = S::Author; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Uri = S::Uri; + type CreatedAt = S::CreatedAt; type Type = S::Type; + type Uri = S::Uri; + type Cid = Set<members::cid>; type Author = S::Author; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { type CreatedAt = S::CreatedAt; - type Cid = Set<members::cid>; + type Type = S::Type; + type Uri = S::Uri; + type Cid = S::Cid; + type Author = Set<members::author>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `type` field - pub struct r#type(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `type` field + pub struct r#type(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `author` field + pub struct author(()); } } @@ -1348,11 +1348,11 @@ where impl<'a, S> EditHistoryEntryBuilder<'a, S> where S: edit_history_entry_state::State, - S::Uri: edit_history_entry_state::IsSet, - S::Type: edit_history_entry_state::IsSet, - S::Author: edit_history_entry_state::IsSet, S::CreatedAt: edit_history_entry_state::IsSet, + S::Type: edit_history_entry_state::IsSet, + S::Uri: edit_history_entry_state::IsSet, S::Cid: edit_history_entry_state::IsSet, + S::Author: edit_history_entry_state::IsSet, { /// Build the final struct pub fn build(self) -> EditHistoryEntry<'a> { @@ -1539,37 +1539,37 @@ pub mod edit_tree_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Resource; type Branches; + type Resource; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Resource = Unset; type Branches = Unset; - } - ///State transition - sets the `resource` field to Set - pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetResource<S> {} - impl<S: State> State for SetResource<S> { - type Resource = Set<members::resource>; - type Branches = S::Branches; + type Resource = Unset; } ///State transition - sets the `branches` field to Set pub struct SetBranches<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBranches<S> {} impl<S: State> State for SetBranches<S> { - type Resource = S::Resource; type Branches = Set<members::branches>; + type Resource = S::Resource; + } + ///State transition - sets the `resource` field to Set + pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetResource<S> {} + impl<S: State> State for SetResource<S> { + type Branches = S::Branches; + type Resource = Set<members::resource>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `resource` field - pub struct resource(()); ///Marker type for the `branches` field pub struct branches(()); + ///Marker type for the `resource` field + pub struct resource(()); } } @@ -1698,8 +1698,8 @@ where impl<'a, S> EditTreeViewBuilder<'a, S> where S: edit_tree_view_state::State, - S::Resource: edit_tree_view_state::IsSet, S::Branches: edit_tree_view_state::IsSet, + S::Resource: edit_tree_view_state::IsSet, { /// Build the final struct pub fn build(self) -> EditTreeView<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/edit/cursor.rs b/crates/jacquard-api/src/sh_weaver/edit/cursor.rs index 0783565c..09d53cb8 100644 --- a/crates/jacquard-api/src/sh_weaver/edit/cursor.rs +++ b/crates/jacquard-api/src/sh_weaver/edit/cursor.rs @@ -759,37 +759,37 @@ pub mod cursor_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Id; type Container; + type Id; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Id = Unset; type Container = Unset; - } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { - type Id = Set<members::id>; - type Container = S::Container; + type Id = Unset; } ///State transition - sets the `container` field to Set pub struct SetContainer<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetContainer<S> {} impl<S: State> State for SetContainer<S> { - type Id = S::Id; type Container = Set<members::container>; + type Id = S::Id; + } + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { + type Container = S::Container; + type Id = Set<members::id>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `container` field pub struct container(()); + ///Marker type for the `id` field + pub struct id(()); } } @@ -882,8 +882,8 @@ impl<'a, S: cursor_state::State> CursorBuilder<'a, S> { impl<'a, S> CursorBuilder<'a, S> where S: cursor_state::State, - S::Id: cursor_state::IsSet, S::Container: cursor_state::IsSet, + S::Id: cursor_state::IsSet, { /// Build the final struct pub fn build(self) -> Cursor<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/edit/diff.rs b/crates/jacquard-api/src/sh_weaver/edit/diff.rs index 062858f5..149c3053 100644 --- a/crates/jacquard-api/src/sh_weaver/edit/diff.rs +++ b/crates/jacquard-api/src/sh_weaver/edit/diff.rs @@ -47,37 +47,37 @@ pub mod diff_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Root; type Doc; + type Root; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Root = Unset; type Doc = Unset; - } - ///State transition - sets the `root` field to Set - pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRoot<S> {} - impl<S: State> State for SetRoot<S> { - type Root = Set<members::root>; - type Doc = S::Doc; + type Root = Unset; } ///State transition - sets the `doc` field to Set pub struct SetDoc<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDoc<S> {} impl<S: State> State for SetDoc<S> { - type Root = S::Root; type Doc = Set<members::doc>; + type Root = S::Root; + } + ///State transition - sets the `root` field to Set + pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRoot<S> {} + impl<S: State> State for SetRoot<S> { + type Doc = S::Doc; + type Root = Set<members::root>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `root` field - pub struct root(()); ///Marker type for the `doc` field pub struct doc(()); + ///Marker type for the `root` field + pub struct root(()); } } @@ -224,8 +224,8 @@ impl<'a, S: diff_state::State> DiffBuilder<'a, S> { impl<'a, S> DiffBuilder<'a, S> where S: diff_state::State, - S::Root: diff_state::IsSet, S::Doc: diff_state::IsSet, + S::Root: diff_state::IsSet, { /// Build the final struct pub fn build(self) -> Diff<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/edit/list_drafts.rs b/crates/jacquard-api/src/sh_weaver/edit/list_drafts.rs index d679e1a4..2a7c5c1c 100644 --- a/crates/jacquard-api/src/sh_weaver/edit/list_drafts.rs +++ b/crates/jacquard-api/src/sh_weaver/edit/list_drafts.rs @@ -48,50 +48,50 @@ pub mod draft_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; - type Uri; type Cid; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; - type Uri = Unset; type Cid = Unset; + type Uri = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type CreatedAt = Set<members::created_at>; - type Uri = S::Uri; - type Cid = S::Cid; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type CreatedAt = S::CreatedAt; - type Uri = Set<members::uri>; type Cid = S::Cid; + type Uri = S::Uri; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type CreatedAt = S::CreatedAt; - type Uri = S::Uri; type Cid = Set<members::cid>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -242,8 +242,8 @@ impl<'a, S> DraftViewBuilder<'a, S> where S: draft_view_state::State, S::CreatedAt: draft_view_state::IsSet, - S::Uri: draft_view_state::IsSet, S::Cid: draft_view_state::IsSet, + S::Uri: draft_view_state::IsSet, { /// Build the final struct pub fn build(self) -> DraftView<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/embed.rs b/crates/jacquard-api/src/sh_weaver/embed.rs index 779675e1..ac213410 100644 --- a/crates/jacquard-api/src/sh_weaver/embed.rs +++ b/crates/jacquard-api/src/sh_weaver/embed.rs @@ -38,37 +38,37 @@ pub mod percent_size_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Width; type Height; + type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Width = Unset; type Height = Unset; - } - ///State transition - sets the `width` field to Set - pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWidth<S> {} - impl<S: State> State for SetWidth<S> { - type Width = Set<members::width>; - type Height = S::Height; + type Width = Unset; } ///State transition - sets the `height` field to Set pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeight<S> {} impl<S: State> State for SetHeight<S> { - type Width = S::Width; type Height = Set<members::height>; + type Width = S::Width; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWidth<S> {} + impl<S: State> State for SetWidth<S> { + type Height = S::Height; + type Width = Set<members::width>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `width` field - pub struct width(()); ///Marker type for the `height` field pub struct height(()); + ///Marker type for the `width` field + pub struct width(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> PercentSizeBuilder<'a, S> where S: percent_size_state::State, - S::Width: percent_size_state::IsSet, S::Height: percent_size_state::IsSet, + S::Width: percent_size_state::IsSet, { /// Build the final struct pub fn build(self) -> PercentSize<'a> { @@ -312,37 +312,37 @@ pub mod pixel_size_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Height; type Width; + type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Height = Unset; type Width = Unset; - } - ///State transition - sets the `height` field to Set - pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHeight<S> {} - impl<S: State> State for SetHeight<S> { - type Height = Set<members::height>; - type Width = S::Width; + type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWidth<S> {} impl<S: State> State for SetWidth<S> { - type Height = S::Height; type Width = Set<members::width>; + type Height = S::Height; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHeight<S> {} + impl<S: State> State for SetHeight<S> { + type Width = S::Width; + type Height = Set<members::height>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `height` field - pub struct height(()); ///Marker type for the `width` field pub struct width(()); + ///Marker type for the `height` field + pub struct height(()); } } @@ -412,8 +412,8 @@ where impl<'a, S> PixelSizeBuilder<'a, S> where S: pixel_size_state::State, - S::Height: pixel_size_state::IsSet, S::Width: pixel_size_state::IsSet, + S::Height: pixel_size_state::IsSet, { /// Build the final struct pub fn build(self) -> PixelSize<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/embed/external.rs b/crates/jacquard-api/src/sh_weaver/embed/external.rs index 75221122..d57fc779 100644 --- a/crates/jacquard-api/src/sh_weaver/embed/external.rs +++ b/crates/jacquard-api/src/sh_weaver/embed/external.rs @@ -38,49 +38,49 @@ pub mod external_embed_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Description; + type Uri; type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Description = Unset; + type Uri = Unset; type Title = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Description = S::Description; - type Title = S::Title; - } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Uri = S::Uri; type Description = Set<members::description>; + type Uri = S::Uri; + type Title = S::Title; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Description = S::Description; + type Uri = Set<members::uri>; type Title = S::Title; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Uri = S::Uri; type Description = S::Description; + type Uri = S::Uri; type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `description` field pub struct description(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `title` field pub struct title(()); } @@ -195,8 +195,8 @@ where impl<'a, S> ExternalEmbedBuilder<'a, S> where S: external_embed_state::State, - S::Uri: external_embed_state::IsSet, S::Description: external_embed_state::IsSet, + S::Uri: external_embed_state::IsSet, S::Title: external_embed_state::IsSet, { /// Build the final struct @@ -817,51 +817,51 @@ pub mod view_external_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Title; type Description; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Title = Unset; type Description = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Title = S::Title; - type Description = S::Description; + type Uri = Unset; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Uri = S::Uri; type Title = Set<members::title>; type Description = S::Description; + type Uri = S::Uri; } ///State transition - sets the `description` field to Set pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDescription<S> {} impl<S: State> State for SetDescription<S> { - type Uri = S::Uri; type Title = S::Title; type Description = Set<members::description>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Title = S::Title; + type Description = S::Description; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `description` field pub struct description(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -974,9 +974,9 @@ where impl<'a, S> ViewExternalBuilder<'a, S> where S: view_external_state::State, - S::Uri: view_external_state::IsSet, S::Title: view_external_state::IsSet, S::Description: view_external_state::IsSet, + S::Uri: view_external_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewExternal<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/embed/images.rs b/crates/jacquard-api/src/sh_weaver/embed/images.rs index 61cd63a3..cde17825 100644 --- a/crates/jacquard-api/src/sh_weaver/embed/images.rs +++ b/crates/jacquard-api/src/sh_weaver/embed/images.rs @@ -44,37 +44,37 @@ pub mod image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Image; type Alt; + type Image; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Image = Unset; type Alt = Unset; - } - ///State transition - sets the `image` field to Set - pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetImage<S> {} - impl<S: State> State for SetImage<S> { - type Image = Set<members::image>; - type Alt = S::Alt; + type Image = Unset; } ///State transition - sets the `alt` field to Set pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlt<S> {} impl<S: State> State for SetAlt<S> { - type Image = S::Image; type Alt = Set<members::alt>; + type Image = S::Image; + } + ///State transition - sets the `image` field to Set + pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetImage<S> {} + impl<S: State> State for SetImage<S> { + type Alt = S::Alt; + type Image = Set<members::image>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `image` field - pub struct image(()); ///Marker type for the `alt` field pub struct alt(()); + ///Marker type for the `image` field + pub struct image(()); } } @@ -195,8 +195,8 @@ impl<'a, S: image_state::State> ImageBuilder<'a, S> { impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, - S::Image: image_state::IsSet, S::Alt: image_state::IsSet, + S::Image: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { @@ -902,51 +902,51 @@ pub mod view_image_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Fullsize; type Alt; type Thumb; - type Fullsize; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Fullsize = Unset; type Alt = Unset; type Thumb = Unset; - type Fullsize = Unset; + } + ///State transition - sets the `fullsize` field to Set + pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFullsize<S> {} + impl<S: State> State for SetFullsize<S> { + type Fullsize = Set<members::fullsize>; + type Alt = S::Alt; + type Thumb = S::Thumb; } ///State transition - sets the `alt` field to Set pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlt<S> {} impl<S: State> State for SetAlt<S> { + type Fullsize = S::Fullsize; type Alt = Set<members::alt>; type Thumb = S::Thumb; - type Fullsize = S::Fullsize; } ///State transition - sets the `thumb` field to Set pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetThumb<S> {} impl<S: State> State for SetThumb<S> { - type Alt = S::Alt; - type Thumb = Set<members::thumb>; type Fullsize = S::Fullsize; - } - ///State transition - sets the `fullsize` field to Set - pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFullsize<S> {} - impl<S: State> State for SetFullsize<S> { type Alt = S::Alt; - type Thumb = S::Thumb; - type Fullsize = Set<members::fullsize>; + type Thumb = Set<members::thumb>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `fullsize` field + pub struct fullsize(()); ///Marker type for the `alt` field pub struct alt(()); ///Marker type for the `thumb` field pub struct thumb(()); - ///Marker type for the `fullsize` field - pub struct fullsize(()); } } @@ -1073,9 +1073,9 @@ where impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, + S::Fullsize: view_image_state::IsSet, S::Alt: view_image_state::IsSet, S::Thumb: view_image_state::IsSet, - S::Fullsize: view_image_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewImage<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/embed/record_with_media.rs b/crates/jacquard-api/src/sh_weaver/embed/record_with_media.rs index 787312a5..a6227405 100644 --- a/crates/jacquard-api/src/sh_weaver/embed/record_with_media.rs +++ b/crates/jacquard-api/src/sh_weaver/embed/record_with_media.rs @@ -323,37 +323,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Media; type Record; + type Media; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Media = Unset; type Record = Unset; - } - ///State transition - sets the `media` field to Set - pub struct SetMedia<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetMedia<S> {} - impl<S: State> State for SetMedia<S> { - type Media = Set<members::media>; - type Record = S::Record; + type Media = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Media = S::Media; type Record = Set<members::record>; + type Media = S::Media; + } + ///State transition - sets the `media` field to Set + pub struct SetMedia<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMedia<S> {} + impl<S: State> State for SetMedia<S> { + type Record = S::Record; + type Media = Set<members::media>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `media` field - pub struct media(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `media` field + pub struct media(()); } } @@ -426,8 +426,8 @@ impl<'a, S: view_state::State> ViewBuilder<'a, S> { impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Media: view_state::IsSet, S::Record: view_state::IsSet, + S::Media: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/embed/records.rs b/crates/jacquard-api/src/sh_weaver/embed/records.rs index 66c27951..c67c392a 100644 --- a/crates/jacquard-api/src/sh_weaver/embed/records.rs +++ b/crates/jacquard-api/src/sh_weaver/embed/records.rs @@ -1187,51 +1187,51 @@ pub mod view_blocked_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Author; - type Blocked; type Uri; + type Blocked; + type Author; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Author = Unset; - type Blocked = Unset; type Uri = Unset; + type Blocked = Unset; + type Author = Unset; } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { - type Author = Set<members::author>; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; type Blocked = S::Blocked; - type Uri = S::Uri; + type Author = S::Author; } ///State transition - sets the `blocked` field to Set pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlocked<S> {} impl<S: State> State for SetBlocked<S> { - type Author = S::Author; - type Blocked = Set<members::blocked>; type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { + type Blocked = Set<members::blocked>; type Author = S::Author; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Uri = S::Uri; type Blocked = S::Blocked; - type Uri = Set<members::uri>; + type Author = Set<members::author>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `author` field - pub struct author(()); - ///Marker type for the `blocked` field - pub struct blocked(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `blocked` field + pub struct blocked(()); + ///Marker type for the `author` field + pub struct author(()); } } @@ -1324,9 +1324,9 @@ where impl<'a, S> ViewBlockedBuilder<'a, S> where S: view_blocked_state::State, - S::Author: view_blocked_state::IsSet, - S::Blocked: view_blocked_state::IsSet, S::Uri: view_blocked_state::IsSet, + S::Blocked: view_blocked_state::IsSet, + S::Author: view_blocked_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewBlocked<'a> { @@ -1770,9 +1770,9 @@ pub mod view_record_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; + type IndexedAt; type Uri; type Value; - type IndexedAt; type Author; } /// Empty state - all required fields are unset @@ -1780,9 +1780,9 @@ pub mod view_record_state { impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; + type IndexedAt = Unset; type Uri = Unset; type Value = Unset; - type IndexedAt = Unset; type Author = Unset; } ///State transition - sets the `cid` field to Set @@ -1790,9 +1790,19 @@ pub mod view_record_state { impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Cid = Set<members::cid>; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Value = S::Value; + type Author = S::Author; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Cid = S::Cid; + type IndexedAt = Set<members::indexed_at>; type Uri = S::Uri; type Value = S::Value; - type IndexedAt = S::IndexedAt; type Author = S::Author; } ///State transition - sets the `uri` field to Set @@ -1800,9 +1810,9 @@ pub mod view_record_state { impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Cid = S::Cid; + type IndexedAt = S::IndexedAt; type Uri = Set<members::uri>; type Value = S::Value; - type IndexedAt = S::IndexedAt; type Author = S::Author; } ///State transition - sets the `value` field to Set @@ -1810,19 +1820,9 @@ pub mod view_record_state { impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { type Cid = S::Cid; - type Uri = S::Uri; - type Value = Set<members::value>; type IndexedAt = S::IndexedAt; - type Author = S::Author; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Cid = S::Cid; type Uri = S::Uri; - type Value = S::Value; - type IndexedAt = Set<members::indexed_at>; + type Value = Set<members::value>; type Author = S::Author; } ///State transition - sets the `author` field to Set @@ -1830,9 +1830,9 @@ pub mod view_record_state { impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { type Cid = S::Cid; + type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Value = S::Value; - type IndexedAt = S::IndexedAt; type Author = Set<members::author>; } /// Marker types for field names @@ -1840,12 +1840,12 @@ pub mod view_record_state { pub mod members { ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `author` field pub struct author(()); } @@ -2093,9 +2093,9 @@ impl<'a, S> ViewRecordBuilder<'a, S> where S: view_record_state::State, S::Cid: view_record_state::IsSet, + S::IndexedAt: view_record_state::IsSet, S::Uri: view_record_state::IsSet, S::Value: view_record_state::IsSet, - S::IndexedAt: view_record_state::IsSet, S::Author: view_record_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_weaver/embed/video.rs b/crates/jacquard-api/src/sh_weaver/embed/video.rs index ca20c77e..99229fd8 100644 --- a/crates/jacquard-api/src/sh_weaver/embed/video.rs +++ b/crates/jacquard-api/src/sh_weaver/embed/video.rs @@ -940,37 +940,37 @@ pub mod view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Playlist; type Cid; + type Playlist; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Playlist = Unset; type Cid = Unset; - } - ///State transition - sets the `playlist` field to Set - pub struct SetPlaylist<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPlaylist<S> {} - impl<S: State> State for SetPlaylist<S> { - type Playlist = Set<members::playlist>; - type Cid = S::Cid; + type Playlist = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Playlist = S::Playlist; type Cid = Set<members::cid>; + type Playlist = S::Playlist; + } + ///State transition - sets the `playlist` field to Set + pub struct SetPlaylist<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPlaylist<S> {} + impl<S: State> State for SetPlaylist<S> { + type Cid = S::Cid; + type Playlist = Set<members::playlist>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `playlist` field - pub struct playlist(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `playlist` field + pub struct playlist(()); } } @@ -1108,8 +1108,8 @@ impl<'a, S: view_state::State> ViewBuilder<'a, S> { impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, - S::Playlist: view_state::IsSet, S::Cid: view_state::IsSet, + S::Playlist: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/graph.rs b/crates/jacquard-api/src/sh_weaver/graph.rs index 66173c94..b4cd914c 100644 --- a/crates/jacquard-api/src/sh_weaver/graph.rs +++ b/crates/jacquard-api/src/sh_weaver/graph.rs @@ -59,37 +59,37 @@ pub mod community_tag_count_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Count; type Tag; + type Count; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Count = Unset; type Tag = Unset; - } - ///State transition - sets the `count` field to Set - pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCount<S> {} - impl<S: State> State for SetCount<S> { - type Count = Set<members::count>; - type Tag = S::Tag; + type Count = Unset; } ///State transition - sets the `tag` field to Set pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTag<S> {} impl<S: State> State for SetTag<S> { - type Count = S::Count; type Tag = Set<members::tag>; + type Count = S::Count; + } + ///State transition - sets the `count` field to Set + pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCount<S> {} + impl<S: State> State for SetCount<S> { + type Tag = S::Tag; + type Count = Set<members::count>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `count` field - pub struct count(()); ///Marker type for the `tag` field pub struct tag(()); + ///Marker type for the `count` field + pub struct count(()); } } @@ -162,8 +162,8 @@ where impl<'a, S> CommunityTagCountBuilder<'a, S> where S: community_tag_count_state::State, - S::Count: community_tag_count_state::IsSet, S::Tag: community_tag_count_state::IsSet, + S::Count: community_tag_count_state::IsSet, { /// Build the final struct pub fn build(self) -> CommunityTagCount<'a> { @@ -1212,127 +1212,127 @@ pub mod list_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; type Cid; - type Name; type Creator; + type Name; + type Uri; type Purpose; - type IndexedAt; type ItemCount; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; type Cid = Unset; - type Name = Unset; type Creator = Unset; + type Name = Unset; + type Uri = Unset; type Purpose = Unset; - type IndexedAt = Unset; type ItemCount = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; - type Name = S::Name; - type Creator = S::Creator; - type Purpose = S::Purpose; - type IndexedAt = S::IndexedAt; - type ItemCount = S::ItemCount; + type IndexedAt = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Uri = S::Uri; type Cid = Set<members::cid>; - type Name = S::Name; type Creator = S::Creator; + type Name = S::Name; + type Uri = S::Uri; type Purpose = S::Purpose; + type ItemCount = S::ItemCount; type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { + type Cid = S::Cid; + type Creator = Set<members::creator>; + type Name = S::Name; + type Uri = S::Uri; + type Purpose = S::Purpose; type ItemCount = S::ItemCount; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Uri = S::Uri; type Cid = S::Cid; - type Name = Set<members::name>; type Creator = S::Creator; + type Name = Set<members::name>; + type Uri = S::Uri; type Purpose = S::Purpose; - type IndexedAt = S::IndexedAt; type ItemCount = S::ItemCount; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Cid = S::Cid; + type Creator = S::Creator; type Name = S::Name; - type Creator = Set<members::creator>; + type Uri = Set<members::uri>; type Purpose = S::Purpose; - type IndexedAt = S::IndexedAt; type ItemCount = S::ItemCount; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPurpose<S> {} impl<S: State> State for SetPurpose<S> { - type Uri = S::Uri; type Cid = S::Cid; - type Name = S::Name; type Creator = S::Creator; - type Purpose = Set<members::purpose>; - type IndexedAt = S::IndexedAt; - type ItemCount = S::ItemCount; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Uri = S::Uri; - type Cid = S::Cid; type Name = S::Name; - type Creator = S::Creator; - type Purpose = S::Purpose; - type IndexedAt = Set<members::indexed_at>; + type Uri = S::Uri; + type Purpose = Set<members::purpose>; type ItemCount = S::ItemCount; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `item_count` field to Set pub struct SetItemCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetItemCount<S> {} impl<S: State> State for SetItemCount<S> { - type Uri = S::Uri; type Cid = S::Cid; - type Name = S::Name; type Creator = S::Creator; + type Name = S::Name; + type Uri = S::Uri; type Purpose = S::Purpose; - type IndexedAt = S::IndexedAt; type ItemCount = Set<members::item_count>; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Cid = S::Cid; + type Creator = S::Creator; + type Name = S::Name; + type Uri = S::Uri; + type Purpose = S::Purpose; + type ItemCount = S::ItemCount; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `creator` field pub struct creator(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `purpose` field pub struct purpose(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `item_count` field pub struct item_count(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -1576,13 +1576,13 @@ impl<'a, S: list_view_state::State> ListViewBuilder<'a, S> { impl<'a, S> ListViewBuilder<'a, S> where S: list_view_state::State, - S::Uri: list_view_state::IsSet, S::Cid: list_view_state::IsSet, - S::Name: list_view_state::IsSet, S::Creator: list_view_state::IsSet, + S::Name: list_view_state::IsSet, + S::Uri: list_view_state::IsSet, S::Purpose: list_view_state::IsSet, - S::IndexedAt: list_view_state::IsSet, S::ItemCount: list_view_state::IsSet, + S::IndexedAt: list_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ListView<'a> { @@ -1696,51 +1696,51 @@ pub mod resource_tags_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CommunityTags; type Resource; type AuthorTags; + type CommunityTags; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CommunityTags = Unset; type Resource = Unset; type AuthorTags = Unset; - } - ///State transition - sets the `community_tags` field to Set - pub struct SetCommunityTags<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCommunityTags<S> {} - impl<S: State> State for SetCommunityTags<S> { - type CommunityTags = Set<members::community_tags>; - type Resource = S::Resource; - type AuthorTags = S::AuthorTags; + type CommunityTags = Unset; } ///State transition - sets the `resource` field to Set pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetResource<S> {} impl<S: State> State for SetResource<S> { - type CommunityTags = S::CommunityTags; type Resource = Set<members::resource>; type AuthorTags = S::AuthorTags; + type CommunityTags = S::CommunityTags; } ///State transition - sets the `author_tags` field to Set pub struct SetAuthorTags<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthorTags<S> {} impl<S: State> State for SetAuthorTags<S> { - type CommunityTags = S::CommunityTags; type Resource = S::Resource; type AuthorTags = Set<members::author_tags>; + type CommunityTags = S::CommunityTags; + } + ///State transition - sets the `community_tags` field to Set + pub struct SetCommunityTags<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCommunityTags<S> {} + impl<S: State> State for SetCommunityTags<S> { + type Resource = S::Resource; + type AuthorTags = S::AuthorTags; + type CommunityTags = Set<members::community_tags>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `community_tags` field - pub struct community_tags(()); ///Marker type for the `resource` field pub struct resource(()); ///Marker type for the `author_tags` field pub struct author_tags(()); + ///Marker type for the `community_tags` field + pub struct community_tags(()); } } @@ -1853,9 +1853,9 @@ impl<'a, S: resource_tags_view_state::State> ResourceTagsViewBuilder<'a, S> { impl<'a, S> ResourceTagsViewBuilder<'a, S> where S: resource_tags_view_state::State, - S::CommunityTags: resource_tags_view_state::IsSet, S::Resource: resource_tags_view_state::IsSet, S::AuthorTags: resource_tags_view_state::IsSet, + S::CommunityTags: resource_tags_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ResourceTagsView<'a> { @@ -1952,65 +1952,65 @@ pub mod tag_application_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Tag; type CreatedAt; + type Tag; + type Uri; type AppliedBy; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Tag = Unset; type CreatedAt = Unset; + type Tag = Unset; + type Uri = Unset; type AppliedBy = Unset; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; type Tag = S::Tag; - type CreatedAt = S::CreatedAt; + type Uri = S::Uri; type AppliedBy = S::AppliedBy; } ///State transition - sets the `tag` field to Set pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTag<S> {} impl<S: State> State for SetTag<S> { - type Uri = S::Uri; - type Tag = Set<members::tag>; type CreatedAt = S::CreatedAt; + type Tag = Set<members::tag>; + type Uri = S::Uri; type AppliedBy = S::AppliedBy; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Uri = S::Uri; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type CreatedAt = S::CreatedAt; type Tag = S::Tag; - type CreatedAt = Set<members::created_at>; + type Uri = Set<members::uri>; type AppliedBy = S::AppliedBy; } ///State transition - sets the `applied_by` field to Set pub struct SetAppliedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAppliedBy<S> {} impl<S: State> State for SetAppliedBy<S> { - type Uri = S::Uri; - type Tag = S::Tag; type CreatedAt = S::CreatedAt; + type Tag = S::Tag; + type Uri = S::Uri; type AppliedBy = Set<members::applied_by>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `tag` field - pub struct tag(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `tag` field + pub struct tag(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `applied_by` field pub struct applied_by(()); } @@ -2125,9 +2125,9 @@ where impl<'a, S> TagApplicationViewBuilder<'a, S> where S: tag_application_view_state::State, - S::Uri: tag_application_view_state::IsSet, - S::Tag: tag_application_view_state::IsSet, S::CreatedAt: tag_application_view_state::IsSet, + S::Tag: tag_application_view_state::IsSet, + S::Uri: tag_application_view_state::IsSet, S::AppliedBy: tag_application_view_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/sh_weaver/graph/list.rs b/crates/jacquard-api/src/sh_weaver/graph/list.rs index 63aa51de..fcfb0a4d 100644 --- a/crates/jacquard-api/src/sh_weaver/graph/list.rs +++ b/crates/jacquard-api/src/sh_weaver/graph/list.rs @@ -129,51 +129,51 @@ pub mod list_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Purpose; type Name; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Purpose = Unset; type Name = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Purpose = S::Purpose; - type Name = S::Name; + type CreatedAt = Unset; } ///State transition - sets the `purpose` field to Set pub struct SetPurpose<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPurpose<S> {} impl<S: State> State for SetPurpose<S> { - type CreatedAt = S::CreatedAt; type Purpose = Set<members::purpose>; type Name = S::Name; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type CreatedAt = S::CreatedAt; type Purpose = S::Purpose; type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Purpose = S::Purpose; + type Name = S::Name; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `purpose` field pub struct purpose(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -306,9 +306,9 @@ where impl<'a, S> ListBuilder<'a, S> where S: list_state::State, - S::CreatedAt: list_state::IsSet, S::Purpose: list_state::IsSet, S::Name: list_state::IsSet, + S::CreatedAt: list_state::IsSet, { /// Build the final struct pub fn build(self) -> List<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/graph/subscribe.rs b/crates/jacquard-api/src/sh_weaver/graph/subscribe.rs index a57472ab..457be891 100644 --- a/crates/jacquard-api/src/sh_weaver/graph/subscribe.rs +++ b/crates/jacquard-api/src/sh_weaver/graph/subscribe.rs @@ -34,37 +34,37 @@ pub mod subscribe_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; type CreatedAt; + type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotebook<S> {} - impl<S: State> State for SetNotebook<S> { - type Notebook = Set<members::notebook>; - type CreatedAt = S::CreatedAt; + type Notebook = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Notebook = S::Notebook; type CreatedAt = Set<members::created_at>; + type Notebook = S::Notebook; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotebook<S> {} + impl<S: State> State for SetNotebook<S> { + type CreatedAt = S::CreatedAt; + type Notebook = Set<members::notebook>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `notebook` field + pub struct notebook(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> SubscribeBuilder<'a, S> where S: subscribe_state::State, - S::Notebook: subscribe_state::IsSet, S::CreatedAt: subscribe_state::IsSet, + S::Notebook: subscribe_state::IsSet, { /// Build the final struct pub fn build(self) -> Subscribe<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/graph/subscribe_accept.rs b/crates/jacquard-api/src/sh_weaver/graph/subscribe_accept.rs index 9037691d..a85ffeaf 100644 --- a/crates/jacquard-api/src/sh_weaver/graph/subscribe_accept.rs +++ b/crates/jacquard-api/src/sh_weaver/graph/subscribe_accept.rs @@ -34,37 +34,37 @@ pub mod subscribe_accept_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subscribe; type CreatedAt; + type Subscribe; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subscribe = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `subscribe` field to Set - pub struct SetSubscribe<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubscribe<S> {} - impl<S: State> State for SetSubscribe<S> { - type Subscribe = Set<members::subscribe>; - type CreatedAt = S::CreatedAt; + type Subscribe = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Subscribe = S::Subscribe; type CreatedAt = Set<members::created_at>; + type Subscribe = S::Subscribe; + } + ///State transition - sets the `subscribe` field to Set + pub struct SetSubscribe<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubscribe<S> {} + impl<S: State> State for SetSubscribe<S> { + type CreatedAt = S::CreatedAt; + type Subscribe = Set<members::subscribe>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subscribe` field - pub struct subscribe(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `subscribe` field + pub struct subscribe(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> SubscribeAcceptBuilder<'a, S> where S: subscribe_accept_state::State, - S::Subscribe: subscribe_accept_state::IsSet, S::CreatedAt: subscribe_accept_state::IsSet, + S::Subscribe: subscribe_accept_state::IsSet, { /// Build the final struct pub fn build(self) -> SubscribeAccept<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/graph/tag.rs b/crates/jacquard-api/src/sh_weaver/graph/tag.rs index ce8b34e3..58c5ed71 100644 --- a/crates/jacquard-api/src/sh_weaver/graph/tag.rs +++ b/crates/jacquard-api/src/sh_weaver/graph/tag.rs @@ -37,51 +37,51 @@ pub mod tag_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Subject; type Tag; + type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Subject = Unset; type Tag = Unset; + type Subject = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; + ///State transition - sets the `tag` field to Set + pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTag<S> {} + impl<S: State> State for SetTag<S> { + type Tag = Set<members::tag>; type Subject = S::Subject; - type Tag = S::Tag; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; - type Subject = Set<members::subject>; type Tag = S::Tag; - } - ///State transition - sets the `tag` field to Set - pub struct SetTag<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTag<S> {} - impl<S: State> State for SetTag<S> { + type Subject = Set<members::subject>; type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Tag = S::Tag; type Subject = S::Subject; - type Tag = Set<members::tag>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `tag` field pub struct tag(()); + ///Marker type for the `subject` field + pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -174,9 +174,9 @@ where impl<'a, S> TagBuilder<'a, S> where S: tag_state::State, - S::CreatedAt: tag_state::IsSet, - S::Subject: tag_state::IsSet, S::Tag: tag_state::IsSet, + S::Subject: tag_state::IsSet, + S::CreatedAt: tag_state::IsSet, { /// Build the final struct pub fn build(self) -> Tag<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook.rs b/crates/jacquard-api/src/sh_weaver/notebook.rs index 6571eead..f443d4a7 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook.rs @@ -2398,37 +2398,37 @@ pub mod chapter_entry_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Entry; type Index; + type Entry; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Entry = Unset; type Index = Unset; - } - ///State transition - sets the `entry` field to Set - pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEntry<S> {} - impl<S: State> State for SetEntry<S> { - type Entry = Set<members::entry>; - type Index = S::Index; + type Entry = Unset; } ///State transition - sets the `index` field to Set pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndex<S> {} impl<S: State> State for SetIndex<S> { - type Entry = S::Entry; type Index = Set<members::index>; + type Entry = S::Entry; + } + ///State transition - sets the `entry` field to Set + pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEntry<S> {} + impl<S: State> State for SetEntry<S> { + type Index = S::Index; + type Entry = Set<members::entry>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `entry` field - pub struct entry(()); ///Marker type for the `index` field pub struct index(()); + ///Marker type for the `entry` field + pub struct entry(()); } } @@ -2541,8 +2541,8 @@ impl<'a, S: chapter_entry_view_state::State> ChapterEntryViewBuilder<'a, S> { impl<'a, S> ChapterEntryViewBuilder<'a, S> where S: chapter_entry_view_state::State, - S::Entry: chapter_entry_view_state::IsSet, S::Index: chapter_entry_view_state::IsSet, + S::Entry: chapter_entry_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ChapterEntryView<'a> { @@ -2633,105 +2633,105 @@ pub mod chapter_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Notebook; + type Uri; type Cid; type Authors; - type Uri; type Record; type IndexedAt; - type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Notebook = Unset; + type Uri = Unset; type Cid = Unset; type Authors = Unset; - type Uri = Unset; type Record = Unset; type IndexedAt = Unset; - type Notebook = Unset; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotebook<S> {} + impl<S: State> State for SetNotebook<S> { + type Notebook = Set<members::notebook>; + type Uri = S::Uri; + type Cid = S::Cid; + type Authors = S::Authors; + type Record = S::Record; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Notebook = S::Notebook; + type Uri = Set<members::uri>; + type Cid = S::Cid; + type Authors = S::Authors; + type Record = S::Record; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { + type Notebook = S::Notebook; + type Uri = S::Uri; type Cid = Set<members::cid>; type Authors = S::Authors; - type Uri = S::Uri; type Record = S::Record; type IndexedAt = S::IndexedAt; - type Notebook = S::Notebook; } ///State transition - sets the `authors` field to Set pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthors<S> {} impl<S: State> State for SetAuthors<S> { + type Notebook = S::Notebook; + type Uri = S::Uri; type Cid = S::Cid; type Authors = Set<members::authors>; - type Uri = S::Uri; type Record = S::Record; type IndexedAt = S::IndexedAt; - type Notebook = S::Notebook; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Cid = S::Cid; - type Authors = S::Authors; - type Uri = Set<members::uri>; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - type Notebook = S::Notebook; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { + type Notebook = S::Notebook; + type Uri = S::Uri; type Cid = S::Cid; type Authors = S::Authors; - type Uri = S::Uri; type Record = Set<members::record>; type IndexedAt = S::IndexedAt; - type Notebook = S::Notebook; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Cid = S::Cid; - type Authors = S::Authors; - type Uri = S::Uri; - type Record = S::Record; - type IndexedAt = Set<members::indexed_at>; type Notebook = S::Notebook; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotebook<S> {} - impl<S: State> State for SetNotebook<S> { + type Uri = S::Uri; type Cid = S::Cid; type Authors = S::Authors; - type Uri = S::Uri; type Record = S::Record; - type IndexedAt = S::IndexedAt; - type Notebook = Set<members::notebook>; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `notebook` field + pub struct notebook(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `authors` field pub struct authors(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); - ///Marker type for the `notebook` field - pub struct notebook(()); } } @@ -2948,12 +2948,12 @@ where impl<'a, S> ChapterViewBuilder<'a, S> where S: chapter_view_state::State, + S::Notebook: chapter_view_state::IsSet, + S::Uri: chapter_view_state::IsSet, S::Cid: chapter_view_state::IsSet, S::Authors: chapter_view_state::IsSet, - S::Uri: chapter_view_state::IsSet, S::Record: chapter_view_state::IsSet, S::IndexedAt: chapter_view_state::IsSet, - S::Notebook: chapter_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ChapterView<'a> { @@ -3337,85 +3337,85 @@ pub mod entry_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Uri; - type Cid; type Record; type Authors; type IndexedAt; + type Uri; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Uri = Unset; - type Cid = Unset; type Record = Unset; type Authors = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type Cid = S::Cid; - type Record = S::Record; - type Authors = S::Authors; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Uri = S::Uri; - type Cid = Set<members::cid>; - type Record = S::Record; - type Authors = S::Authors; - type IndexedAt = S::IndexedAt; + type Uri = Unset; + type Cid = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Uri = S::Uri; - type Cid = S::Cid; type Record = Set<members::record>; type Authors = S::Authors; type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Cid = S::Cid; } ///State transition - sets the `authors` field to Set pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthors<S> {} impl<S: State> State for SetAuthors<S> { - type Uri = S::Uri; - type Cid = S::Cid; type Record = S::Record; type Authors = Set<members::authors>; type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Cid = S::Cid; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { + type Record = S::Record; + type Authors = S::Authors; + type IndexedAt = Set<members::indexed_at>; type Uri = S::Uri; type Cid = S::Cid; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Record = S::Record; type Authors = S::Authors; - type IndexedAt = Set<members::indexed_at>; + type IndexedAt = S::IndexedAt; + type Uri = Set<members::uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Record = S::Record; + type Authors = S::Authors; + type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `uri` field - pub struct uri(()); - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `authors` field pub struct authors(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -3752,11 +3752,11 @@ impl<'a, S: entry_view_state::State> EntryViewBuilder<'a, S> { impl<'a, S> EntryViewBuilder<'a, S> where S: entry_view_state::State, - S::Uri: entry_view_state::IsSet, - S::Cid: entry_view_state::IsSet, S::Record: entry_view_state::IsSet, S::Authors: entry_view_state::IsSet, S::IndexedAt: entry_view_state::IsSet, + S::Uri: entry_view_state::IsSet, + S::Cid: entry_view_state::IsSet, { /// Build the final struct pub fn build(self) -> EntryView<'a> { @@ -4307,85 +4307,85 @@ pub mod notebook_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Authors; type Uri; - type IndexedAt; type Record; - type Authors; type Cid; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Authors = Unset; type Uri = Unset; - type IndexedAt = Unset; type Record = Unset; - type Authors = Unset; type Cid = Unset; + type IndexedAt = Unset; + } + ///State transition - sets the `authors` field to Set + pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthors<S> {} + impl<S: State> State for SetAuthors<S> { + type Authors = Set<members::authors>; + type Uri = S::Uri; + type Record = S::Record; + type Cid = S::Cid; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Uri = Set<members::uri>; - type IndexedAt = S::IndexedAt; - type Record = S::Record; type Authors = S::Authors; - type Cid = S::Cid; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Uri = S::Uri; - type IndexedAt = Set<members::indexed_at>; + type Uri = Set<members::uri>; type Record = S::Record; - type Authors = S::Authors; type Cid = S::Cid; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { + type Authors = S::Authors; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; type Record = Set<members::record>; - type Authors = S::Authors; type Cid = S::Cid; - } - ///State transition - sets the `authors` field to Set - pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthors<S> {} - impl<S: State> State for SetAuthors<S> { - type Uri = S::Uri; type IndexedAt = S::IndexedAt; - type Record = S::Record; - type Authors = Set<members::authors>; - type Cid = S::Cid; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { + type Authors = S::Authors; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; type Record = S::Record; - type Authors = S::Authors; type Cid = Set<members::cid>; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Authors = S::Authors; + type Uri = S::Uri; + type Record = S::Record; + type Cid = S::Cid; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `authors` field + pub struct authors(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `record` field pub struct record(()); - ///Marker type for the `authors` field - pub struct authors(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -4752,11 +4752,11 @@ impl<'a, S: notebook_view_state::State> NotebookViewBuilder<'a, S> { impl<'a, S> NotebookViewBuilder<'a, S> where S: notebook_view_state::State, + S::Authors: notebook_view_state::IsSet, S::Uri: notebook_view_state::IsSet, - S::IndexedAt: notebook_view_state::IsSet, S::Record: notebook_view_state::IsSet, - S::Authors: notebook_view_state::IsSet, S::Cid: notebook_view_state::IsSet, + S::IndexedAt: notebook_view_state::IsSet, { /// Build the final struct pub fn build(self) -> NotebookView<'a> { @@ -4871,85 +4871,85 @@ pub mod page_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; type Uri; - type Record; - type IndexedAt; + type Notebook; type Cid; + type IndexedAt; + type Record; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; type Uri = Unset; - type Record = Unset; - type IndexedAt = Unset; + type Notebook = Unset; type Cid = Unset; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotebook<S> {} - impl<S: State> State for SetNotebook<S> { - type Notebook = Set<members::notebook>; - type Uri = S::Uri; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; + type IndexedAt = Unset; + type Record = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Notebook = S::Notebook; type Uri = Set<members::uri>; - type Record = S::Record; + type Notebook = S::Notebook; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; + type Record = S::Record; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotebook<S> {} + impl<S: State> State for SetNotebook<S> { + type Uri = S::Uri; + type Notebook = Set<members::notebook>; type Cid = S::Cid; + type IndexedAt = S::IndexedAt; + type Record = S::Record; } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { - type Notebook = S::Notebook; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Uri = S::Uri; - type Record = Set<members::record>; + type Notebook = S::Notebook; + type Cid = Set<members::cid>; type IndexedAt = S::IndexedAt; - type Cid = S::Cid; + type Record = S::Record; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Notebook = S::Notebook; type Uri = S::Uri; - type Record = S::Record; - type IndexedAt = Set<members::indexed_at>; + type Notebook = S::Notebook; type Cid = S::Cid; + type IndexedAt = Set<members::indexed_at>; + type Record = S::Record; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Notebook = S::Notebook; + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { type Uri = S::Uri; - type Record = S::Record; + type Notebook = S::Notebook; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; - type Cid = Set<members::cid>; + type Record = Set<members::record>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `record` field - pub struct record(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); + ///Marker type for the `notebook` field + pub struct notebook(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `record` field + pub struct record(()); } } @@ -5136,11 +5136,11 @@ where impl<'a, S> PageViewBuilder<'a, S> where S: page_view_state::State, - S::Notebook: page_view_state::IsSet, S::Uri: page_view_state::IsSet, - S::Record: page_view_state::IsSet, - S::IndexedAt: page_view_state::IsSet, + S::Notebook: page_view_state::IsSet, S::Cid: page_view_state::IsSet, + S::IndexedAt: page_view_state::IsSet, + S::Record: page_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PageView<'a> { @@ -5233,66 +5233,66 @@ pub mod permission_grant_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type GrantedAt; - type Did; - type Source; type Scope; + type Source; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type GrantedAt = Unset; - type Did = Unset; - type Source = Unset; type Scope = Unset; + type Source = Unset; + type Did = Unset; } ///State transition - sets the `granted_at` field to Set pub struct SetGrantedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGrantedAt<S> {} impl<S: State> State for SetGrantedAt<S> { type GrantedAt = Set<members::granted_at>; - type Did = S::Did; - type Source = S::Source; type Scope = S::Scope; + type Source = S::Source; + type Did = S::Did; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { + ///State transition - sets the `scope` field to Set + pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetScope<S> {} + impl<S: State> State for SetScope<S> { type GrantedAt = S::GrantedAt; - type Did = Set<members::did>; + type Scope = Set<members::scope>; type Source = S::Source; - type Scope = S::Scope; + type Did = S::Did; } ///State transition - sets the `source` field to Set pub struct SetSource<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSource<S> {} impl<S: State> State for SetSource<S> { type GrantedAt = S::GrantedAt; - type Did = S::Did; - type Source = Set<members::source>; type Scope = S::Scope; + type Source = Set<members::source>; + type Did = S::Did; } - ///State transition - sets the `scope` field to Set - pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetScope<S> {} - impl<S: State> State for SetScope<S> { + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { type GrantedAt = S::GrantedAt; - type Did = S::Did; + type Scope = S::Scope; type Source = S::Source; - type Scope = Set<members::scope>; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `granted_at` field pub struct granted_at(()); - ///Marker type for the `did` field - pub struct did(()); - ///Marker type for the `source` field - pub struct source(()); ///Marker type for the `scope` field pub struct scope(()); + ///Marker type for the `source` field + pub struct source(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -5406,9 +5406,9 @@ impl<'a, S> PermissionGrantBuilder<'a, S> where S: permission_grant_state::State, S::GrantedAt: permission_grant_state::IsSet, - S::Did: permission_grant_state::IsSet, - S::Source: permission_grant_state::IsSet, S::Scope: permission_grant_state::IsSet, + S::Source: permission_grant_state::IsSet, + S::Did: permission_grant_state::IsSet, { /// Build the final struct pub fn build(self) -> PermissionGrant<'a> { @@ -5757,67 +5757,67 @@ pub mod published_version_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Publisher; + type Uri; type PublishedAt; + type Publisher; type Cid; - type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Publisher = Unset; + type Uri = Unset; type PublishedAt = Unset; + type Publisher = Unset; type Cid = Unset; - type Uri = Unset; } - ///State transition - sets the `publisher` field to Set - pub struct SetPublisher<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPublisher<S> {} - impl<S: State> State for SetPublisher<S> { - type Publisher = Set<members::publisher>; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; type PublishedAt = S::PublishedAt; + type Publisher = S::Publisher; type Cid = S::Cid; - type Uri = S::Uri; } ///State transition - sets the `published_at` field to Set pub struct SetPublishedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPublishedAt<S> {} impl<S: State> State for SetPublishedAt<S> { - type Publisher = S::Publisher; + type Uri = S::Uri; type PublishedAt = Set<members::published_at>; + type Publisher = S::Publisher; type Cid = S::Cid; + } + ///State transition - sets the `publisher` field to Set + pub struct SetPublisher<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPublisher<S> {} + impl<S: State> State for SetPublisher<S> { type Uri = S::Uri; + type PublishedAt = S::PublishedAt; + type Publisher = Set<members::publisher>; + type Cid = S::Cid; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { - type Publisher = S::Publisher; - type PublishedAt = S::PublishedAt; - type Cid = Set<members::cid>; type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Publisher = S::Publisher; type PublishedAt = S::PublishedAt; - type Cid = S::Cid; - type Uri = Set<members::uri>; + type Publisher = S::Publisher; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `publisher` field - pub struct publisher(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `published_at` field pub struct published_at(()); + ///Marker type for the `publisher` field + pub struct publisher(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); } } @@ -5990,10 +5990,10 @@ where impl<'a, S> PublishedVersionViewBuilder<'a, S> where S: published_version_view_state::State, - S::Publisher: published_version_view_state::IsSet, + S::Uri: published_version_view_state::IsSet, S::PublishedAt: published_version_view_state::IsSet, + S::Publisher: published_version_view_state::IsSet, S::Cid: published_version_view_state::IsSet, - S::Uri: published_version_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PublishedVersionView<'a> { @@ -6417,37 +6417,37 @@ pub mod reason_like_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type By; type IndexedAt; + type By; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type By = Unset; type IndexedAt = Unset; - } - ///State transition - sets the `by` field to Set - pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBy<S> {} - impl<S: State> State for SetBy<S> { - type By = Set<members::by>; - type IndexedAt = S::IndexedAt; + type By = Unset; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type By = S::By; type IndexedAt = Set<members::indexed_at>; + type By = S::By; + } + ///State transition - sets the `by` field to Set + pub struct SetBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBy<S> {} + impl<S: State> State for SetBy<S> { + type IndexedAt = S::IndexedAt; + type By = Set<members::by>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `by` field - pub struct by(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `by` field + pub struct by(()); } } @@ -6520,8 +6520,8 @@ where impl<'a, S> ReasonLikeBuilder<'a, S> where S: reason_like_state::State, - S::By: reason_like_state::IsSet, S::IndexedAt: reason_like_state::IsSet, + S::By: reason_like_state::IsSet, { /// Build the final struct pub fn build(self) -> ReasonLike<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/chapter.rs b/crates/jacquard-api/src/sh_weaver/notebook/chapter.rs index 56948061..554370c6 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/chapter.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/chapter.rs @@ -54,51 +54,51 @@ pub mod chapter_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Notebook; - type EntryList; type Authors; + type EntryList; + type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Notebook = Unset; - type EntryList = Unset; type Authors = Unset; + type EntryList = Unset; + type Notebook = Unset; } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotebook<S> {} - impl<S: State> State for SetNotebook<S> { - type Notebook = Set<members::notebook>; + ///State transition - sets the `authors` field to Set + pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthors<S> {} + impl<S: State> State for SetAuthors<S> { + type Authors = Set<members::authors>; type EntryList = S::EntryList; - type Authors = S::Authors; + type Notebook = S::Notebook; } ///State transition - sets the `entry_list` field to Set pub struct SetEntryList<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEntryList<S> {} impl<S: State> State for SetEntryList<S> { - type Notebook = S::Notebook; - type EntryList = Set<members::entry_list>; type Authors = S::Authors; - } - ///State transition - sets the `authors` field to Set - pub struct SetAuthors<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthors<S> {} - impl<S: State> State for SetAuthors<S> { + type EntryList = Set<members::entry_list>; type Notebook = S::Notebook; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotebook<S> {} + impl<S: State> State for SetNotebook<S> { + type Authors = S::Authors; type EntryList = S::EntryList; - type Authors = Set<members::authors>; + type Notebook = Set<members::notebook>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `notebook` field - pub struct notebook(()); - ///Marker type for the `entry_list` field - pub struct entry_list(()); ///Marker type for the `authors` field pub struct authors(()); + ///Marker type for the `entry_list` field + pub struct entry_list(()); + ///Marker type for the `notebook` field + pub struct notebook(()); } } @@ -291,9 +291,9 @@ impl<'a, S: chapter_state::State> ChapterBuilder<'a, S> { impl<'a, S> ChapterBuilder<'a, S> where S: chapter_state::State, - S::Notebook: chapter_state::IsSet, - S::EntryList: chapter_state::IsSet, S::Authors: chapter_state::IsSet, + S::EntryList: chapter_state::IsSet, + S::Notebook: chapter_state::IsSet, { /// Build the final struct pub fn build(self) -> Chapter<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/colour_scheme.rs b/crates/jacquard-api/src/sh_weaver/notebook/colour_scheme.rs index 5a9b8db1..4483a55e 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/colour_scheme.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/colour_scheme.rs @@ -39,50 +39,50 @@ pub mod colour_scheme_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Name; - type Colours; type Variant; + type Colours; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Name = Unset; - type Colours = Unset; type Variant = Unset; + type Colours = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { type Name = Set<members::name>; - type Colours = S::Colours; - type Variant = S::Variant; - } - ///State transition - sets the `colours` field to Set - pub struct SetColours<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetColours<S> {} - impl<S: State> State for SetColours<S> { - type Name = S::Name; - type Colours = Set<members::colours>; type Variant = S::Variant; + type Colours = S::Colours; } ///State transition - sets the `variant` field to Set pub struct SetVariant<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVariant<S> {} impl<S: State> State for SetVariant<S> { type Name = S::Name; - type Colours = S::Colours; type Variant = Set<members::variant>; + type Colours = S::Colours; + } + ///State transition - sets the `colours` field to Set + pub struct SetColours<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetColours<S> {} + impl<S: State> State for SetColours<S> { + type Name = S::Name; + type Variant = S::Variant; + type Colours = Set<members::colours>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `colours` field - pub struct colours(()); ///Marker type for the `variant` field pub struct variant(()); + ///Marker type for the `colours` field + pub struct colours(()); } } @@ -176,8 +176,8 @@ impl<'a, S> ColourSchemeBuilder<'a, S> where S: colour_scheme_state::State, S::Name: colour_scheme_state::IsSet, - S::Colours: colour_scheme_state::IsSet, S::Variant: colour_scheme_state::IsSet, + S::Colours: colour_scheme_state::IsSet, { /// Build the final struct pub fn build(self) -> ColourScheme<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/entry.rs b/crates/jacquard-api/src/sh_weaver/notebook/entry.rs index 3edc016c..6c380b6a 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/entry.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/entry.rs @@ -60,67 +60,67 @@ pub mod entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type CreatedAt; + type Content; type Path; type Title; - type Content; - type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type CreatedAt = Unset; + type Content = Unset; type Path = Unset; type Title = Unset; - type Content = Unset; - type CreatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Content = S::Content; + type Path = S::Path; + type Title = S::Title; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type CreatedAt = S::CreatedAt; + type Content = Set<members::content>; + type Path = S::Path; + type Title = S::Title; } ///State transition - sets the `path` field to Set pub struct SetPath<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPath<S> {} impl<S: State> State for SetPath<S> { + type CreatedAt = S::CreatedAt; + type Content = S::Content; type Path = Set<members::path>; type Title = S::Title; - type Content = S::Content; - type CreatedAt = S::CreatedAt; } ///State transition - sets the `title` field to Set pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTitle<S> {} impl<S: State> State for SetTitle<S> { - type Path = S::Path; - type Title = Set<members::title>; - type Content = S::Content; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type Path = S::Path; - type Title = S::Title; - type Content = Set<members::content>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type Path = S::Path; - type Title = S::Title; type Content = S::Content; - type CreatedAt = Set<members::created_at>; + type Path = S::Path; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `content` field + pub struct content(()); ///Marker type for the `path` field pub struct path(()); ///Marker type for the `title` field pub struct title(()); - ///Marker type for the `content` field - pub struct content(()); - ///Marker type for the `created_at` field - pub struct created_at(()); } } @@ -358,10 +358,10 @@ impl<'a, S: entry_state::State> EntryBuilder<'a, S> { impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, + S::CreatedAt: entry_state::IsSet, + S::Content: entry_state::IsSet, S::Path: entry_state::IsSet, S::Title: entry_state::IsSet, - S::Content: entry_state::IsSet, - S::CreatedAt: entry_state::IsSet, { /// Build the final struct pub fn build(self) -> Entry<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/get_entry_notebooks.rs b/crates/jacquard-api/src/sh_weaver/notebook/get_entry_notebooks.rs index c44c50bd..10e5538a 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/get_entry_notebooks.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/get_entry_notebooks.rs @@ -188,37 +188,37 @@ pub mod notebook_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type Uri; + type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type Uri = Unset; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type Uri = S::Uri; + type Cid = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { - type Cid = S::Cid; type Uri = Set<members::uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Uri = S::Uri; + type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); } } @@ -328,8 +328,8 @@ where impl<'a, S> NotebookRefBuilder<'a, S> where S: notebook_ref_state::State, - S::Cid: notebook_ref_state::IsSet, S::Uri: notebook_ref_state::IsSet, + S::Cid: notebook_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> NotebookRef<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/get_notebook_by_title.rs b/crates/jacquard-api/src/sh_weaver/notebook/get_notebook_by_title.rs index bc519e48..94d26954 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/get_notebook_by_title.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/get_notebook_by_title.rs @@ -32,37 +32,37 @@ pub mod get_notebook_by_title_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Title; type Actor; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Title = Unset; type Actor = Unset; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Title = Set<members::title>; - type Actor = S::Actor; + type Title = Unset; } ///State transition - sets the `actor` field to Set pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActor<S> {} impl<S: State> State for SetActor<S> { - type Title = S::Title; type Actor = Set<members::actor>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Actor = S::Actor; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `actor` field pub struct actor(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> GetNotebookByTitleBuilder<'a, S> where S: get_notebook_by_title_state::State, - S::Title: get_notebook_by_title_state::IsSet, S::Actor: get_notebook_by_title_state::IsSet, + S::Title: get_notebook_by_title_state::IsSet, { /// Build the final struct pub fn build(self) -> GetNotebookByTitle<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/get_reading_history.rs b/crates/jacquard-api/src/sh_weaver/notebook/get_reading_history.rs index ff8988d9..0b245421 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/get_reading_history.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/get_reading_history.rs @@ -214,37 +214,37 @@ pub mod reading_history_item_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Progress; type Notebook; + type Progress; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Progress = Unset; type Notebook = Unset; - } - ///State transition - sets the `progress` field to Set - pub struct SetProgress<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetProgress<S> {} - impl<S: State> State for SetProgress<S> { - type Progress = Set<members::progress>; - type Notebook = S::Notebook; + type Progress = Unset; } ///State transition - sets the `notebook` field to Set pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNotebook<S> {} impl<S: State> State for SetNotebook<S> { - type Progress = S::Progress; type Notebook = Set<members::notebook>; + type Progress = S::Progress; + } + ///State transition - sets the `progress` field to Set + pub struct SetProgress<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetProgress<S> {} + impl<S: State> State for SetProgress<S> { + type Notebook = S::Notebook; + type Progress = Set<members::progress>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `progress` field - pub struct progress(()); ///Marker type for the `notebook` field pub struct notebook(()); + ///Marker type for the `progress` field + pub struct progress(()); } } @@ -337,8 +337,8 @@ where impl<'a, S> ReadingHistoryItemBuilder<'a, S> where S: reading_history_item_state::State, - S::Progress: reading_history_item_state::IsSet, S::Notebook: reading_history_item_state::IsSet, + S::Progress: reading_history_item_state::IsSet, { /// Build the final struct pub fn build(self) -> ReadingHistoryItem<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/resolve_entry.rs b/crates/jacquard-api/src/sh_weaver/notebook/resolve_entry.rs index afce7726..89db5044 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/resolve_entry.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/resolve_entry.rs @@ -34,51 +34,51 @@ pub mod resolve_entry_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Notebook; type Actor; type Entry; - type Notebook; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Notebook = Unset; type Actor = Unset; type Entry = Unset; - type Notebook = Unset; + } + ///State transition - sets the `notebook` field to Set + pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNotebook<S> {} + impl<S: State> State for SetNotebook<S> { + type Notebook = Set<members::notebook>; + type Actor = S::Actor; + type Entry = S::Entry; } ///State transition - sets the `actor` field to Set pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActor<S> {} impl<S: State> State for SetActor<S> { + type Notebook = S::Notebook; type Actor = Set<members::actor>; type Entry = S::Entry; - type Notebook = S::Notebook; } ///State transition - sets the `entry` field to Set pub struct SetEntry<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEntry<S> {} impl<S: State> State for SetEntry<S> { - type Actor = S::Actor; - type Entry = Set<members::entry>; type Notebook = S::Notebook; - } - ///State transition - sets the `notebook` field to Set - pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNotebook<S> {} - impl<S: State> State for SetNotebook<S> { type Actor = S::Actor; - type Entry = S::Entry; - type Notebook = Set<members::notebook>; + type Entry = Set<members::entry>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `notebook` field + pub struct notebook(()); ///Marker type for the `actor` field pub struct actor(()); ///Marker type for the `entry` field pub struct entry(()); - ///Marker type for the `notebook` field - pub struct notebook(()); } } @@ -171,9 +171,9 @@ where impl<'a, S> ResolveEntryBuilder<'a, S> where S: resolve_entry_state::State, + S::Notebook: resolve_entry_state::IsSet, S::Actor: resolve_entry_state::IsSet, S::Entry: resolve_entry_state::IsSet, - S::Notebook: resolve_entry_state::IsSet, { /// Build the final struct pub fn build(self) -> ResolveEntry<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notebook/theme.rs b/crates/jacquard-api/src/sh_weaver/notebook/theme.rs index 588b068f..b25f1f87 100644 --- a/crates/jacquard-api/src/sh_weaver/notebook/theme.rs +++ b/crates/jacquard-api/src/sh_weaver/notebook/theme.rs @@ -36,51 +36,51 @@ pub mod code_theme_file_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Content; type Name; type Did; - type Content; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Content = Unset; type Name = Unset; type Did = Unset; - type Content = Unset; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Content = Set<members::content>; + type Name = S::Name; + type Did = S::Did; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type Content = S::Content; type Name = Set<members::name>; type Did = S::Did; - type Content = S::Content; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type Name = S::Name; - type Did = Set<members::did>; type Content = S::Content; - } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { type Name = S::Name; - type Did = S::Did; - type Content = Set<members::content>; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `content` field + pub struct content(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `content` field - pub struct content(()); } } @@ -173,9 +173,9 @@ where impl<'a, S> CodeThemeFileBuilder<'a, S> where S: code_theme_file_state::State, + S::Content: code_theme_file_state::IsSet, S::Name: code_theme_file_state::IsSet, S::Did: code_theme_file_state::IsSet, - S::Content: code_theme_file_state::IsSet, { /// Build the final struct pub fn build(self) -> CodeThemeFile<'a> { @@ -838,50 +838,50 @@ pub mod font_file_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Content; - type Name; type Did; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Content = Unset; - type Name = Unset; type Did = Unset; + type Name = Unset; } ///State transition - sets the `content` field to Set pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetContent<S> {} impl<S: State> State for SetContent<S> { type Content = Set<members::content>; - type Name = S::Name; - type Did = S::Did; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Content = S::Content; - type Name = Set<members::name>; type Did = S::Did; + type Name = S::Name; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { type Content = S::Content; - type Name = S::Name; type Did = Set<members::did>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Content = S::Content; + type Did = S::Did; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `content` field pub struct content(()); - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -975,8 +975,8 @@ impl<'a, S> FontFileBuilder<'a, S> where S: font_file_state::State, S::Content: font_file_state::IsSet, - S::Name: font_file_state::IsSet, S::Did: font_file_state::IsSet, + S::Name: font_file_state::IsSet, { /// Build the final struct pub fn build(self) -> FontFile<'a> { @@ -1067,105 +1067,105 @@ pub mod theme_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type DarkCodeTheme; + type Fonts; type LightCodeTheme; - type DarkScheme; type LightScheme; + type DarkScheme; type Spacing; - type Fonts; - type DarkCodeTheme; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type DarkCodeTheme = Unset; + type Fonts = Unset; type LightCodeTheme = Unset; - type DarkScheme = Unset; type LightScheme = Unset; + type DarkScheme = Unset; type Spacing = Unset; - type Fonts = Unset; - type DarkCodeTheme = Unset; } - ///State transition - sets the `light_code_theme` field to Set - pub struct SetLightCodeTheme<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLightCodeTheme<S> {} - impl<S: State> State for SetLightCodeTheme<S> { - type LightCodeTheme = Set<members::light_code_theme>; - type DarkScheme = S::DarkScheme; + ///State transition - sets the `dark_code_theme` field to Set + pub struct SetDarkCodeTheme<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDarkCodeTheme<S> {} + impl<S: State> State for SetDarkCodeTheme<S> { + type DarkCodeTheme = Set<members::dark_code_theme>; + type Fonts = S::Fonts; + type LightCodeTheme = S::LightCodeTheme; type LightScheme = S::LightScheme; + type DarkScheme = S::DarkScheme; type Spacing = S::Spacing; - type Fonts = S::Fonts; - type DarkCodeTheme = S::DarkCodeTheme; } - ///State transition - sets the `dark_scheme` field to Set - pub struct SetDarkScheme<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDarkScheme<S> {} - impl<S: State> State for SetDarkScheme<S> { + ///State transition - sets the `fonts` field to Set + pub struct SetFonts<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetFonts<S> {} + impl<S: State> State for SetFonts<S> { + type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = Set<members::fonts>; type LightCodeTheme = S::LightCodeTheme; - type DarkScheme = Set<members::dark_scheme>; type LightScheme = S::LightScheme; + type DarkScheme = S::DarkScheme; type Spacing = S::Spacing; - type Fonts = S::Fonts; + } + ///State transition - sets the `light_code_theme` field to Set + pub struct SetLightCodeTheme<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLightCodeTheme<S> {} + impl<S: State> State for SetLightCodeTheme<S> { type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = S::Fonts; + type LightCodeTheme = Set<members::light_code_theme>; + type LightScheme = S::LightScheme; + type DarkScheme = S::DarkScheme; + type Spacing = S::Spacing; } ///State transition - sets the `light_scheme` field to Set pub struct SetLightScheme<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLightScheme<S> {} impl<S: State> State for SetLightScheme<S> { + type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = S::Fonts; type LightCodeTheme = S::LightCodeTheme; - type DarkScheme = S::DarkScheme; type LightScheme = Set<members::light_scheme>; + type DarkScheme = S::DarkScheme; type Spacing = S::Spacing; - type Fonts = S::Fonts; + } + ///State transition - sets the `dark_scheme` field to Set + pub struct SetDarkScheme<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDarkScheme<S> {} + impl<S: State> State for SetDarkScheme<S> { type DarkCodeTheme = S::DarkCodeTheme; + type Fonts = S::Fonts; + type LightCodeTheme = S::LightCodeTheme; + type LightScheme = S::LightScheme; + type DarkScheme = Set<members::dark_scheme>; + type Spacing = S::Spacing; } ///State transition - sets the `spacing` field to Set pub struct SetSpacing<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSpacing<S> {} impl<S: State> State for SetSpacing<S> { - type LightCodeTheme = S::LightCodeTheme; - type DarkScheme = S::DarkScheme; - type LightScheme = S::LightScheme; - type Spacing = Set<members::spacing>; - type Fonts = S::Fonts; type DarkCodeTheme = S::DarkCodeTheme; - } - ///State transition - sets the `fonts` field to Set - pub struct SetFonts<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetFonts<S> {} - impl<S: State> State for SetFonts<S> { + type Fonts = S::Fonts; type LightCodeTheme = S::LightCodeTheme; - type DarkScheme = S::DarkScheme; type LightScheme = S::LightScheme; - type Spacing = S::Spacing; - type Fonts = Set<members::fonts>; - type DarkCodeTheme = S::DarkCodeTheme; - } - ///State transition - sets the `dark_code_theme` field to Set - pub struct SetDarkCodeTheme<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDarkCodeTheme<S> {} - impl<S: State> State for SetDarkCodeTheme<S> { - type LightCodeTheme = S::LightCodeTheme; type DarkScheme = S::DarkScheme; - type LightScheme = S::LightScheme; - type Spacing = S::Spacing; - type Fonts = S::Fonts; - type DarkCodeTheme = Set<members::dark_code_theme>; + type Spacing = Set<members::spacing>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `dark_code_theme` field + pub struct dark_code_theme(()); + ///Marker type for the `fonts` field + pub struct fonts(()); ///Marker type for the `light_code_theme` field pub struct light_code_theme(()); - ///Marker type for the `dark_scheme` field - pub struct dark_scheme(()); ///Marker type for the `light_scheme` field pub struct light_scheme(()); + ///Marker type for the `dark_scheme` field + pub struct dark_scheme(()); ///Marker type for the `spacing` field pub struct spacing(()); - ///Marker type for the `fonts` field - pub struct fonts(()); - ///Marker type for the `dark_code_theme` field - pub struct dark_code_theme(()); } } @@ -1338,12 +1338,12 @@ where impl<'a, S> ThemeBuilder<'a, S> where S: theme_state::State, + S::DarkCodeTheme: theme_state::IsSet, + S::Fonts: theme_state::IsSet, S::LightCodeTheme: theme_state::IsSet, - S::DarkScheme: theme_state::IsSet, S::LightScheme: theme_state::IsSet, + S::DarkScheme: theme_state::IsSet, S::Spacing: theme_state::IsSet, - S::Fonts: theme_state::IsSet, - S::DarkCodeTheme: theme_state::IsSet, { /// Build the final struct pub fn build(self) -> Theme<'a> { @@ -1442,51 +1442,51 @@ pub mod theme_fonts_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Body; type Heading; type Monospace; + type Body; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Body = Unset; type Heading = Unset; type Monospace = Unset; - } - ///State transition - sets the `body` field to Set - pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBody<S> {} - impl<S: State> State for SetBody<S> { - type Body = Set<members::body>; - type Heading = S::Heading; - type Monospace = S::Monospace; + type Body = Unset; } ///State transition - sets the `heading` field to Set pub struct SetHeading<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeading<S> {} impl<S: State> State for SetHeading<S> { - type Body = S::Body; type Heading = Set<members::heading>; type Monospace = S::Monospace; + type Body = S::Body; } ///State transition - sets the `monospace` field to Set pub struct SetMonospace<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMonospace<S> {} impl<S: State> State for SetMonospace<S> { - type Body = S::Body; type Heading = S::Heading; type Monospace = Set<members::monospace>; + type Body = S::Body; + } + ///State transition - sets the `body` field to Set + pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBody<S> {} + impl<S: State> State for SetBody<S> { + type Heading = S::Heading; + type Monospace = S::Monospace; + type Body = Set<members::body>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `body` field - pub struct body(()); ///Marker type for the `heading` field pub struct heading(()); ///Marker type for the `monospace` field pub struct monospace(()); + ///Marker type for the `body` field + pub struct body(()); } } @@ -1579,9 +1579,9 @@ where impl<'a, S> ThemeFontsBuilder<'a, S> where S: theme_fonts_state::State, - S::Body: theme_fonts_state::IsSet, S::Heading: theme_fonts_state::IsSet, S::Monospace: theme_fonts_state::IsSet, + S::Body: theme_fonts_state::IsSet, { /// Build the final struct pub fn build(self) -> ThemeFonts<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/notification.rs b/crates/jacquard-api/src/sh_weaver/notification.rs index e6fd8a43..da326868 100644 --- a/crates/jacquard-api/src/sh_weaver/notification.rs +++ b/crates/jacquard-api/src/sh_weaver/notification.rs @@ -53,104 +53,104 @@ pub mod notification_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; - type Author; type Cid; type Reason; - type IndexedAt; + type Author; type IsRead; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; - type Author = Unset; type Cid = Unset; type Reason = Unset; - type IndexedAt = Unset; + type Author = Unset; type IsRead = Unset; + type IndexedAt = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Uri = Set<members::uri>; - type Author = S::Author; type Cid = S::Cid; type Reason = S::Reason; - type IndexedAt = S::IndexedAt; + type Author = S::Author; type IsRead = S::IsRead; - } - ///State transition - sets the `author` field to Set - pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAuthor<S> {} - impl<S: State> State for SetAuthor<S> { - type Uri = S::Uri; - type Author = Set<members::author>; - type Cid = S::Cid; - type Reason = S::Reason; type IndexedAt = S::IndexedAt; - type IsRead = S::IsRead; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Uri = S::Uri; - type Author = S::Author; type Cid = Set<members::cid>; type Reason = S::Reason; - type IndexedAt = S::IndexedAt; + type Author = S::Author; type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { type Uri = S::Uri; - type Author = S::Author; type Cid = S::Cid; type Reason = Set<members::reason>; - type IndexedAt = S::IndexedAt; + type Author = S::Author; type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { type Uri = S::Uri; - type Author = S::Author; type Cid = S::Cid; type Reason = S::Reason; - type IndexedAt = Set<members::indexed_at>; + type Author = Set<members::author>; type IsRead = S::IsRead; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `is_read` field to Set pub struct SetIsRead<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIsRead<S> {} impl<S: State> State for SetIsRead<S> { type Uri = S::Uri; - type Author = S::Author; type Cid = S::Cid; type Reason = S::Reason; - type IndexedAt = S::IndexedAt; + type Author = S::Author; type IsRead = Set<members::is_read>; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { + type Uri = S::Uri; + type Cid = S::Cid; + type Reason = S::Reason; + type Author = S::Author; + type IsRead = S::IsRead; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `author` field - pub struct author(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `reason` field pub struct reason(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); + ///Marker type for the `author` field + pub struct author(()); ///Marker type for the `is_read` field pub struct is_read(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -344,11 +344,11 @@ impl<'a, S> NotificationBuilder<'a, S> where S: notification_state::State, S::Uri: notification_state::IsSet, - S::Author: notification_state::IsSet, S::Cid: notification_state::IsSet, S::Reason: notification_state::IsSet, - S::IndexedAt: notification_state::IsSet, + S::Author: notification_state::IsSet, S::IsRead: notification_state::IsSet, + S::IndexedAt: notification_state::IsSet, { /// Build the final struct pub fn build(self) -> Notification<'a> { @@ -801,83 +801,83 @@ pub mod notification_group_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Count; - type Actors; type Reason; type Subject; + type Count; + type Actors; type MostRecentAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Count = Unset; - type Actors = Unset; type Reason = Unset; type Subject = Unset; + type Count = Unset; + type Actors = Unset; type MostRecentAt = Unset; } - ///State transition - sets the `count` field to Set - pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCount<S> {} - impl<S: State> State for SetCount<S> { - type Count = Set<members::count>; - type Actors = S::Actors; - type Reason = S::Reason; - type Subject = S::Subject; - type MostRecentAt = S::MostRecentAt; - } - ///State transition - sets the `actors` field to Set - pub struct SetActors<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetActors<S> {} - impl<S: State> State for SetActors<S> { - type Count = S::Count; - type Actors = Set<members::actors>; - type Reason = S::Reason; - type Subject = S::Subject; - type MostRecentAt = S::MostRecentAt; - } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { - type Count = S::Count; - type Actors = S::Actors; type Reason = Set<members::reason>; type Subject = S::Subject; + type Count = S::Count; + type Actors = S::Actors; type MostRecentAt = S::MostRecentAt; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { + type Reason = S::Reason; + type Subject = Set<members::subject>; type Count = S::Count; type Actors = S::Actors; + type MostRecentAt = S::MostRecentAt; + } + ///State transition - sets the `count` field to Set + pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCount<S> {} + impl<S: State> State for SetCount<S> { type Reason = S::Reason; - type Subject = Set<members::subject>; + type Subject = S::Subject; + type Count = Set<members::count>; + type Actors = S::Actors; + type MostRecentAt = S::MostRecentAt; + } + ///State transition - sets the `actors` field to Set + pub struct SetActors<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActors<S> {} + impl<S: State> State for SetActors<S> { + type Reason = S::Reason; + type Subject = S::Subject; + type Count = S::Count; + type Actors = Set<members::actors>; type MostRecentAt = S::MostRecentAt; } ///State transition - sets the `most_recent_at` field to Set pub struct SetMostRecentAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMostRecentAt<S> {} impl<S: State> State for SetMostRecentAt<S> { - type Count = S::Count; - type Actors = S::Actors; type Reason = S::Reason; type Subject = S::Subject; + type Count = S::Count; + type Actors = S::Actors; type MostRecentAt = Set<members::most_recent_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `count` field - pub struct count(()); - ///Marker type for the `actors` field - pub struct actors(()); ///Marker type for the `reason` field pub struct reason(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `count` field + pub struct count(()); + ///Marker type for the `actors` field + pub struct actors(()); ///Marker type for the `most_recent_at` field pub struct most_recent_at(()); } @@ -1026,10 +1026,10 @@ where impl<'a, S> NotificationGroupBuilder<'a, S> where S: notification_group_state::State, - S::Count: notification_group_state::IsSet, - S::Actors: notification_group_state::IsSet, S::Reason: notification_group_state::IsSet, S::Subject: notification_group_state::IsSet, + S::Count: notification_group_state::IsSet, + S::Actors: notification_group_state::IsSet, S::MostRecentAt: notification_group_state::IsSet, { /// Build the final struct @@ -1292,51 +1292,51 @@ pub mod subscription_update_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type UpdatedAt; - type Notebook; type NewEntries; + type Notebook; + type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type UpdatedAt = Unset; - type Notebook = Unset; type NewEntries = Unset; + type Notebook = Unset; + type UpdatedAt = Unset; } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type UpdatedAt = Set<members::updated_at>; + ///State transition - sets the `new_entries` field to Set + pub struct SetNewEntries<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetNewEntries<S> {} + impl<S: State> State for SetNewEntries<S> { + type NewEntries = Set<members::new_entries>; type Notebook = S::Notebook; - type NewEntries = S::NewEntries; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `notebook` field to Set pub struct SetNotebook<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNotebook<S> {} impl<S: State> State for SetNotebook<S> { - type UpdatedAt = S::UpdatedAt; - type Notebook = Set<members::notebook>; type NewEntries = S::NewEntries; - } - ///State transition - sets the `new_entries` field to Set - pub struct SetNewEntries<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetNewEntries<S> {} - impl<S: State> State for SetNewEntries<S> { + type Notebook = Set<members::notebook>; type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type NewEntries = S::NewEntries; type Notebook = S::Notebook; - type NewEntries = Set<members::new_entries>; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `updated_at` field - pub struct updated_at(()); - ///Marker type for the `notebook` field - pub struct notebook(()); ///Marker type for the `new_entries` field pub struct new_entries(()); + ///Marker type for the `notebook` field + pub struct notebook(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); } } @@ -1461,9 +1461,9 @@ impl<'a, S: subscription_update_view_state::State> SubscriptionUpdateViewBuilder impl<'a, S> SubscriptionUpdateViewBuilder<'a, S> where S: subscription_update_view_state::State, - S::UpdatedAt: subscription_update_view_state::IsSet, - S::Notebook: subscription_update_view_state::IsSet, S::NewEntries: subscription_update_view_state::IsSet, + S::Notebook: subscription_update_view_state::IsSet, + S::UpdatedAt: subscription_update_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SubscriptionUpdateView<'a> { diff --git a/crates/jacquard-api/src/sh_weaver/publish/blob.rs b/crates/jacquard-api/src/sh_weaver/publish/blob.rs index b122ec28..51c6b5e7 100644 --- a/crates/jacquard-api/src/sh_weaver/publish/blob.rs +++ b/crates/jacquard-api/src/sh_weaver/publish/blob.rs @@ -36,37 +36,37 @@ pub mod blob_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Path; type Upload; + type Path; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Path = Unset; type Upload = Unset; - } - ///State transition - sets the `path` field to Set - pub struct SetPath<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPath<S> {} - impl<S: State> State for SetPath<S> { - type Path = Set<members::path>; - type Upload = S::Upload; + type Path = Unset; } ///State transition - sets the `upload` field to Set pub struct SetUpload<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpload<S> {} impl<S: State> State for SetUpload<S> { - type Path = S::Path; type Upload = Set<members::upload>; + type Path = S::Path; + } + ///State transition - sets the `path` field to Set + pub struct SetPath<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPath<S> {} + impl<S: State> State for SetPath<S> { + type Upload = S::Upload; + type Path = Set<members::path>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `path` field - pub struct path(()); ///Marker type for the `upload` field pub struct upload(()); + ///Marker type for the `path` field + pub struct path(()); } } @@ -139,8 +139,8 @@ where impl<'a, S> BlobBuilder<'a, S> where S: blob_state::State, - S::Path: blob_state::IsSet, S::Upload: blob_state::IsSet, + S::Path: blob_state::IsSet, { /// Build the final struct pub fn build(self) -> Blob<'a> { diff --git a/crates/jacquard-api/src/site_standard/document.rs b/crates/jacquard-api/src/site_standard/document.rs index 911c93f8..0ac40b33 100644 --- a/crates/jacquard-api/src/site_standard/document.rs +++ b/crates/jacquard-api/src/site_standard/document.rs @@ -5,6 +5,7 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +/// A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently. #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -17,36 +18,45 @@ )] #[serde(rename_all = "camelCase")] pub struct Document<'a> { + /// Strong reference to a Bluesky post. Useful to keep track of comments off-platform. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub bsky_post_ref: std::option::Option< crate::com_atproto::repo::strong_ref::StrongRef<'a>, >, + /// Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] - pub content: std::option::Option<Vec<jacquard_common::types::value::Data<'a>>>, + pub content: std::option::Option<jacquard_common::types::value::Data<'a>>, + /// Image to used for thumbnail or cover image. Less than 1MB is size. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cover_image: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// A brief description or excerpt from the document. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub description: std::option::Option<jacquard_common::CowStr<'a>>, - /// combine with the publication url or the document site to construct a full url to the document + /// Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub path: std::option::Option<jacquard_common::CowStr<'a>>, + /// Timestamp of the documents publish time. pub published_at: jacquard_common::types::string::Datetime, - /// URI to the site or publication this document belongs to (https or at-uri) + /// Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes. #[serde(borrow)] pub site: jacquard_common::types::string::Uri<'a>, + /// Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Plaintext representation of the documents contents. Should not contain markdown or other formatting. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub text_content: std::option::Option<jacquard_common::CowStr<'a>>, + /// Title of the document. #[serde(borrow)] pub title: jacquard_common::CowStr<'a>, + /// Timestamp of the documents last edit. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>, } @@ -114,7 +124,7 @@ pub struct DocumentBuilder<'a, S: document_state::State> { _phantom_state: ::core::marker::PhantomData<fn() -> S>, __unsafe_private_named: ( ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, - ::core::option::Option<Vec<jacquard_common::types::value::Data<'a>>>, + ::core::option::Option<jacquard_common::types::value::Data<'a>>, ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, ::core::option::Option<jacquard_common::CowStr<'a>>, ::core::option::Option<jacquard_common::CowStr<'a>>, @@ -181,7 +191,7 @@ impl<'a, S: document_state::State> DocumentBuilder<'a, S> { /// Set the `content` field (optional) pub fn content( mut self, - value: impl Into<Option<Vec<jacquard_common::types::value::Data<'a>>>>, + value: impl Into<Option<jacquard_common::types::value::Data<'a>>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self @@ -189,7 +199,7 @@ impl<'a, S: document_state::State> DocumentBuilder<'a, S> { /// Set the `content` field to an Option value (optional) pub fn maybe_content( mut self, - value: Option<Vec<jacquard_common::types::value::Data<'a>>>, + value: Option<jacquard_common::types::value::Data<'a>>, ) -> Self { self.__unsafe_private_named.1 = value; self @@ -566,7 +576,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently.", + ), + ), key: Some(::jacquard_common::CowStr::new_static("tid")), record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, @@ -594,15 +608,14 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("content"), - ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { - description: None, - items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { - description: None, - refs: vec![], - closed: Some(false), - }), - min_length: None, - max_length: None, + ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { + description: Some( + ::jacquard_common::CowStr::new_static( + "Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats.", + ), + ), + refs: vec![], + closed: Some(false), }), ); map.insert( @@ -620,7 +633,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD "description", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "A brief description or excerpt from the document.", + ), + ), format: None, default: None, min_length: None, @@ -637,7 +654,7 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( - "combine with the publication url or the document site to construct a full url to the document", + "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash.", ), ), format: None, @@ -656,7 +673,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD "publishedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp of the documents publish time.", + ), + ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), @@ -675,7 +696,7 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( - "URI to the site or publication this document belongs to (https or at-uri)", + "Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes.", ), ), format: Some( @@ -694,7 +715,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD map.insert( ::jacquard_common::smol_str::SmolStr::new_static("tags"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags.", + ), + ), items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, @@ -716,7 +741,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD "textContent", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Plaintext representation of the documents contents. Should not contain markdown or other formatting.", + ), + ), format: None, default: None, min_length: None, @@ -731,7 +760,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD map.insert( ::jacquard_common::smol_str::SmolStr::new_static("title"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Title of the document.", + ), + ), format: None, default: None, min_length: None, @@ -748,7 +781,11 @@ fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconD "updatedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp of the documents last edit.", + ), + ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), diff --git a/crates/jacquard-api/src/site_standard/graph/subscription.rs b/crates/jacquard-api/src/site_standard/graph/subscription.rs index 909f4a7f..df0bdbfb 100644 --- a/crates/jacquard-api/src/site_standard/graph/subscription.rs +++ b/crates/jacquard-api/src/site_standard/graph/subscription.rs @@ -18,6 +18,7 @@ )] #[serde(rename_all = "camelCase")] pub struct Subscription<'a> { + /// AT-URI reference to the publication record being subscribed to (ex: at://did:plc:abc123/site.standard.publication/xyz789). #[serde(borrow)] pub publication: jacquard_common::types::string::AtUri<'a>, } @@ -240,7 +241,11 @@ fn lexicon_doc_site_standard_graph_subscription() -> ::jacquard_lexicon::lexicon "publication", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI reference to the publication record being subscribed to (ex: at://did:plc:abc123/site.standard.publication/xyz789).", + ), + ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), diff --git a/crates/jacquard-api/src/site_standard/publication.rs b/crates/jacquard-api/src/site_standard/publication.rs index a0d2be8b..d2c34070 100644 --- a/crates/jacquard-api/src/site_standard/publication.rs +++ b/crates/jacquard-api/src/site_standard/publication.rs @@ -5,6 +5,7 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +/// A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings. #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -17,22 +18,28 @@ )] #[serde(rename_all = "camelCase")] pub struct Publication<'a> { + /// Simplified publication theme for tools and apps to utilize when displaying content. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub basic_theme: std::option::Option<crate::site_standard::theme::basic::Basic<'a>>, + /// Brief description of the publication. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// Square image to identify the publication. Should be at least 256x256. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub icon: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + /// Name of the publication. #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, + /// Object containing platform specific preferences (with a few shared properties). #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub preferences: std::option::Option< crate::site_standard::publication::Preferences<'a>, >, + /// Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path. #[serde(borrow)] pub url: jacquard_common::types::string::Uri<'a>, } @@ -47,37 +54,37 @@ pub mod publication_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Name; type Url; + type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Name = Unset; type Url = Unset; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { - type Name = Set<members::name>; - type Url = S::Url; + type Name = Unset; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type Name = S::Name; type Url = Set<members::url>; + type Name = S::Name; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Url = S::Url; + type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `name` field - pub struct name(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `name` field + pub struct name(()); } } @@ -230,8 +237,8 @@ where impl<'a, S> PublicationBuilder<'a, S> where S: publication_state::State, - S::Name: publication_state::IsSet, S::Url: publication_state::IsSet, + S::Name: publication_state::IsSet, { /// Build the final struct pub fn build(self) -> Publication<'a> { @@ -418,7 +425,11 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings.", + ), + ), key: Some(::jacquard_common::CowStr::new_static("tid")), record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, @@ -448,7 +459,11 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic "description", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Brief description of the publication.", + ), + ), format: None, default: None, min_length: None, @@ -471,7 +486,11 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Name of the publication.", + ), + ), format: None, default: None, min_length: None, @@ -495,7 +514,11 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("url"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path.", + ), + ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Uri, ), @@ -517,7 +540,11 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("preferences"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Platform-specific preferences for the publication, including discovery and visibility settings.", + ), + ), required: None, nullable: None, properties: { @@ -542,6 +569,7 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic } } +/// Platform-specific preferences for the publication, including discovery and visibility settings. #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -555,6 +583,7 @@ fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::Lexic )] #[serde(rename_all = "camelCase")] pub struct Preferences<'a> { + /// Boolean which decides whether the publication should appear in discovery feeds. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub show_in_discover: std::option::Option<bool>, } diff --git a/crates/jacquard-api/src/site_standard/theme/basic.rs b/crates/jacquard-api/src/site_standard/theme/basic.rs index 8426cfa1..6631032a 100644 --- a/crates/jacquard-api/src/site_standard/theme/basic.rs +++ b/crates/jacquard-api/src/site_standard/theme/basic.rs @@ -5,6 +5,7 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +/// A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications. #[jacquard_derive::lexicon] #[derive( serde::Serialize, @@ -17,12 +18,16 @@ )] #[serde(rename_all = "camelCase")] pub struct Basic<'a> { + /// Color used for links and button backgrounds. #[serde(borrow)] pub accent: crate::site_standard::theme::color::Rgb<'a>, + /// Color used for button text. #[serde(borrow)] pub accent_foreground: crate::site_standard::theme::color::Rgb<'a>, + /// Color used for content background. #[serde(borrow)] pub background: crate::site_standard::theme::color::Rgb<'a>, + /// Color used for content text. #[serde(borrow)] pub foreground: crate::site_standard::theme::color::Rgb<'a>, } @@ -37,67 +42,67 @@ pub mod basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Foreground; + type Background; type Accent; type AccentForeground; - type Background; + type Foreground; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Foreground = Unset; + type Background = Unset; type Accent = Unset; type AccentForeground = Unset; - type Background = Unset; + type Foreground = Unset; } - ///State transition - sets the `foreground` field to Set - pub struct SetForeground<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetForeground<S> {} - impl<S: State> State for SetForeground<S> { - type Foreground = Set<members::foreground>; + ///State transition - sets the `background` field to Set + pub struct SetBackground<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBackground<S> {} + impl<S: State> State for SetBackground<S> { + type Background = Set<members::background>; type Accent = S::Accent; type AccentForeground = S::AccentForeground; - type Background = S::Background; + type Foreground = S::Foreground; } ///State transition - sets the `accent` field to Set pub struct SetAccent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccent<S> {} impl<S: State> State for SetAccent<S> { - type Foreground = S::Foreground; + type Background = S::Background; type Accent = Set<members::accent>; type AccentForeground = S::AccentForeground; - type Background = S::Background; + type Foreground = S::Foreground; } ///State transition - sets the `accent_foreground` field to Set pub struct SetAccentForeground<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccentForeground<S> {} impl<S: State> State for SetAccentForeground<S> { - type Foreground = S::Foreground; + type Background = S::Background; type Accent = S::Accent; type AccentForeground = Set<members::accent_foreground>; - type Background = S::Background; - } - ///State transition - sets the `background` field to Set - pub struct SetBackground<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBackground<S> {} - impl<S: State> State for SetBackground<S> { type Foreground = S::Foreground; + } + ///State transition - sets the `foreground` field to Set + pub struct SetForeground<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetForeground<S> {} + impl<S: State> State for SetForeground<S> { + type Background = S::Background; type Accent = S::Accent; type AccentForeground = S::AccentForeground; - type Background = Set<members::background>; + type Foreground = Set<members::foreground>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `foreground` field - pub struct foreground(()); + ///Marker type for the `background` field + pub struct background(()); ///Marker type for the `accent` field pub struct accent(()); ///Marker type for the `accent_foreground` field pub struct accent_foreground(()); - ///Marker type for the `background` field - pub struct background(()); + ///Marker type for the `foreground` field + pub struct foreground(()); } } @@ -210,10 +215,10 @@ where impl<'a, S> BasicBuilder<'a, S> where S: basic_state::State, - S::Foreground: basic_state::IsSet, + S::Background: basic_state::IsSet, S::Accent: basic_state::IsSet, S::AccentForeground: basic_state::IsSet, - S::Background: basic_state::IsSet, + S::Foreground: basic_state::IsSet, { /// Build the final struct pub fn build(self) -> Basic<'a> { @@ -256,7 +261,11 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications.", + ), + ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("background"), @@ -272,7 +281,11 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic map.insert( ::jacquard_common::smol_str::SmolStr::new_static("accent"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Color used for links and button backgrounds.", + ), + ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], @@ -284,7 +297,11 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic "accentForeground", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Color used for button text.", + ), + ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], @@ -296,7 +313,11 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic "background", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Color used for content background.", + ), + ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], @@ -308,7 +329,11 @@ fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::Lexic "foreground", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { - description: None, + description: Some( + ::jacquard_common::CowStr::new_static( + "Color used for content text.", + ), + ), refs: vec![ ::jacquard_common::CowStr::new_static("site.standard.theme.color#rgb") ], diff --git a/crates/jacquard-api/src/site_standard/theme/color.rs b/crates/jacquard-api/src/site_standard/theme/color.rs index b8ea3771..bf55c57a 100644 --- a/crates/jacquard-api/src/site_standard/theme/color.rs +++ b/crates/jacquard-api/src/site_standard/theme/color.rs @@ -33,50 +33,50 @@ pub mod rgb_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type R; - type B; type G; + type B; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type R = Unset; - type B = Unset; type G = Unset; + type B = Unset; } ///State transition - sets the `r` field to Set pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetR<S> {} impl<S: State> State for SetR<S> { type R = Set<members::r>; - type B = S::B; - type G = S::G; - } - ///State transition - sets the `b` field to Set - pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetB<S> {} - impl<S: State> State for SetB<S> { - type R = S::R; - type B = Set<members::b>; type G = S::G; + type B = S::B; } ///State transition - sets the `g` field to Set pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetG<S> {} impl<S: State> State for SetG<S> { type R = S::R; - type B = S::B; type G = Set<members::g>; + type B = S::B; + } + ///State transition - sets the `b` field to Set + pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetB<S> {} + impl<S: State> State for SetB<S> { + type R = S::R; + type G = S::G; + type B = Set<members::b>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `r` field pub struct r(()); - ///Marker type for the `b` field - pub struct b(()); ///Marker type for the `g` field pub struct g(()); + ///Marker type for the `b` field + pub struct b(()); } } @@ -161,8 +161,8 @@ impl<'a, S> RgbBuilder<'a, S> where S: rgb_state::State, S::R: rgb_state::IsSet, - S::B: rgb_state::IsSet, S::G: rgb_state::IsSet, + S::B: rgb_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgb<'a> { @@ -439,66 +439,66 @@ pub mod rgba_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type A; + type B; type R; type G; - type B; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type A = Unset; + type B = Unset; type R = Unset; type G = Unset; - type B = Unset; } ///State transition - sets the `a` field to Set pub struct SetA<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetA<S> {} impl<S: State> State for SetA<S> { type A = Set<members::a>; + type B = S::B; + type R = S::R; + type G = S::G; + } + ///State transition - sets the `b` field to Set + pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetB<S> {} + impl<S: State> State for SetB<S> { + type A = S::A; + type B = Set<members::b>; type R = S::R; type G = S::G; - type B = S::B; } ///State transition - sets the `r` field to Set pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetR<S> {} impl<S: State> State for SetR<S> { type A = S::A; + type B = S::B; type R = Set<members::r>; type G = S::G; - type B = S::B; } ///State transition - sets the `g` field to Set pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetG<S> {} impl<S: State> State for SetG<S> { type A = S::A; - type R = S::R; - type G = Set<members::g>; type B = S::B; - } - ///State transition - sets the `b` field to Set - pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetB<S> {} - impl<S: State> State for SetB<S> { - type A = S::A; type R = S::R; - type G = S::G; - type B = Set<members::b>; + type G = Set<members::g>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `a` field pub struct a(()); + ///Marker type for the `b` field + pub struct b(()); ///Marker type for the `r` field pub struct r(()); ///Marker type for the `g` field pub struct g(()); - ///Marker type for the `b` field - pub struct b(()); } } @@ -600,9 +600,9 @@ impl<'a, S> RgbaBuilder<'a, S> where S: rgba_state::State, S::A: rgba_state::IsSet, + S::B: rgba_state::IsSet, S::R: rgba_state::IsSet, S::G: rgba_state::IsSet, - S::B: rgba_state::IsSet, { /// Build the final struct pub fn build(self) -> Rgba<'a> { diff --git a/crates/jacquard-api/src/social_clippr/actor.rs b/crates/jacquard-api/src/social_clippr/actor.rs index 80b0e31c..130eb515 100644 --- a/crates/jacquard-api/src/social_clippr/actor.rs +++ b/crates/jacquard-api/src/social_clippr/actor.rs @@ -77,51 +77,51 @@ pub mod profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; type DisplayName; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; type DisplayName = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Handle = S::Handle; - type DisplayName = S::DisplayName; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type Did = S::Did; type Handle = Set<members::handle>; type DisplayName = S::DisplayName; + type Did = S::Did; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDisplayName<S> {} impl<S: State> State for SetDisplayName<S> { - type Did = S::Did; type Handle = S::Handle; type DisplayName = Set<members::display_name>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Handle = S::Handle; + type DisplayName = S::DisplayName; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `display_name` field pub struct display_name(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -274,9 +274,9 @@ where impl<'a, S> ProfileViewBuilder<'a, S> where S: profile_view_state::State, - S::Did: profile_view_state::IsSet, S::Handle: profile_view_state::IsSet, S::DisplayName: profile_view_state::IsSet, + S::Did: profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileView<'a> { diff --git a/crates/jacquard-api/src/social_clippr/actor/profile.rs b/crates/jacquard-api/src/social_clippr/actor/profile.rs index f8ea3b64..26e5cd5d 100644 --- a/crates/jacquard-api/src/social_clippr/actor/profile.rs +++ b/crates/jacquard-api/src/social_clippr/actor/profile.rs @@ -43,37 +43,37 @@ pub mod profile_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type DisplayName; type CreatedAt; + type DisplayName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type DisplayName = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { - type DisplayName = Set<members::display_name>; - type CreatedAt = S::CreatedAt; + type DisplayName = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type DisplayName = S::DisplayName; type CreatedAt = Set<members::created_at>; + type DisplayName = S::DisplayName; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { + type CreatedAt = S::CreatedAt; + type DisplayName = Set<members::display_name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `display_name` field - pub struct display_name(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `display_name` field + pub struct display_name(()); } } @@ -186,8 +186,8 @@ where impl<'a, S> ProfileBuilder<'a, S> where S: profile_state::State, - S::DisplayName: profile_state::IsSet, S::CreatedAt: profile_state::IsSet, + S::DisplayName: profile_state::IsSet, { /// Build the final struct pub fn build(self) -> Profile<'a> { diff --git a/crates/jacquard-api/src/social_clippr/feed.rs b/crates/jacquard-api/src/social_clippr/feed.rs index 4ef59fb5..999acc68 100644 --- a/crates/jacquard-api/src/social_clippr/feed.rs +++ b/crates/jacquard-api/src/social_clippr/feed.rs @@ -53,8 +53,8 @@ pub mod clip_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; - type Uri; type Author; + type Uri; type Record; type IndexedAt; } @@ -63,8 +63,8 @@ pub mod clip_view_state { impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; - type Uri = Unset; type Author = Unset; + type Uri = Unset; type Record = Unset; type IndexedAt = Unset; } @@ -73,18 +73,8 @@ pub mod clip_view_state { impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Cid = Set<members::cid>; - type Uri = S::Uri; - type Author = S::Author; - type Record = S::Record; - type IndexedAt = S::IndexedAt; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Cid = S::Cid; - type Uri = Set<members::uri>; type Author = S::Author; + type Uri = S::Uri; type Record = S::Record; type IndexedAt = S::IndexedAt; } @@ -93,8 +83,18 @@ pub mod clip_view_state { impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { type Cid = S::Cid; - type Uri = S::Uri; type Author = Set<members::author>; + type Uri = S::Uri; + type Record = S::Record; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Cid = S::Cid; + type Author = S::Author; + type Uri = Set<members::uri>; type Record = S::Record; type IndexedAt = S::IndexedAt; } @@ -103,8 +103,8 @@ pub mod clip_view_state { impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { type Cid = S::Cid; - type Uri = S::Uri; type Author = S::Author; + type Uri = S::Uri; type Record = Set<members::record>; type IndexedAt = S::IndexedAt; } @@ -113,8 +113,8 @@ pub mod clip_view_state { impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { type Cid = S::Cid; - type Uri = S::Uri; type Author = S::Author; + type Uri = S::Uri; type Record = S::Record; type IndexedAt = Set<members::indexed_at>; } @@ -123,10 +123,10 @@ pub mod clip_view_state { pub mod members { ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `indexed_at` field @@ -264,8 +264,8 @@ impl<'a, S> ClipViewBuilder<'a, S> where S: clip_view_state::State, S::Cid: clip_view_state::IsSet, - S::Uri: clip_view_state::IsSet, S::Author: clip_view_state::IsSet, + S::Uri: clip_view_state::IsSet, S::Record: clip_view_state::IsSet, S::IndexedAt: clip_view_state::IsSet, { @@ -575,84 +575,84 @@ pub mod tag_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Author; + type Record; type Uri; - type IndexedAt; type Cid; - type Record; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Author = Unset; + type Record = Unset; type Uri = Unset; - type IndexedAt = Unset; type Cid = Unset; - type Record = Unset; + type IndexedAt = Unset; } ///State transition - sets the `author` field to Set pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAuthor<S> {} impl<S: State> State for SetAuthor<S> { type Author = Set<members::author>; + type Record = S::Record; type Uri = S::Uri; + type Cid = S::Cid; type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecord<S> {} + impl<S: State> State for SetRecord<S> { + type Author = S::Author; + type Record = Set<members::record>; + type Uri = S::Uri; type Cid = S::Cid; - type Record = S::Record; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Author = S::Author; - type Uri = Set<members::uri>; - type IndexedAt = S::IndexedAt; - type Cid = S::Cid; type Record = S::Record; - } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Author = S::Author; - type Uri = S::Uri; - type IndexedAt = Set<members::indexed_at>; + type Uri = Set<members::uri>; type Cid = S::Cid; - type Record = S::Record; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Author = S::Author; + type Record = S::Record; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; type Cid = Set<members::cid>; - type Record = S::Record; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `record` field to Set - pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecord<S> {} - impl<S: State> State for SetRecord<S> { + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { type Author = S::Author; + type Record = S::Record; type Uri = S::Uri; - type IndexedAt = S::IndexedAt; type Cid = S::Cid; - type Record = Set<members::record>; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `author` field pub struct author(()); + ///Marker type for the `record` field + pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `record` field - pub struct record(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -786,10 +786,10 @@ impl<'a, S> TagViewBuilder<'a, S> where S: tag_view_state::State, S::Author: tag_view_state::IsSet, + S::Record: tag_view_state::IsSet, S::Uri: tag_view_state::IsSet, - S::IndexedAt: tag_view_state::IsSet, S::Cid: tag_view_state::IsSet, - S::Record: tag_view_state::IsSet, + S::IndexedAt: tag_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TagView<'a> { diff --git a/crates/jacquard-api/src/social_clippr/feed/clip.rs b/crates/jacquard-api/src/social_clippr/feed/clip.rs index c91e58a9..2c5a6826 100644 --- a/crates/jacquard-api/src/social_clippr/feed/clip.rs +++ b/crates/jacquard-api/src/social_clippr/feed/clip.rs @@ -59,85 +59,85 @@ pub mod clip_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; - type Unlisted; type Title; - type Url; type Description; + type Unlisted; + type Url; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; - type Unlisted = Unset; type Title = Unset; - type Url = Unset; type Description = Unset; + type Unlisted = Unset; + type Url = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Title = Set<members::title>; + type Description = S::Description; type Unlisted = S::Unlisted; + type Url = S::Url; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { type Title = S::Title; + type Description = Set<members::description>; + type Unlisted = S::Unlisted; type Url = S::Url; - type Description = S::Description; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `unlisted` field to Set pub struct SetUnlisted<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUnlisted<S> {} impl<S: State> State for SetUnlisted<S> { - type CreatedAt = S::CreatedAt; - type Unlisted = Set<members::unlisted>; type Title = S::Title; - type Url = S::Url; type Description = S::Description; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type CreatedAt = S::CreatedAt; - type Unlisted = S::Unlisted; - type Title = Set<members::title>; + type Unlisted = Set<members::unlisted>; type Url = S::Url; - type Description = S::Description; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type CreatedAt = S::CreatedAt; - type Unlisted = S::Unlisted; type Title = S::Title; - type Url = Set<members::url>; type Description = S::Description; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { - type CreatedAt = S::CreatedAt; type Unlisted = S::Unlisted; + type Url = Set<members::url>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Title = S::Title; + type Description = S::Description; + type Unlisted = S::Unlisted; type Url = S::Url; - type Description = Set<members::description>; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `unlisted` field - pub struct unlisted(()); ///Marker type for the `title` field pub struct title(()); - ///Marker type for the `url` field - pub struct url(()); ///Marker type for the `description` field pub struct description(()); + ///Marker type for the `unlisted` field + pub struct unlisted(()); + ///Marker type for the `url` field + pub struct url(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -353,11 +353,11 @@ where impl<'a, S> ClipBuilder<'a, S> where S: clip_state::State, - S::CreatedAt: clip_state::IsSet, - S::Unlisted: clip_state::IsSet, S::Title: clip_state::IsSet, - S::Url: clip_state::IsSet, S::Description: clip_state::IsSet, + S::Unlisted: clip_state::IsSet, + S::Url: clip_state::IsSet, + S::CreatedAt: clip_state::IsSet, { /// Build the final struct pub fn build(self) -> Clip<'a> { diff --git a/crates/jacquard-api/src/social_grain/actor.rs b/crates/jacquard-api/src/social_grain/actor.rs index c7001d2d..edd18a86 100644 --- a/crates/jacquard-api/src/social_grain/actor.rs +++ b/crates/jacquard-api/src/social_grain/actor.rs @@ -49,37 +49,37 @@ pub mod profile_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Handle = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Handle = S::Handle; + type Did = Unset; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type Did = S::Did; type Handle = Set<members::handle>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Handle = S::Handle; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -252,8 +252,8 @@ impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> { impl<'a, S> ProfileViewBuilder<'a, S> where S: profile_view_state::State, - S::Did: profile_view_state::IsSet, S::Handle: profile_view_state::IsSet, + S::Did: profile_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ProfileView<'a> { diff --git a/crates/jacquard-api/src/social_grain/favorite.rs b/crates/jacquard-api/src/social_grain/favorite.rs index f24d933b..fa3f393d 100644 --- a/crates/jacquard-api/src/social_grain/favorite.rs +++ b/crates/jacquard-api/src/social_grain/favorite.rs @@ -32,37 +32,37 @@ pub mod favorite_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Subject; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Subject = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Subject = S::Subject; + type CreatedAt = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -135,8 +135,8 @@ where impl<'a, S> FavoriteBuilder<'a, S> where S: favorite_state::State, - S::CreatedAt: favorite_state::IsSet, S::Subject: favorite_state::IsSet, + S::CreatedAt: favorite_state::IsSet, { /// Build the final struct pub fn build(self) -> Favorite<'a> { diff --git a/crates/jacquard-api/src/social_grain/gallery.rs b/crates/jacquard-api/src/social_grain/gallery.rs index dd1fef89..cce31c9b 100644 --- a/crates/jacquard-api/src/social_grain/gallery.rs +++ b/crates/jacquard-api/src/social_grain/gallery.rs @@ -459,85 +459,85 @@ pub mod gallery_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Record; - type Creator; type Cid; - type IndexedAt; + type Record; type Uri; + type IndexedAt; + type Creator; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Record = Unset; - type Creator = Unset; type Cid = Unset; - type IndexedAt = Unset; + type Record = Unset; type Uri = Unset; + type IndexedAt = Unset; + type Creator = Unset; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Cid = Set<members::cid>; + type Record = S::Record; + type Uri = S::Uri; + type IndexedAt = S::IndexedAt; + type Creator = S::Creator; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { - type Record = Set<members::record>; - type Creator = S::Creator; type Cid = S::Cid; - type IndexedAt = S::IndexedAt; + type Record = Set<members::record>; type Uri = S::Uri; - } - ///State transition - sets the `creator` field to Set - pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreator<S> {} - impl<S: State> State for SetCreator<S> { - type Record = S::Record; - type Creator = Set<members::creator>; - type Cid = S::Cid; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; + type Creator = S::Creator; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Cid = S::Cid; type Record = S::Record; - type Creator = S::Creator; - type Cid = Set<members::cid>; + type Uri = Set<members::uri>; type IndexedAt = S::IndexedAt; - type Uri = S::Uri; + type Creator = S::Creator; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { - type Record = S::Record; - type Creator = S::Creator; type Cid = S::Cid; - type IndexedAt = Set<members::indexed_at>; - type Uri = S::Uri; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { type Record = S::Record; + type Uri = S::Uri; + type IndexedAt = Set<members::indexed_at>; type Creator = S::Creator; + } + ///State transition - sets the `creator` field to Set + pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreator<S> {} + impl<S: State> State for SetCreator<S> { type Cid = S::Cid; + type Record = S::Record; + type Uri = S::Uri; type IndexedAt = S::IndexedAt; - type Uri = Set<members::uri>; + type Creator = Set<members::creator>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `record` field - pub struct record(()); - ///Marker type for the `creator` field - pub struct creator(()); ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); + ///Marker type for the `record` field + pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `creator` field + pub struct creator(()); } } @@ -710,11 +710,11 @@ where impl<'a, S> GalleryViewBuilder<'a, S> where S: gallery_view_state::State, - S::Record: gallery_view_state::IsSet, - S::Creator: gallery_view_state::IsSet, S::Cid: gallery_view_state::IsSet, - S::IndexedAt: gallery_view_state::IsSet, + S::Record: gallery_view_state::IsSet, S::Uri: gallery_view_state::IsSet, + S::IndexedAt: gallery_view_state::IsSet, + S::Creator: gallery_view_state::IsSet, { /// Build the final struct pub fn build(self) -> GalleryView<'a> { diff --git a/crates/jacquard-api/src/social_grain/gallery/item.rs b/crates/jacquard-api/src/social_grain/gallery/item.rs index 397ecd0a..f4bfd701 100644 --- a/crates/jacquard-api/src/social_grain/gallery/item.rs +++ b/crates/jacquard-api/src/social_grain/gallery/item.rs @@ -37,50 +37,50 @@ pub mod item_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Gallery; - type Item; type CreatedAt; + type Item; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Gallery = Unset; - type Item = Unset; type CreatedAt = Unset; + type Item = Unset; } ///State transition - sets the `gallery` field to Set pub struct SetGallery<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetGallery<S> {} impl<S: State> State for SetGallery<S> { type Gallery = Set<members::gallery>; - type Item = S::Item; - type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `item` field to Set - pub struct SetItem<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetItem<S> {} - impl<S: State> State for SetItem<S> { - type Gallery = S::Gallery; - type Item = Set<members::item>; type CreatedAt = S::CreatedAt; + type Item = S::Item; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Gallery = S::Gallery; - type Item = S::Item; type CreatedAt = Set<members::created_at>; + type Item = S::Item; + } + ///State transition - sets the `item` field to Set + pub struct SetItem<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetItem<S> {} + impl<S: State> State for SetItem<S> { + type Gallery = S::Gallery; + type CreatedAt = S::CreatedAt; + type Item = Set<members::item>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `gallery` field pub struct gallery(()); - ///Marker type for the `item` field - pub struct item(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `item` field + pub struct item(()); } } @@ -188,8 +188,8 @@ impl<'a, S> ItemBuilder<'a, S> where S: item_state::State, S::Gallery: item_state::IsSet, - S::Item: item_state::IsSet, S::CreatedAt: item_state::IsSet, + S::Item: item_state::IsSet, { /// Build the final struct pub fn build(self) -> Item<'a> { diff --git a/crates/jacquard-api/src/social_grain/photo.rs b/crates/jacquard-api/src/social_grain/photo.rs index 40778cc0..25553533 100644 --- a/crates/jacquard-api/src/social_grain/photo.rs +++ b/crates/jacquard-api/src/social_grain/photo.rs @@ -41,37 +41,37 @@ pub mod photo_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Photo; type Alt; + type Photo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Photo = Unset; type Alt = Unset; - } - ///State transition - sets the `photo` field to Set - pub struct SetPhoto<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPhoto<S> {} - impl<S: State> State for SetPhoto<S> { - type Photo = Set<members::photo>; - type Alt = S::Alt; + type Photo = Unset; } ///State transition - sets the `alt` field to Set pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAlt<S> {} impl<S: State> State for SetAlt<S> { - type Photo = S::Photo; type Alt = Set<members::alt>; + type Photo = S::Photo; + } + ///State transition - sets the `photo` field to Set + pub struct SetPhoto<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPhoto<S> {} + impl<S: State> State for SetPhoto<S> { + type Alt = S::Alt; + type Photo = Set<members::photo>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `photo` field - pub struct photo(()); ///Marker type for the `alt` field pub struct alt(()); + ///Marker type for the `photo` field + pub struct photo(()); } } @@ -184,8 +184,8 @@ where impl<'a, S> PhotoBuilder<'a, S> where S: photo_state::State, - S::Photo: photo_state::IsSet, S::Alt: photo_state::IsSet, + S::Photo: photo_state::IsSet, { /// Build the final struct pub fn build(self) -> Photo<'a> { @@ -1293,9 +1293,9 @@ pub mod photo_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; - type Alt; - type Fullsize; type Cid; + type Fullsize; + type Alt; type Thumb; } /// Empty state - all required fields are unset @@ -1303,9 +1303,9 @@ pub mod photo_view_state { impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; - type Alt = Unset; - type Fullsize = Unset; type Cid = Unset; + type Fullsize = Unset; + type Alt = Unset; type Thumb = Unset; } ///State transition - sets the `uri` field to Set @@ -1313,19 +1313,19 @@ pub mod photo_view_state { impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Uri = Set<members::uri>; - type Alt = S::Alt; - type Fullsize = S::Fullsize; type Cid = S::Cid; + type Fullsize = S::Fullsize; + type Alt = S::Alt; type Thumb = S::Thumb; } - ///State transition - sets the `alt` field to Set - pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAlt<S> {} - impl<S: State> State for SetAlt<S> { + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Uri = S::Uri; - type Alt = Set<members::alt>; + type Cid = Set<members::cid>; type Fullsize = S::Fullsize; - type Cid = S::Cid; + type Alt = S::Alt; type Thumb = S::Thumb; } ///State transition - sets the `fullsize` field to Set @@ -1333,19 +1333,19 @@ pub mod photo_view_state { impl<S: State> sealed::Sealed for SetFullsize<S> {} impl<S: State> State for SetFullsize<S> { type Uri = S::Uri; - type Alt = S::Alt; - type Fullsize = Set<members::fullsize>; type Cid = S::Cid; + type Fullsize = Set<members::fullsize>; + type Alt = S::Alt; type Thumb = S::Thumb; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + ///State transition - sets the `alt` field to Set + pub struct SetAlt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAlt<S> {} + impl<S: State> State for SetAlt<S> { type Uri = S::Uri; - type Alt = S::Alt; + type Cid = S::Cid; type Fullsize = S::Fullsize; - type Cid = Set<members::cid>; + type Alt = Set<members::alt>; type Thumb = S::Thumb; } ///State transition - sets the `thumb` field to Set @@ -1353,9 +1353,9 @@ pub mod photo_view_state { impl<S: State> sealed::Sealed for SetThumb<S> {} impl<S: State> State for SetThumb<S> { type Uri = S::Uri; - type Alt = S::Alt; - type Fullsize = S::Fullsize; type Cid = S::Cid; + type Fullsize = S::Fullsize; + type Alt = S::Alt; type Thumb = Set<members::thumb>; } /// Marker types for field names @@ -1363,12 +1363,12 @@ pub mod photo_view_state { pub mod members { ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `alt` field - pub struct alt(()); - ///Marker type for the `fullsize` field - pub struct fullsize(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `fullsize` field + pub struct fullsize(()); + ///Marker type for the `alt` field + pub struct alt(()); ///Marker type for the `thumb` field pub struct thumb(()); } @@ -1544,9 +1544,9 @@ impl<'a, S> PhotoViewBuilder<'a, S> where S: photo_view_state::State, S::Uri: photo_view_state::IsSet, - S::Alt: photo_view_state::IsSet, - S::Fullsize: photo_view_state::IsSet, S::Cid: photo_view_state::IsSet, + S::Fullsize: photo_view_state::IsSet, + S::Alt: photo_view_state::IsSet, S::Thumb: photo_view_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/social_grain/photo/exif.rs b/crates/jacquard-api/src/social_grain/photo/exif.rs index 89daa7b6..13f98eba 100644 --- a/crates/jacquard-api/src/social_grain/photo/exif.rs +++ b/crates/jacquard-api/src/social_grain/photo/exif.rs @@ -60,37 +60,37 @@ pub mod exif_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Photo; type CreatedAt; + type Photo; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Photo = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `photo` field to Set - pub struct SetPhoto<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPhoto<S> {} - impl<S: State> State for SetPhoto<S> { - type Photo = Set<members::photo>; - type CreatedAt = S::CreatedAt; + type Photo = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Photo = S::Photo; type CreatedAt = Set<members::created_at>; + type Photo = S::Photo; + } + ///State transition - sets the `photo` field to Set + pub struct SetPhoto<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPhoto<S> {} + impl<S: State> State for SetPhoto<S> { + type CreatedAt = S::CreatedAt; + type Photo = Set<members::photo>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `photo` field - pub struct photo(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `photo` field + pub struct photo(()); } } @@ -343,8 +343,8 @@ where impl<'a, S> ExifBuilder<'a, S> where S: exif_state::State, - S::Photo: exif_state::IsSet, S::CreatedAt: exif_state::IsSet, + S::Photo: exif_state::IsSet, { /// Build the final struct pub fn build(self) -> Exif<'a> { diff --git a/crates/jacquard-api/src/social_pace.rs b/crates/jacquard-api/src/social_pace.rs new file mode 100644 index 00000000..7335d810 --- /dev/null +++ b/crates/jacquard-api/src/social_pace.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod daily; \ No newline at end of file diff --git a/crates/jacquard-api/src/social_pace/daily.rs b/crates/jacquard-api/src/social_pace/daily.rs new file mode 100644 index 00000000..feb9d8a7 --- /dev/null +++ b/crates/jacquard-api/src/social_pace/daily.rs @@ -0,0 +1,7 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod ring; +pub mod step; \ No newline at end of file diff --git a/crates/jacquard-api/src/social_pace/daily/ring.rs b/crates/jacquard-api/src/social_pace/daily/ring.rs new file mode 100644 index 00000000..f2c8f83a --- /dev/null +++ b/crates/jacquard-api/src/social_pace/daily/ring.rs @@ -0,0 +1,598 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: social.pace.daily.ring +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A record of daily activity rings (Apple Fitness), including move, exercise, and stand goals. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Ring<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// The total minutes of exercise completed. + pub exercise: i64, + /// The daily exercise goal in minutes. + pub exercise_goal: i64, + /// The total active calories burned for the day. + pub r#move: i64, + /// The daily move goal in calories. + pub move_goal: i64, + /// The daily stand goal in hours. + pub stand_goal: i64, + /// The number of hours the user stood up and moved around. + pub stand_hours: i64, +} + +pub mod ring_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type ExerciseGoal; + type MoveGoal; + type CreatedAt; + type Exercise; + type Move; + type StandHours; + type StandGoal; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type ExerciseGoal = Unset; + type MoveGoal = Unset; + type CreatedAt = Unset; + type Exercise = Unset; + type Move = Unset; + type StandHours = Unset; + type StandGoal = Unset; + } + ///State transition - sets the `exercise_goal` field to Set + pub struct SetExerciseGoal<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetExerciseGoal<S> {} + impl<S: State> State for SetExerciseGoal<S> { + type ExerciseGoal = Set<members::exercise_goal>; + type MoveGoal = S::MoveGoal; + type CreatedAt = S::CreatedAt; + type Exercise = S::Exercise; + type Move = S::Move; + type StandHours = S::StandHours; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `move_goal` field to Set + pub struct SetMoveGoal<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMoveGoal<S> {} + impl<S: State> State for SetMoveGoal<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = Set<members::move_goal>; + type CreatedAt = S::CreatedAt; + type Exercise = S::Exercise; + type Move = S::Move; + type StandHours = S::StandHours; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = S::MoveGoal; + type CreatedAt = Set<members::created_at>; + type Exercise = S::Exercise; + type Move = S::Move; + type StandHours = S::StandHours; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `exercise` field to Set + pub struct SetExercise<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetExercise<S> {} + impl<S: State> State for SetExercise<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = S::MoveGoal; + type CreatedAt = S::CreatedAt; + type Exercise = Set<members::exercise>; + type Move = S::Move; + type StandHours = S::StandHours; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `move` field to Set + pub struct SetMove<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMove<S> {} + impl<S: State> State for SetMove<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = S::MoveGoal; + type CreatedAt = S::CreatedAt; + type Exercise = S::Exercise; + type Move = Set<members::r#move>; + type StandHours = S::StandHours; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `stand_hours` field to Set + pub struct SetStandHours<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStandHours<S> {} + impl<S: State> State for SetStandHours<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = S::MoveGoal; + type CreatedAt = S::CreatedAt; + type Exercise = S::Exercise; + type Move = S::Move; + type StandHours = Set<members::stand_hours>; + type StandGoal = S::StandGoal; + } + ///State transition - sets the `stand_goal` field to Set + pub struct SetStandGoal<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStandGoal<S> {} + impl<S: State> State for SetStandGoal<S> { + type ExerciseGoal = S::ExerciseGoal; + type MoveGoal = S::MoveGoal; + type CreatedAt = S::CreatedAt; + type Exercise = S::Exercise; + type Move = S::Move; + type StandHours = S::StandHours; + type StandGoal = Set<members::stand_goal>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `exercise_goal` field + pub struct exercise_goal(()); + ///Marker type for the `move_goal` field + pub struct move_goal(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `exercise` field + pub struct exercise(()); + ///Marker type for the `move` field + pub struct r#move(()); + ///Marker type for the `stand_hours` field + pub struct stand_hours(()); + ///Marker type for the `stand_goal` field + pub struct stand_goal(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RingBuilder<'a, S: ring_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ::core::option::Option<i64>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Ring<'a> { + /// Create a new builder for this type + pub fn new() -> RingBuilder<'a, ring_state::Empty> { + RingBuilder::new() + } +} + +impl<'a> RingBuilder<'a, ring_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::CreatedAt: ring_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RingBuilder<'a, ring_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::Exercise: ring_state::IsUnset, +{ + /// Set the `exercise` field (required) + pub fn exercise( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetExercise<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::ExerciseGoal: ring_state::IsUnset, +{ + /// Set the `exerciseGoal` field (required) + pub fn exercise_goal( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetExerciseGoal<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::Move: ring_state::IsUnset, +{ + /// Set the `move` field (required) + pub fn r#move( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetMove<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::MoveGoal: ring_state::IsUnset, +{ + /// Set the `moveGoal` field (required) + pub fn move_goal( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetMoveGoal<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::StandGoal: ring_state::IsUnset, +{ + /// Set the `standGoal` field (required) + pub fn stand_goal( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetStandGoal<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::StandHours: ring_state::IsUnset, +{ + /// Set the `standHours` field (required) + pub fn stand_hours( + mut self, + value: impl Into<i64>, + ) -> RingBuilder<'a, ring_state::SetStandHours<S>> { + self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); + RingBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RingBuilder<'a, S> +where + S: ring_state::State, + S::ExerciseGoal: ring_state::IsSet, + S::MoveGoal: ring_state::IsSet, + S::CreatedAt: ring_state::IsSet, + S::Exercise: ring_state::IsSet, + S::Move: ring_state::IsSet, + S::StandHours: ring_state::IsSet, + S::StandGoal: ring_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Ring<'a> { + Ring { + created_at: self.__unsafe_private_named.0.unwrap(), + exercise: self.__unsafe_private_named.1.unwrap(), + exercise_goal: self.__unsafe_private_named.2.unwrap(), + r#move: self.__unsafe_private_named.3.unwrap(), + move_goal: self.__unsafe_private_named.4.unwrap(), + stand_goal: self.__unsafe_private_named.5.unwrap(), + stand_hours: self.__unsafe_private_named.6.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Ring<'a> { + Ring { + created_at: self.__unsafe_private_named.0.unwrap(), + exercise: self.__unsafe_private_named.1.unwrap(), + exercise_goal: self.__unsafe_private_named.2.unwrap(), + r#move: self.__unsafe_private_named.3.unwrap(), + move_goal: self.__unsafe_private_named.4.unwrap(), + stand_goal: self.__unsafe_private_named.5.unwrap(), + stand_hours: self.__unsafe_private_named.6.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Ring<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, RingRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RingGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Ring<'a>, +} + +impl From<RingGetRecordOutput<'_>> for Ring<'_> { + fn from(output: RingGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Ring<'_> { + const NSID: &'static str = "social.pace.daily.ring"; + type Record = RingRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct RingRecord; +impl jacquard_common::xrpc::XrpcResp for RingRecord { + const NSID: &'static str = "social.pace.daily.ring"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = RingGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for RingRecord { + const NSID: &'static str = "social.pace.daily.ring"; + type Record = RingRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Ring<'a> { + fn nsid() -> &'static str { + "social.pace.daily.ring" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_social_pace_daily_ring() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_social_pace_daily_ring() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("social.pace.daily.ring"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A record of daily activity rings (Apple Fitness), including move, exercise, and stand goals.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("move"), + ::jacquard_common::smol_str::SmolStr::new_static("moveGoal"), + ::jacquard_common::smol_str::SmolStr::new_static("exercise"), + ::jacquard_common::smol_str::SmolStr::new_static("exerciseGoal"), + ::jacquard_common::smol_str::SmolStr::new_static("standHours"), + ::jacquard_common::smol_str::SmolStr::new_static("standGoal"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "exercise", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "exerciseGoal", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("move"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "moveGoal", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "standGoal", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "standHours", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/social_pace/daily/step.rs b/crates/jacquard-api/src/social_pace/daily/step.rs new file mode 100644 index 00000000..7951bd9f --- /dev/null +++ b/crates/jacquard-api/src/social_pace/daily/step.rs @@ -0,0 +1,381 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: social.pace.daily.step +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A daily recording of your steps for that day. This record is expected to be update throughout the day and represent's 12am-12pm in your timezone, or what you count as a "day". The key is also traditionally the date of your "day" yyy-mm-dd. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Step<'a> { + /// The first time this record was created + pub created_at: jacquard_common::types::string::Datetime, + /// The number of steps taken during the day + pub steps: i64, + /// The last time this record was updated + pub updated_at: jacquard_common::types::string::Datetime, +} + +pub mod step_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Steps; + type UpdatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Steps = Unset; + type UpdatedAt = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Steps = S::Steps; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `steps` field to Set + pub struct SetSteps<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSteps<S> {} + impl<S: State> State for SetSteps<S> { + type CreatedAt = S::CreatedAt; + type Steps = Set<members::steps>; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type CreatedAt = S::CreatedAt; + type Steps = S::Steps; + type UpdatedAt = Set<members::updated_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `steps` field + pub struct steps(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct StepBuilder<'a, S: step_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Step<'a> { + /// Create a new builder for this type + pub fn new() -> StepBuilder<'a, step_state::Empty> { + StepBuilder::new() + } +} + +impl<'a> StepBuilder<'a, step_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + StepBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StepBuilder<'a, S> +where + S: step_state::State, + S::CreatedAt: step_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> StepBuilder<'a, step_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + StepBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StepBuilder<'a, S> +where + S: step_state::State, + S::Steps: step_state::IsUnset, +{ + /// Set the `steps` field (required) + pub fn steps( + mut self, + value: impl Into<i64>, + ) -> StepBuilder<'a, step_state::SetSteps<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + StepBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StepBuilder<'a, S> +where + S: step_state::State, + S::UpdatedAt: step_state::IsUnset, +{ + /// Set the `updatedAt` field (required) + pub fn updated_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> StepBuilder<'a, step_state::SetUpdatedAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + StepBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> StepBuilder<'a, S> +where + S: step_state::State, + S::CreatedAt: step_state::IsSet, + S::Steps: step_state::IsSet, + S::UpdatedAt: step_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Step<'a> { + Step { + created_at: self.__unsafe_private_named.0.unwrap(), + steps: self.__unsafe_private_named.1.unwrap(), + updated_at: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Step<'a> { + Step { + created_at: self.__unsafe_private_named.0.unwrap(), + steps: self.__unsafe_private_named.1.unwrap(), + updated_at: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Step<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, StepRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct StepGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Step<'a>, +} + +impl From<StepGetRecordOutput<'_>> for Step<'_> { + fn from(output: StepGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Step<'_> { + const NSID: &'static str = "social.pace.daily.step"; + type Record = StepRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct StepRecord; +impl jacquard_common::xrpc::XrpcResp for StepRecord { + const NSID: &'static str = "social.pace.daily.step"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = StepGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for StepRecord { + const NSID: &'static str = "social.pace.daily.step"; + type Record = StepRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Step<'a> { + fn nsid() -> &'static str { + "social.pace.daily.step" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_social_pace_daily_step() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_social_pace_daily_step() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("social.pace.daily.step"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A daily recording of your steps for that day. This record is expected to be update throughout the day and represent's 12am-12pm in your timezone, or what you count as a \"day\". The key is also traditionally the date of your \"day\" yyy-mm-dd.", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("steps"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt"), + ::jacquard_common::smol_str::SmolStr::new_static("updatedAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The first time this record was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("steps"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "updatedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "The last time this record was updated", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/social_pmsky/proposal.rs b/crates/jacquard-api/src/social_pmsky/proposal.rs index 1da9092b..86f1481c 100644 --- a/crates/jacquard-api/src/social_pmsky/proposal.rs +++ b/crates/jacquard-api/src/social_pmsky/proposal.rs @@ -66,85 +66,85 @@ pub mod proposal_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Src; type Typ; + type Cts; type Uri; type Val; - type Src; - type Cts; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Src = Unset; type Typ = Unset; + type Cts = Unset; type Uri = Unset; type Val = Unset; - type Src = Unset; - type Cts = Unset; + } + ///State transition - sets the `src` field to Set + pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSrc<S> {} + impl<S: State> State for SetSrc<S> { + type Src = Set<members::src>; + type Typ = S::Typ; + type Cts = S::Cts; + type Uri = S::Uri; + type Val = S::Val; } ///State transition - sets the `typ` field to Set pub struct SetTyp<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTyp<S> {} impl<S: State> State for SetTyp<S> { + type Src = S::Src; type Typ = Set<members::typ>; + type Cts = S::Cts; type Uri = S::Uri; type Val = S::Val; + } + ///State transition - sets the `cts` field to Set + pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCts<S> {} + impl<S: State> State for SetCts<S> { type Src = S::Src; - type Cts = S::Cts; + type Typ = S::Typ; + type Cts = Set<members::cts>; + type Uri = S::Uri; + type Val = S::Val; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { + type Src = S::Src; type Typ = S::Typ; + type Cts = S::Cts; type Uri = Set<members::uri>; type Val = S::Val; - type Src = S::Src; - type Cts = S::Cts; } ///State transition - sets the `val` field to Set pub struct SetVal<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVal<S> {} impl<S: State> State for SetVal<S> { - type Typ = S::Typ; - type Uri = S::Uri; - type Val = Set<members::val>; type Src = S::Src; - type Cts = S::Cts; - } - ///State transition - sets the `src` field to Set - pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSrc<S> {} - impl<S: State> State for SetSrc<S> { type Typ = S::Typ; - type Uri = S::Uri; - type Val = S::Val; - type Src = Set<members::src>; type Cts = S::Cts; - } - ///State transition - sets the `cts` field to Set - pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCts<S> {} - impl<S: State> State for SetCts<S> { - type Typ = S::Typ; type Uri = S::Uri; - type Val = S::Val; - type Src = S::Src; - type Cts = Set<members::cts>; + type Val = Set<members::val>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `src` field + pub struct src(()); ///Marker type for the `typ` field pub struct typ(()); + ///Marker type for the `cts` field + pub struct cts(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `val` field pub struct val(()); - ///Marker type for the `src` field - pub struct src(()); - ///Marker type for the `cts` field - pub struct cts(()); } } @@ -388,11 +388,11 @@ impl<'a, S: proposal_state::State> ProposalBuilder<'a, S> { impl<'a, S> ProposalBuilder<'a, S> where S: proposal_state::State, + S::Src: proposal_state::IsSet, S::Typ: proposal_state::IsSet, + S::Cts: proposal_state::IsSet, S::Uri: proposal_state::IsSet, S::Val: proposal_state::IsSet, - S::Src: proposal_state::IsSet, - S::Cts: proposal_state::IsSet, { /// Build the final struct pub fn build(self) -> Proposal<'a> { diff --git a/crates/jacquard-api/src/social_pmsky/vote.rs b/crates/jacquard-api/src/social_pmsky/vote.rs index 91cd3286..83b2fc83 100644 --- a/crates/jacquard-api/src/social_pmsky/vote.rs +++ b/crates/jacquard-api/src/social_pmsky/vote.rs @@ -56,66 +56,66 @@ pub mod vote_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Uri; + type Src; type Cts; type Val; - type Src; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Uri = Unset; + type Src = Unset; type Cts = Unset; type Val = Unset; - type Src = Unset; } ///State transition - sets the `uri` field to Set pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Uri = Set<members::uri>; + type Src = S::Src; + type Cts = S::Cts; + type Val = S::Val; + } + ///State transition - sets the `src` field to Set + pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSrc<S> {} + impl<S: State> State for SetSrc<S> { + type Uri = S::Uri; + type Src = Set<members::src>; type Cts = S::Cts; type Val = S::Val; - type Src = S::Src; } ///State transition - sets the `cts` field to Set pub struct SetCts<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCts<S> {} impl<S: State> State for SetCts<S> { type Uri = S::Uri; + type Src = S::Src; type Cts = Set<members::cts>; type Val = S::Val; - type Src = S::Src; } ///State transition - sets the `val` field to Set pub struct SetVal<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetVal<S> {} impl<S: State> State for SetVal<S> { type Uri = S::Uri; - type Cts = S::Cts; - type Val = Set<members::val>; type Src = S::Src; - } - ///State transition - sets the `src` field to Set - pub struct SetSrc<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSrc<S> {} - impl<S: State> State for SetSrc<S> { - type Uri = S::Uri; type Cts = S::Cts; - type Val = S::Val; - type Src = Set<members::src>; + type Val = Set<members::val>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `src` field + pub struct src(()); ///Marker type for the `cts` field pub struct cts(()); ///Marker type for the `val` field pub struct val(()); - ///Marker type for the `src` field - pub struct src(()); } } @@ -297,9 +297,9 @@ impl<'a, S> VoteBuilder<'a, S> where S: vote_state::State, S::Uri: vote_state::IsSet, + S::Src: vote_state::IsSet, S::Cts: vote_state::IsSet, S::Val: vote_state::IsSet, - S::Src: vote_state::IsSet, { /// Build the final struct pub fn build(self) -> Vote<'a> { diff --git a/crates/jacquard-api/src/social_psky/chat/room.rs b/crates/jacquard-api/src/social_psky/chat/room.rs index 9ee56f86..1e11ac53 100644 --- a/crates/jacquard-api/src/social_psky/chat/room.rs +++ b/crates/jacquard-api/src/social_psky/chat/room.rs @@ -626,37 +626,37 @@ pub mod modlist_ref_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Active; type Users; + type Active; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Active = Unset; type Users = Unset; - } - ///State transition - sets the `active` field to Set - pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetActive<S> {} - impl<S: State> State for SetActive<S> { - type Active = Set<members::active>; - type Users = S::Users; + type Active = Unset; } ///State transition - sets the `users` field to Set pub struct SetUsers<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUsers<S> {} impl<S: State> State for SetUsers<S> { - type Active = S::Active; type Users = Set<members::users>; + type Active = S::Active; + } + ///State transition - sets the `active` field to Set + pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetActive<S> {} + impl<S: State> State for SetActive<S> { + type Users = S::Users; + type Active = Set<members::active>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `active` field - pub struct active(()); ///Marker type for the `users` field pub struct users(()); + ///Marker type for the `active` field + pub struct active(()); } } @@ -729,8 +729,8 @@ where impl<'a, S> ModlistRefBuilder<'a, S> where S: modlist_ref_state::State, - S::Active: modlist_ref_state::IsSet, S::Users: modlist_ref_state::IsSet, + S::Active: modlist_ref_state::IsSet, { /// Build the final struct pub fn build(self) -> ModlistRef<'a> { diff --git a/crates/jacquard-api/src/social_psky/richtext/facet.rs b/crates/jacquard-api/src/social_psky/richtext/facet.rs index d1030f12..bfa73b3e 100644 --- a/crates/jacquard-api/src/social_psky/richtext/facet.rs +++ b/crates/jacquard-api/src/social_psky/richtext/facet.rs @@ -32,37 +32,37 @@ pub mod byte_slice_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ByteEnd; type ByteStart; + type ByteEnd; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ByteEnd = Unset; type ByteStart = Unset; - } - ///State transition - sets the `byte_end` field to Set - pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetByteEnd<S> {} - impl<S: State> State for SetByteEnd<S> { - type ByteEnd = Set<members::byte_end>; - type ByteStart = S::ByteStart; + type ByteEnd = Unset; } ///State transition - sets the `byte_start` field to Set pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetByteStart<S> {} impl<S: State> State for SetByteStart<S> { - type ByteEnd = S::ByteEnd; type ByteStart = Set<members::byte_start>; + type ByteEnd = S::ByteEnd; + } + ///State transition - sets the `byte_end` field to Set + pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetByteEnd<S> {} + impl<S: State> State for SetByteEnd<S> { + type ByteStart = S::ByteStart; + type ByteEnd = Set<members::byte_end>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `byte_end` field - pub struct byte_end(()); ///Marker type for the `byte_start` field pub struct byte_start(()); + ///Marker type for the `byte_end` field + pub struct byte_end(()); } } @@ -132,8 +132,8 @@ where impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, - S::ByteEnd: byte_slice_state::IsSet, S::ByteStart: byte_slice_state::IsSet, + S::ByteEnd: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { @@ -581,37 +581,37 @@ pub mod facet_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Index; type Features; + type Index; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Index = Unset; type Features = Unset; - } - ///State transition - sets the `index` field to Set - pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndex<S> {} - impl<S: State> State for SetIndex<S> { - type Index = Set<members::index>; - type Features = S::Features; + type Index = Unset; } ///State transition - sets the `features` field to Set pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetFeatures<S> {} impl<S: State> State for SetFeatures<S> { - type Index = S::Index; type Features = Set<members::features>; + type Index = S::Index; + } + ///State transition - sets the `index` field to Set + pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndex<S> {} + impl<S: State> State for SetIndex<S> { + type Features = S::Features; + type Index = Set<members::index>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `index` field - pub struct index(()); ///Marker type for the `features` field pub struct features(()); + ///Marker type for the `index` field + pub struct index(()); } } @@ -684,8 +684,8 @@ where impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, - S::Index: facet_state::IsSet, S::Features: facet_state::IsSet, + S::Index: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { diff --git a/crates/jacquard-api/src/social_tophhie.rs b/crates/jacquard-api/src/social_tophhie.rs new file mode 100644 index 00000000..534c9681 --- /dev/null +++ b/crates/jacquard-api/src/social_tophhie.rs @@ -0,0 +1,6 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod profile; \ No newline at end of file diff --git a/crates/jacquard-api/src/social_tophhie/profile.rs b/crates/jacquard-api/src/social_tophhie/profile.rs new file mode 100644 index 00000000..a4c0dfb7 --- /dev/null +++ b/crates/jacquard-api/src/social_tophhie/profile.rs @@ -0,0 +1,664 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: social.tophhie.profile +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Granular communication consent flags. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CommunicationPreferences<'a> { + /// True if the user consents to receive marketing communications. + pub marketing: bool, +} + +pub mod communication_preferences_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Marketing; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Marketing = Unset; + } + ///State transition - sets the `marketing` field to Set + pub struct SetMarketing<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetMarketing<S> {} + impl<S: State> State for SetMarketing<S> { + type Marketing = Set<members::marketing>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `marketing` field + pub struct marketing(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CommunicationPreferencesBuilder< + 'a, + S: communication_preferences_state::State, +> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: (::core::option::Option<bool>,), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CommunicationPreferences<'a> { + /// Create a new builder for this type + pub fn new() -> CommunicationPreferencesBuilder< + 'a, + communication_preferences_state::Empty, + > { + CommunicationPreferencesBuilder::new() + } +} + +impl<'a> CommunicationPreferencesBuilder<'a, communication_preferences_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CommunicationPreferencesBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None,), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CommunicationPreferencesBuilder<'a, S> +where + S: communication_preferences_state::State, + S::Marketing: communication_preferences_state::IsUnset, +{ + /// Set the `marketing` field (required) + pub fn marketing( + mut self, + value: impl Into<bool>, + ) -> CommunicationPreferencesBuilder< + 'a, + communication_preferences_state::SetMarketing<S>, + > { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CommunicationPreferencesBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CommunicationPreferencesBuilder<'a, S> +where + S: communication_preferences_state::State, + S::Marketing: communication_preferences_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CommunicationPreferences<'a> { + CommunicationPreferences { + marketing: self.__unsafe_private_named.0.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CommunicationPreferences<'a> { + CommunicationPreferences { + marketing: self.__unsafe_private_named.0.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_social_tophhie_profile() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("social.tophhie.profile"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "communicationPreferences", + ), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Granular communication consent flags.", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("marketing") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "marketing", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: None, + key: Some(::jacquard_common::CowStr::new_static("literal:self")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Tophhie profile record", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("createdAt"), + ::jacquard_common::smol_str::SmolStr::new_static("communicationPreferences") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "communicationPreferences", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "#communicationPreferences", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "ISO 8601 timestamp when this profile record was created.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "pdsPreferences", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "#pdsPreferences", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "updatedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "ISO 8601 timestamp when this profile record was updated.", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("pdsPreferences"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Granular PDS preference consent flags.", + ), + ), + required: Some(vec![]), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "accessibilityScoring", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "showOnHomepage", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CommunicationPreferences<'a> { + fn nsid() -> &'static str { + "social.tophhie.profile" + } + fn def_name() -> &'static str { + "communicationPreferences" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_social_tophhie_profile() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Profile<'a> { + /// User's opt-in/out preferences for communications. + #[serde(borrow)] + pub communication_preferences: crate::social_tophhie::profile::CommunicationPreferences< + 'a, + >, + /// ISO 8601 timestamp when this profile record was created. + pub created_at: jacquard_common::types::string::Datetime, + /// User's opt-in/out preferences for PDS features. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub pds_preferences: std::option::Option< + crate::social_tophhie::profile::PdsPreferences<'a>, + >, + /// ISO 8601 timestamp when this profile record was updated. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>, +} + +pub mod profile_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CommunicationPreferences; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CommunicationPreferences = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `communication_preferences` field to Set + pub struct SetCommunicationPreferences<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCommunicationPreferences<S> {} + impl<S: State> State for SetCommunicationPreferences<S> { + type CommunicationPreferences = Set<members::communication_preferences>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CommunicationPreferences = S::CommunicationPreferences; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `communication_preferences` field + pub struct communication_preferences(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ProfileBuilder<'a, S: profile_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option< + crate::social_tophhie::profile::CommunicationPreferences<'a>, + >, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<crate::social_tophhie::profile::PdsPreferences<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Profile<'a> { + /// Create a new builder for this type + pub fn new() -> ProfileBuilder<'a, profile_state::Empty> { + ProfileBuilder::new() + } +} + +impl<'a> ProfileBuilder<'a, profile_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, + S::CommunicationPreferences: profile_state::IsUnset, +{ + /// Set the `communicationPreferences` field (required) + pub fn communication_preferences( + mut self, + value: impl Into<crate::social_tophhie::profile::CommunicationPreferences<'a>>, + ) -> ProfileBuilder<'a, profile_state::SetCommunicationPreferences<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, + S::CreatedAt: profile_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ProfileBuilder<'a, profile_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ProfileBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `pdsPreferences` field (optional) + pub fn pds_preferences( + mut self, + value: impl Into<Option<crate::social_tophhie::profile::PdsPreferences<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `pdsPreferences` field to an Option value (optional) + pub fn maybe_pds_preferences( + mut self, + value: Option<crate::social_tophhie::profile::PdsPreferences<'a>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: profile_state::State> ProfileBuilder<'a, S> { + /// Set the `updatedAt` field (optional) + pub fn updated_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `updatedAt` field to an Option value (optional) + pub fn maybe_updated_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> ProfileBuilder<'a, S> +where + S: profile_state::State, + S::CommunicationPreferences: profile_state::IsSet, + S::CreatedAt: profile_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Profile<'a> { + Profile { + communication_preferences: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + pds_preferences: self.__unsafe_private_named.2, + updated_at: self.__unsafe_private_named.3, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Profile<'a> { + Profile { + communication_preferences: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + pds_preferences: self.__unsafe_private_named.2, + updated_at: self.__unsafe_private_named.3, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Profile<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ProfileRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ProfileGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Profile<'a>, +} + +impl From<ProfileGetRecordOutput<'_>> for Profile<'_> { + fn from(output: ProfileGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Profile<'_> { + const NSID: &'static str = "social.tophhie.profile"; + type Record = ProfileRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ProfileRecord; +impl jacquard_common::xrpc::XrpcResp for ProfileRecord { + const NSID: &'static str = "social.tophhie.profile"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ProfileGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ProfileRecord { + const NSID: &'static str = "social.tophhie.profile"; + type Record = ProfileRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> { + fn nsid() -> &'static str { + "social.tophhie.profile" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_social_tophhie_profile() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/// Granular PDS preference consent flags. +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct PdsPreferences<'a> { + /// True if the user participates in accessibility scoring. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub accessibility_scoring: std::option::Option<bool>, + /// True if the user is shown on the Tophhie Social homepage. + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub show_on_homepage: std::option::Option<bool>, +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PdsPreferences<'a> { + fn nsid() -> &'static str { + "social.tophhie.profile" + } + fn def_name() -> &'static str { + "pdsPreferences" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_social_tophhie_profile() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_manos/twmirror/post.rs b/crates/jacquard-api/src/tech_manos/twmirror/post.rs index 6ae72aee..491660ea 100644 --- a/crates/jacquard-api/src/tech_manos/twmirror/post.rs +++ b/crates/jacquard-api/src/tech_manos/twmirror/post.rs @@ -42,67 +42,67 @@ pub mod post_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type TwUserId; - type TweetId; type CreatedAt; type BskyPost; + type TweetId; + type TwUserId; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type TwUserId = Unset; - type TweetId = Unset; type CreatedAt = Unset; type BskyPost = Unset; - } - ///State transition - sets the `tw_user_id` field to Set - pub struct SetTwUserId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTwUserId<S> {} - impl<S: State> State for SetTwUserId<S> { - type TwUserId = Set<members::tw_user_id>; - type TweetId = S::TweetId; - type CreatedAt = S::CreatedAt; - type BskyPost = S::BskyPost; - } - ///State transition - sets the `tweet_id` field to Set - pub struct SetTweetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTweetId<S> {} - impl<S: State> State for SetTweetId<S> { - type TwUserId = S::TwUserId; - type TweetId = Set<members::tweet_id>; - type CreatedAt = S::CreatedAt; - type BskyPost = S::BskyPost; + type TweetId = Unset; + type TwUserId = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type TwUserId = S::TwUserId; - type TweetId = S::TweetId; type CreatedAt = Set<members::created_at>; type BskyPost = S::BskyPost; + type TweetId = S::TweetId; + type TwUserId = S::TwUserId; } ///State transition - sets the `bsky_post` field to Set pub struct SetBskyPost<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBskyPost<S> {} impl<S: State> State for SetBskyPost<S> { - type TwUserId = S::TwUserId; - type TweetId = S::TweetId; type CreatedAt = S::CreatedAt; type BskyPost = Set<members::bsky_post>; + type TweetId = S::TweetId; + type TwUserId = S::TwUserId; + } + ///State transition - sets the `tweet_id` field to Set + pub struct SetTweetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTweetId<S> {} + impl<S: State> State for SetTweetId<S> { + type CreatedAt = S::CreatedAt; + type BskyPost = S::BskyPost; + type TweetId = Set<members::tweet_id>; + type TwUserId = S::TwUserId; + } + ///State transition - sets the `tw_user_id` field to Set + pub struct SetTwUserId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTwUserId<S> {} + impl<S: State> State for SetTwUserId<S> { + type CreatedAt = S::CreatedAt; + type BskyPost = S::BskyPost; + type TweetId = S::TweetId; + type TwUserId = Set<members::tw_user_id>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `tw_user_id` field - pub struct tw_user_id(()); - ///Marker type for the `tweet_id` field - pub struct tweet_id(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `bsky_post` field pub struct bsky_post(()); + ///Marker type for the `tweet_id` field + pub struct tweet_id(()); + ///Marker type for the `tw_user_id` field + pub struct tw_user_id(()); } } @@ -215,10 +215,10 @@ where impl<'a, S> PostBuilder<'a, S> where S: post_state::State, - S::TwUserId: post_state::IsSet, - S::TweetId: post_state::IsSet, S::CreatedAt: post_state::IsSet, S::BskyPost: post_state::IsSet, + S::TweetId: post_state::IsSet, + S::TwUserId: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/tech_tokimeki.rs b/crates/jacquard-api/src/tech_tokimeki.rs index 1d027f63..b9548963 100644 --- a/crates/jacquard-api/src/tech_tokimeki.rs +++ b/crates/jacquard-api/src/tech_tokimeki.rs @@ -3,4 +3,5 @@ // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. +pub mod kaku; pub mod poll; \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku.rs b/crates/jacquard-api/src/tech_tokimeki/kaku.rs new file mode 100644 index 00000000..238ff488 --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku.rs @@ -0,0 +1,3641 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.defs +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +pub mod collection; +pub mod collection_item; +pub mod post; +pub mod reaction; +pub mod request; +pub mod request_response; +pub mod room_gate; + +/// Width and height representing the aspect ratio of an image +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct AspectRatio<'a> { + /// Height component of aspect ratio + pub height: i64, + /// Width component of aspect ratio + pub width: i64, +} + +pub mod aspect_ratio_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Height; + type Width; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Height = Unset; + type Width = Unset; + } + ///State transition - sets the `height` field to Set + pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHeight<S> {} + impl<S: State> State for SetHeight<S> { + type Height = Set<members::height>; + type Width = S::Width; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWidth<S> {} + impl<S: State> State for SetWidth<S> { + type Height = S::Height; + type Width = Set<members::width>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `height` field + pub struct height(()); + ///Marker type for the `width` field + pub struct width(()); + } +} + +/// Builder for constructing an instance of this type +pub struct AspectRatioBuilder<'a, S: aspect_ratio_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> AspectRatio<'a> { + /// Create a new builder for this type + pub fn new() -> AspectRatioBuilder<'a, aspect_ratio_state::Empty> { + AspectRatioBuilder::new() + } +} + +impl<'a> AspectRatioBuilder<'a, aspect_ratio_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + AspectRatioBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AspectRatioBuilder<'a, S> +where + S: aspect_ratio_state::State, + S::Height: aspect_ratio_state::IsUnset, +{ + /// Set the `height` field (required) + pub fn height( + mut self, + value: impl Into<i64>, + ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetHeight<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + AspectRatioBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AspectRatioBuilder<'a, S> +where + S: aspect_ratio_state::State, + S::Width: aspect_ratio_state::IsUnset, +{ + /// Set the `width` field (required) + pub fn width( + mut self, + value: impl Into<i64>, + ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetWidth<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + AspectRatioBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> AspectRatioBuilder<'a, S> +where + S: aspect_ratio_state::State, + S::Height: aspect_ratio_state::IsSet, + S::Width: aspect_ratio_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> AspectRatio<'a> { + AspectRatio { + height: self.__unsafe_private_named.0.unwrap(), + width: self.__unsafe_private_named.1.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> AspectRatio<'a> { + AspectRatio { + height: self.__unsafe_private_named.0.unwrap(), + width: self.__unsafe_private_named.1.unwrap(), + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_tech_tokimeki_kaku_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.defs"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Width and height representing the aspect ratio of an image", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("width"), + ::jacquard_common::smol_str::SmolStr::new_static("height") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("height"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(1i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("width"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(1i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("collectionView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A view of a collection with author profile and item count", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "CID of the collection record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the collection was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Collection description", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(500usize), + min_graphemes: None, + max_graphemes: Some(200usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "indexedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the collection was indexed", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("isPublic"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "itemCount", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Collection name"), + ), + format: None, + default: None, + min_length: None, + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: Some(50usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the collection record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("postView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A view of a drawing post with author profile and metadata", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "aspectRatio", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#aspectRatio"), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "CID of the post record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the post was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "URL of the drawing image", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "indexedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the post was indexed", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "linkedPost", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "reactionCounts", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "#reactionCounts", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Tags for categorization", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: Some(32usize), + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(8usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional description or title", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the post record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "viewerReaction", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "#reactionType", + ), + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("reactionCounts"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "Counts of each reaction type on a post", + ), + ), + required: None, + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("kami"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("kawaii"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("sugoi"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("suki"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tasukaru"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("reactionType"), + ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Type of reaction to a post", + ), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("replyView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A view of a Bluesky reply to a linked post", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "CID of the Bluesky reply", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the reply was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Reply text content"), + ), + format: None, + default: None, + min_length: None, + max_length: Some(3000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the Bluesky reply", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("requestResponseView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A view of a response to a drawing request", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "CID of the response record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the response was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("message"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional message to the requester", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(500usize), + min_graphemes: None, + max_graphemes: Some(150usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static("#postView"), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the response record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("requestView"), + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { + description: Some( + ::jacquard_common::CowStr::new_static( + "A view of a drawing request with author profile and response count", + ), + ), + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_common::smol_str::SmolStr::new_static("isOpen"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("author"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("cid"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "CID of the request record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the request was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "indexedAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the request was indexed", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("isOpen"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "referenceImages", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "URLs of reference images for the request", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Uri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(4usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "responseCount", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: None, + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Tags for categorization", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: Some(32usize), + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(8usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "targetActor", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "app.bsky.actor.defs#profileViewBasic", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of what to draw", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("uri"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "AT-URI of the request record", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + ); + map + }, + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AspectRatio<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "aspectRatio" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.height; + if *value < 1i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "height", + ), + min: 1i64, + actual: *value, + }); + } + } + { + let value = &self.width; + if *value < 1i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "width", + ), + min: 1i64, + actual: *value, + }); + } + } + Ok(()) + } +} + +/// A view of a collection with author profile and item count +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionView<'a> { + /// Collection owner profile + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// CID of the collection record + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// Timestamp when the collection was created + pub created_at: jacquard_common::types::string::Datetime, + /// Collection description + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// Timestamp when the collection was indexed + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub indexed_at: std::option::Option<jacquard_common::types::string::Datetime>, + /// Whether the collection is publicly visible + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub is_public: std::option::Option<bool>, + /// Number of items in the collection + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub item_count: std::option::Option<i64>, + /// Collection name + #[serde(borrow)] + pub name: jacquard_common::CowStr<'a>, + /// AT-URI of the collection record + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod collection_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Uri; + type Cid; + type Author; + type Name; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Uri = Unset; + type Cid = Unset; + type Author = Unset; + type Name = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Uri = Set<members::uri>; + type Cid = S::Cid; + type Author = S::Author; + type Name = S::Name; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Uri = S::Uri; + type Cid = Set<members::cid>; + type Author = S::Author; + type Name = S::Name; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Uri = S::Uri; + type Cid = S::Cid; + type Author = Set<members::author>; + type Name = S::Name; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Uri = S::Uri; + type Cid = S::Cid; + type Author = S::Author; + type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Uri = S::Uri; + type Cid = S::Cid; + type Author = S::Author; + type Name = S::Name; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CollectionViewBuilder<'a, S: collection_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<bool>, + ::core::option::Option<i64>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CollectionView<'a> { + /// Create a new builder for this type + pub fn new() -> CollectionViewBuilder<'a, collection_view_state::Empty> { + CollectionViewBuilder::new() + } +} + +impl<'a> CollectionViewBuilder<'a, collection_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::Author: collection_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> CollectionViewBuilder<'a, collection_view_state::SetAuthor<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::Cid: collection_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> CollectionViewBuilder<'a, collection_view_state::SetCid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::CreatedAt: collection_view_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CollectionViewBuilder<'a, collection_view_state::SetCreatedAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> { + /// Set the `indexedAt` field (optional) + pub fn indexed_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `indexedAt` field to an Option value (optional) + pub fn maybe_indexed_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> { + /// Set the `isPublic` field (optional) + pub fn is_public(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `isPublic` field to an Option value (optional) + pub fn maybe_is_public(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> { + /// Set the `itemCount` field (optional) + pub fn item_count(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `itemCount` field to an Option value (optional) + pub fn maybe_item_count(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::Name: collection_view_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> CollectionViewBuilder<'a, collection_view_state::SetName<S>> { + self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::Uri: collection_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> CollectionViewBuilder<'a, collection_view_state::SetUri<S>> { + self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); + CollectionViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionViewBuilder<'a, S> +where + S: collection_view_state::State, + S::Uri: collection_view_state::IsSet, + S::Cid: collection_view_state::IsSet, + S::Author: collection_view_state::IsSet, + S::Name: collection_view_state::IsSet, + S::CreatedAt: collection_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CollectionView<'a> { + CollectionView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + description: self.__unsafe_private_named.3, + indexed_at: self.__unsafe_private_named.4, + is_public: self.__unsafe_private_named.5, + item_count: self.__unsafe_private_named.6, + name: self.__unsafe_private_named.7.unwrap(), + uri: self.__unsafe_private_named.8.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CollectionView<'a> { + CollectionView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + description: self.__unsafe_private_named.3, + indexed_at: self.__unsafe_private_named.4, + is_public: self.__unsafe_private_named.5, + item_count: self.__unsafe_private_named.6, + name: self.__unsafe_private_named.7.unwrap(), + uri: self.__unsafe_private_named.8.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollectionView<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "collectionView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 500usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 200usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 200usize, + actual: count, + }); + } + } + } + { + let value = &self.name; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 100usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 50usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 50usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +/// A view of a drawing post with author profile and metadata +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PostView<'a> { + /// Aspect ratio of the image + #[serde(borrow)] + pub aspect_ratio: crate::tech_tokimeki::kaku::AspectRatio<'a>, + /// Author profile + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// CID of the post record + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// Timestamp when the post was created + pub created_at: jacquard_common::types::string::Datetime, + /// URL of the drawing image + #[serde(borrow)] + pub image: jacquard_common::types::string::Uri<'a>, + /// Timestamp when the post was indexed + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub indexed_at: std::option::Option<jacquard_common::types::string::Datetime>, + /// Reference to linked Bluesky post + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub linked_post: std::option::Option< + crate::com_atproto::repo::strong_ref::StrongRef<'a>, + >, + /// Counts of each reaction type + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub reaction_counts: std::option::Option< + crate::tech_tokimeki::kaku::ReactionCounts<'a>, + >, + /// Tags for categorization + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Optional description or title + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub text: std::option::Option<jacquard_common::CowStr<'a>>, + /// AT-URI of the post record + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + /// Current user's reaction to this post + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub viewer_reaction: std::option::Option< + crate::tech_tokimeki::kaku::ReactionType<'a>, + >, +} + +pub mod post_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type AspectRatio; + type Uri; + type Author; + type CreatedAt; + type Cid; + type Image; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type AspectRatio = Unset; + type Uri = Unset; + type Author = Unset; + type CreatedAt = Unset; + type Cid = Unset; + type Image = Unset; + } + ///State transition - sets the `aspect_ratio` field to Set + pub struct SetAspectRatio<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAspectRatio<S> {} + impl<S: State> State for SetAspectRatio<S> { + type AspectRatio = Set<members::aspect_ratio>; + type Uri = S::Uri; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Image = S::Image; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type AspectRatio = S::AspectRatio; + type Uri = Set<members::uri>; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Image = S::Image; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type AspectRatio = S::AspectRatio; + type Uri = S::Uri; + type Author = Set<members::author>; + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Image = S::Image; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type AspectRatio = S::AspectRatio; + type Uri = S::Uri; + type Author = S::Author; + type CreatedAt = Set<members::created_at>; + type Cid = S::Cid; + type Image = S::Image; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type AspectRatio = S::AspectRatio; + type Uri = S::Uri; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Cid = Set<members::cid>; + type Image = S::Image; + } + ///State transition - sets the `image` field to Set + pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetImage<S> {} + impl<S: State> State for SetImage<S> { + type AspectRatio = S::AspectRatio; + type Uri = S::Uri; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Cid = S::Cid; + type Image = Set<members::image>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `aspect_ratio` field + pub struct aspect_ratio(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `image` field + pub struct image(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PostViewBuilder<'a, S: post_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::tech_tokimeki::kaku::AspectRatio<'a>>, + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Uri<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<crate::tech_tokimeki::kaku::ReactionCounts<'a>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ::core::option::Option<crate::tech_tokimeki::kaku::ReactionType<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> PostView<'a> { + /// Create a new builder for this type + pub fn new() -> PostViewBuilder<'a, post_view_state::Empty> { + PostViewBuilder::new() + } +} + +impl<'a> PostViewBuilder<'a, post_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::AspectRatio: post_view_state::IsUnset, +{ + /// Set the `aspectRatio` field (required) + pub fn aspect_ratio( + mut self, + value: impl Into<crate::tech_tokimeki::kaku::AspectRatio<'a>>, + ) -> PostViewBuilder<'a, post_view_state::SetAspectRatio<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::Author: post_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> PostViewBuilder<'a, post_view_state::SetAuthor<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::Cid: post_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> PostViewBuilder<'a, post_view_state::SetCid<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::CreatedAt: post_view_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> PostViewBuilder<'a, post_view_state::SetCreatedAt<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::Image: post_view_state::IsUnset, +{ + /// Set the `image` field (required) + pub fn image( + mut self, + value: impl Into<jacquard_common::types::string::Uri<'a>>, + ) -> PostViewBuilder<'a, post_view_state::SetImage<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `indexedAt` field (optional) + pub fn indexed_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `indexedAt` field to an Option value (optional) + pub fn maybe_indexed_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `linkedPost` field (optional) + pub fn linked_post( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `linkedPost` field to an Option value (optional) + pub fn maybe_linked_post( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `reactionCounts` field (optional) + pub fn reaction_counts( + mut self, + value: impl Into<Option<crate::tech_tokimeki::kaku::ReactionCounts<'a>>>, + ) -> Self { + self.__unsafe_private_named.7 = value.into(); + self + } + /// Set the `reactionCounts` field to an Option value (optional) + pub fn maybe_reaction_counts( + mut self, + value: Option<crate::tech_tokimeki::kaku::ReactionCounts<'a>>, + ) -> Self { + self.__unsafe_private_named.7 = value; + self + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.8 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.8 = value; + self + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `text` field (optional) + pub fn text( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.9 = value.into(); + self + } + /// Set the `text` field to an Option value (optional) + pub fn maybe_text(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.9 = value; + self + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::Uri: post_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> PostViewBuilder<'a, post_view_state::SetUri<S>> { + self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); + PostViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> { + /// Set the `viewerReaction` field (optional) + pub fn viewer_reaction( + mut self, + value: impl Into<Option<crate::tech_tokimeki::kaku::ReactionType<'a>>>, + ) -> Self { + self.__unsafe_private_named.11 = value.into(); + self + } + /// Set the `viewerReaction` field to an Option value (optional) + pub fn maybe_viewer_reaction( + mut self, + value: Option<crate::tech_tokimeki::kaku::ReactionType<'a>>, + ) -> Self { + self.__unsafe_private_named.11 = value; + self + } +} + +impl<'a, S> PostViewBuilder<'a, S> +where + S: post_view_state::State, + S::AspectRatio: post_view_state::IsSet, + S::Uri: post_view_state::IsSet, + S::Author: post_view_state::IsSet, + S::CreatedAt: post_view_state::IsSet, + S::Cid: post_view_state::IsSet, + S::Image: post_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> PostView<'a> { + PostView { + aspect_ratio: self.__unsafe_private_named.0.unwrap(), + author: self.__unsafe_private_named.1.unwrap(), + cid: self.__unsafe_private_named.2.unwrap(), + created_at: self.__unsafe_private_named.3.unwrap(), + image: self.__unsafe_private_named.4.unwrap(), + indexed_at: self.__unsafe_private_named.5, + linked_post: self.__unsafe_private_named.6, + reaction_counts: self.__unsafe_private_named.7, + tags: self.__unsafe_private_named.8, + text: self.__unsafe_private_named.9, + uri: self.__unsafe_private_named.10.unwrap(), + viewer_reaction: self.__unsafe_private_named.11, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> PostView<'a> { + PostView { + aspect_ratio: self.__unsafe_private_named.0.unwrap(), + author: self.__unsafe_private_named.1.unwrap(), + cid: self.__unsafe_private_named.2.unwrap(), + created_at: self.__unsafe_private_named.3.unwrap(), + image: self.__unsafe_private_named.4.unwrap(), + indexed_at: self.__unsafe_private_named.5, + linked_post: self.__unsafe_private_named.6, + reaction_counts: self.__unsafe_private_named.7, + tags: self.__unsafe_private_named.8, + text: self.__unsafe_private_named.9, + uri: self.__unsafe_private_named.10.unwrap(), + viewer_reaction: self.__unsafe_private_named.11, + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PostView<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "postView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 8usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 8usize, + actual: value.len(), + }); + } + } + if let Some(ref value) = self.text { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.text { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +/// Counts of each reaction type on a post +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic, + Default +)] +#[serde(rename_all = "camelCase")] +pub struct ReactionCounts<'a> { + /// Count of kami (godly) reactions + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub kami: std::option::Option<i64>, + /// Count of kawaii (cute) reactions + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub kawaii: std::option::Option<i64>, + /// Count of sugoi (amazing) reactions + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub sugoi: std::option::Option<i64>, + /// Count of suki (like) reactions + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub suki: std::option::Option<i64>, + /// Count of tasukaru (helpful) reactions + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub tasukaru: std::option::Option<i64>, +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReactionCounts<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "reactionCounts" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +/// Type of reaction to a post +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ReactionType<'a> { + Suki, + Tasukaru, + Sugoi, + Kawaii, + Kami, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ReactionType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Suki => "suki", + Self::Tasukaru => "tasukaru", + Self::Sugoi => "sugoi", + Self::Kawaii => "kawaii", + Self::Kami => "kami", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ReactionType<'a> { + fn from(s: &'a str) -> Self { + match s { + "suki" => Self::Suki, + "tasukaru" => Self::Tasukaru, + "sugoi" => Self::Sugoi, + "kawaii" => Self::Kawaii, + "kami" => Self::Kami, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From<String> for ReactionType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "suki" => Self::Suki, + "tasukaru" => Self::Tasukaru, + "sugoi" => Self::Sugoi, + "kawaii" => Self::Kawaii, + "kami" => Self::Kami, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> AsRef<str> for ReactionType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> core::fmt::Display for ReactionType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> serde::Serialize for ReactionType<'a> { + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ReactionType<'a> +where + 'de: 'a, +{ + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl jacquard_common::IntoStatic for ReactionType<'_> { + type Output = ReactionType<'static>; + fn into_static(self) -> Self::Output { + match self { + ReactionType::Suki => ReactionType::Suki, + ReactionType::Tasukaru => ReactionType::Tasukaru, + ReactionType::Sugoi => ReactionType::Sugoi, + ReactionType::Kawaii => ReactionType::Kawaii, + ReactionType::Kami => ReactionType::Kami, + ReactionType::Other(v) => ReactionType::Other(v.into_static()), + } + } +} + +/// A view of a Bluesky reply to a linked post +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ReplyView<'a> { + /// Reply author profile + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// CID of the Bluesky reply + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// Timestamp when the reply was created + pub created_at: jacquard_common::types::string::Datetime, + /// Reply text content + #[serde(borrow)] + pub text: jacquard_common::CowStr<'a>, + /// AT-URI of the Bluesky reply + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod reply_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Uri; + type Cid; + type Text; + type Author; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Uri = Unset; + type Cid = Unset; + type Text = Unset; + type Author = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Uri = S::Uri; + type Cid = S::Cid; + type Text = S::Text; + type Author = S::Author; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type CreatedAt = S::CreatedAt; + type Uri = Set<members::uri>; + type Cid = S::Cid; + type Text = S::Text; + type Author = S::Author; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = Set<members::cid>; + type Text = S::Text; + type Author = S::Author; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; + type Text = Set<members::text>; + type Author = S::Author; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; + type Text = S::Text; + type Author = Set<members::author>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `text` field + pub struct text(()); + ///Marker type for the `author` field + pub struct author(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ReplyViewBuilder<'a, S: reply_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> ReplyView<'a> { + /// Create a new builder for this type + pub fn new() -> ReplyViewBuilder<'a, reply_view_state::Empty> { + ReplyViewBuilder::new() + } +} + +impl<'a> ReplyViewBuilder<'a, reply_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::Author: reply_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> ReplyViewBuilder<'a, reply_view_state::SetAuthor<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::Cid: reply_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> ReplyViewBuilder<'a, reply_view_state::SetCid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::CreatedAt: reply_view_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ReplyViewBuilder<'a, reply_view_state::SetCreatedAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::Text: reply_view_state::IsUnset, +{ + /// Set the `text` field (required) + pub fn text( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> ReplyViewBuilder<'a, reply_view_state::SetText<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::Uri: reply_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> ReplyViewBuilder<'a, reply_view_state::SetUri<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + ReplyViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReplyViewBuilder<'a, S> +where + S: reply_view_state::State, + S::CreatedAt: reply_view_state::IsSet, + S::Uri: reply_view_state::IsSet, + S::Cid: reply_view_state::IsSet, + S::Text: reply_view_state::IsSet, + S::Author: reply_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> ReplyView<'a> { + ReplyView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + text: self.__unsafe_private_named.3.unwrap(), + uri: self.__unsafe_private_named.4.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> ReplyView<'a> { + ReplyView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + text: self.__unsafe_private_named.3.unwrap(), + uri: self.__unsafe_private_named.4.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyView<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "replyView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + { + let value = &self.text; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 3000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 3000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.text; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +/// A view of a response to a drawing request +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestResponseView<'a> { + /// Response author profile + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// CID of the response record + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// Timestamp when the response was created + pub created_at: jacquard_common::types::string::Datetime, + /// Optional message to the requester + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub message: std::option::Option<jacquard_common::CowStr<'a>>, + /// The drawing post submitted as response + #[serde(borrow)] + pub post: crate::tech_tokimeki::kaku::PostView<'a>, + /// AT-URI of the response record + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod request_response_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Author; + type Post; + type Cid; + type Uri; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Author = Unset; + type Post = Unset; + type Cid = Unset; + type Uri = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Author = Set<members::author>; + type Post = S::Post; + type Cid = S::Cid; + type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `post` field to Set + pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPost<S> {} + impl<S: State> State for SetPost<S> { + type Author = S::Author; + type Post = Set<members::post>; + type Cid = S::Cid; + type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Author = S::Author; + type Post = S::Post; + type Cid = Set<members::cid>; + type Uri = S::Uri; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Author = S::Author; + type Post = S::Post; + type Cid = S::Cid; + type Uri = Set<members::uri>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Author = S::Author; + type Post = S::Post; + type Cid = S::Cid; + type Uri = S::Uri; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `post` field + pub struct post(()); + ///Marker type for the `cid` field + pub struct cid(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RequestResponseViewBuilder<'a, S: request_response_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<crate::tech_tokimeki::kaku::PostView<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> RequestResponseView<'a> { + /// Create a new builder for this type + pub fn new() -> RequestResponseViewBuilder<'a, request_response_view_state::Empty> { + RequestResponseViewBuilder::new() + } +} + +impl<'a> RequestResponseViewBuilder<'a, request_response_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::Author: request_response_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetAuthor<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::Cid: request_response_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetCid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::CreatedAt: request_response_view_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetCreatedAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_response_view_state::State> RequestResponseViewBuilder<'a, S> { + /// Set the `message` field (optional) + pub fn message( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `message` field to an Option value (optional) + pub fn maybe_message(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::Post: request_response_view_state::IsUnset, +{ + /// Set the `post` field (required) + pub fn post( + mut self, + value: impl Into<crate::tech_tokimeki::kaku::PostView<'a>>, + ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetPost<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::Uri: request_response_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetUri<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + RequestResponseViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseViewBuilder<'a, S> +where + S: request_response_view_state::State, + S::Author: request_response_view_state::IsSet, + S::Post: request_response_view_state::IsSet, + S::Cid: request_response_view_state::IsSet, + S::Uri: request_response_view_state::IsSet, + S::CreatedAt: request_response_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> RequestResponseView<'a> { + RequestResponseView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + message: self.__unsafe_private_named.3, + post: self.__unsafe_private_named.4.unwrap(), + uri: self.__unsafe_private_named.5.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> RequestResponseView<'a> { + RequestResponseView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + message: self.__unsafe_private_named.3, + post: self.__unsafe_private_named.4.unwrap(), + uri: self.__unsafe_private_named.5.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RequestResponseView<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "requestResponseView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.message { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 500usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.message { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 150usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 150usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +/// A view of a drawing request with author profile and response count +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestView<'a> { + /// Request author profile + #[serde(borrow)] + pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, + /// CID of the request record + #[serde(borrow)] + pub cid: jacquard_common::types::string::Cid<'a>, + /// Timestamp when the request was created + pub created_at: jacquard_common::types::string::Datetime, + /// Timestamp when the request was indexed + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub indexed_at: std::option::Option<jacquard_common::types::string::Datetime>, + /// Whether the request is still accepting responses + pub is_open: bool, + /// URLs of reference images for the request + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub reference_images: std::option::Option< + Vec<jacquard_common::types::string::Uri<'a>>, + >, + /// Number of responses to this request + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub response_count: std::option::Option<i64>, + /// Tags for categorization + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Specific artist the request is directed to + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub target_actor: std::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + /// Description of what to draw + #[serde(borrow)] + pub text: jacquard_common::CowStr<'a>, + /// AT-URI of the request record + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, +} + +pub mod request_view_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Text; + type IsOpen; + type Author; + type CreatedAt; + type Uri; + type Cid; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Text = Unset; + type IsOpen = Unset; + type Author = Unset; + type CreatedAt = Unset; + type Uri = Unset; + type Cid = Unset; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type Text = Set<members::text>; + type IsOpen = S::IsOpen; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; + } + ///State transition - sets the `is_open` field to Set + pub struct SetIsOpen<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIsOpen<S> {} + impl<S: State> State for SetIsOpen<S> { + type Text = S::Text; + type IsOpen = Set<members::is_open>; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAuthor<S> {} + impl<S: State> State for SetAuthor<S> { + type Text = S::Text; + type IsOpen = S::IsOpen; + type Author = Set<members::author>; + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = S::Cid; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Text = S::Text; + type IsOpen = S::IsOpen; + type Author = S::Author; + type CreatedAt = Set<members::created_at>; + type Uri = S::Uri; + type Cid = S::Cid; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type Text = S::Text; + type IsOpen = S::IsOpen; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Uri = Set<members::uri>; + type Cid = S::Cid; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { + type Text = S::Text; + type IsOpen = S::IsOpen; + type Author = S::Author; + type CreatedAt = S::CreatedAt; + type Uri = S::Uri; + type Cid = Set<members::cid>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `text` field + pub struct text(()); + ///Marker type for the `is_open` field + pub struct is_open(()); + ///Marker type for the `author` field + pub struct author(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `uri` field + pub struct uri(()); + ///Marker type for the `cid` field + pub struct cid(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RequestViewBuilder<'a, S: request_view_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::types::string::Cid<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<bool>, + ::core::option::Option<Vec<jacquard_common::types::string::Uri<'a>>>, + ::core::option::Option<i64>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> RequestView<'a> { + /// Create a new builder for this type + pub fn new() -> RequestViewBuilder<'a, request_view_state::Empty> { + RequestViewBuilder::new() + } +} + +impl<'a> RequestViewBuilder<'a, request_view_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::Author: request_view_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> RequestViewBuilder<'a, request_view_state::SetAuthor<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::Cid: request_view_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into<jacquard_common::types::string::Cid<'a>>, + ) -> RequestViewBuilder<'a, request_view_state::SetCid<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::CreatedAt: request_view_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RequestViewBuilder<'a, request_view_state::SetCreatedAt<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> { + /// Set the `indexedAt` field (optional) + pub fn indexed_at( + mut self, + value: impl Into<Option<jacquard_common::types::string::Datetime>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `indexedAt` field to an Option value (optional) + pub fn maybe_indexed_at( + mut self, + value: Option<jacquard_common::types::string::Datetime>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::IsOpen: request_view_state::IsUnset, +{ + /// Set the `isOpen` field (required) + pub fn is_open( + mut self, + value: impl Into<bool>, + ) -> RequestViewBuilder<'a, request_view_state::SetIsOpen<S>> { + self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> { + /// Set the `referenceImages` field (optional) + pub fn reference_images( + mut self, + value: impl Into<Option<Vec<jacquard_common::types::string::Uri<'a>>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `referenceImages` field to an Option value (optional) + pub fn maybe_reference_images( + mut self, + value: Option<Vec<jacquard_common::types::string::Uri<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> { + /// Set the `responseCount` field (optional) + pub fn response_count(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `responseCount` field to an Option value (optional) + pub fn maybe_response_count(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.7 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.7 = value; + self + } +} + +impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> { + /// Set the `targetActor` field (optional) + pub fn target_actor( + mut self, + value: impl Into<Option<crate::app_bsky::actor::ProfileViewBasic<'a>>>, + ) -> Self { + self.__unsafe_private_named.8 = value.into(); + self + } + /// Set the `targetActor` field to an Option value (optional) + pub fn maybe_target_actor( + mut self, + value: Option<crate::app_bsky::actor::ProfileViewBasic<'a>>, + ) -> Self { + self.__unsafe_private_named.8 = value; + self + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::Text: request_view_state::IsUnset, +{ + /// Set the `text` field (required) + pub fn text( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> RequestViewBuilder<'a, request_view_state::SetText<S>> { + self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::Uri: request_view_state::IsUnset, +{ + /// Set the `uri` field (required) + pub fn uri( + mut self, + value: impl Into<jacquard_common::types::string::AtUri<'a>>, + ) -> RequestViewBuilder<'a, request_view_state::SetUri<S>> { + self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into()); + RequestViewBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestViewBuilder<'a, S> +where + S: request_view_state::State, + S::Text: request_view_state::IsSet, + S::IsOpen: request_view_state::IsSet, + S::Author: request_view_state::IsSet, + S::CreatedAt: request_view_state::IsSet, + S::Uri: request_view_state::IsSet, + S::Cid: request_view_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> RequestView<'a> { + RequestView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + indexed_at: self.__unsafe_private_named.3, + is_open: self.__unsafe_private_named.4.unwrap(), + reference_images: self.__unsafe_private_named.5, + response_count: self.__unsafe_private_named.6, + tags: self.__unsafe_private_named.7, + target_actor: self.__unsafe_private_named.8, + text: self.__unsafe_private_named.9.unwrap(), + uri: self.__unsafe_private_named.10.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> RequestView<'a> { + RequestView { + author: self.__unsafe_private_named.0.unwrap(), + cid: self.__unsafe_private_named.1.unwrap(), + created_at: self.__unsafe_private_named.2.unwrap(), + indexed_at: self.__unsafe_private_named.3, + is_open: self.__unsafe_private_named.4.unwrap(), + reference_images: self.__unsafe_private_named.5, + response_count: self.__unsafe_private_named.6, + tags: self.__unsafe_private_named.7, + target_actor: self.__unsafe_private_named.8, + text: self.__unsafe_private_named.9.unwrap(), + uri: self.__unsafe_private_named.10.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RequestView<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.defs" + } + fn def_name() -> &'static str { + "requestView" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_defs() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.reference_images { + #[allow(unused_comparisons)] + if value.len() > 4usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "reference_images", + ), + max: 4usize, + actual: value.len(), + }); + } + } + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 8usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 8usize, + actual: value.len(), + }); + } + } + { + let value = &self.text; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.text; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/collection.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/collection.rs new file mode 100644 index 00000000..748085ab --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/collection.rs @@ -0,0 +1,471 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.collection +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A collection to organize drawings into folders +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Collection<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// Collection description + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub description: std::option::Option<jacquard_common::CowStr<'a>>, + /// Whether the collection is publicly visible + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub is_public: std::option::Option<bool>, + /// Collection name + #[serde(borrow)] + pub name: jacquard_common::CowStr<'a>, +} + +pub mod collection_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Name; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Name = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Name = Set<members::name>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Name = S::Name; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CollectionBuilder<'a, S: collection_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<bool>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Collection<'a> { + /// Create a new builder for this type + pub fn new() -> CollectionBuilder<'a, collection_state::Empty> { + CollectionBuilder::new() + } +} + +impl<'a> CollectionBuilder<'a, collection_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CollectionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionBuilder<'a, S> +where + S: collection_state::State, + S::CreatedAt: collection_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CollectionBuilder<'a, collection_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CollectionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { + /// Set the `description` field (optional) + pub fn description( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description( + mut self, + value: Option<jacquard_common::CowStr<'a>>, + ) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: collection_state::State> CollectionBuilder<'a, S> { + /// Set the `isPublic` field (optional) + pub fn is_public(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `isPublic` field to an Option value (optional) + pub fn maybe_is_public(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> CollectionBuilder<'a, S> +where + S: collection_state::State, + S::Name: collection_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> CollectionBuilder<'a, collection_state::SetName<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + CollectionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionBuilder<'a, S> +where + S: collection_state::State, + S::Name: collection_state::IsSet, + S::CreatedAt: collection_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Collection<'a> { + Collection { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + is_public: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Collection<'a> { + Collection { + created_at: self.__unsafe_private_named.0.unwrap(), + description: self.__unsafe_private_named.1, + is_public: self.__unsafe_private_named.2, + name: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Collection<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, CollectionRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Collection<'a>, +} + +impl From<CollectionGetRecordOutput<'_>> for Collection<'_> { + fn from(output: CollectionGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Collection<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.collection"; + type Record = CollectionRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct CollectionRecord; +impl jacquard_common::xrpc::XrpcResp for CollectionRecord { + const NSID: &'static str = "tech.tokimeki.kaku.collection"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CollectionGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for CollectionRecord { + const NSID: &'static str = "tech.tokimeki.kaku.collection"; + type Record = CollectionRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Collection<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.collection" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_collection() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.description { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 500usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.description { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 200usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "description", + ), + max: 200usize, + actual: count, + }); + } + } + } + { + let value = &self.name; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 100usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 100usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) < 1usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + min: 1usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.name; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 50usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "name", + ), + max: 50usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_collection() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.collection"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A collection to organize drawings into folders", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "description", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Collection description", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(500usize), + min_graphemes: None, + max_graphemes: Some(200usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "isPublic", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("name"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Collection name"), + ), + format: None, + default: None, + min_length: Some(1usize), + max_length: Some(100usize), + min_graphemes: None, + max_graphemes: Some(50usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/collection_item.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/collection_item.rs new file mode 100644 index 00000000..867c6f6f --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/collection_item.rs @@ -0,0 +1,405 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.collectionItem +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// An item in a collection linking to a post +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionItem<'a> { + /// Reference to the collection + #[serde(borrow)] + pub collection: crate::com_atproto::repo::strong_ref::StrongRef<'a>, + pub created_at: jacquard_common::types::string::Datetime, + /// Order within the collection + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub order: std::option::Option<i64>, + /// Reference to the post + #[serde(borrow)] + pub post: crate::com_atproto::repo::strong_ref::StrongRef<'a>, +} + +pub mod collection_item_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Post; + type CreatedAt; + type Collection; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Post = Unset; + type CreatedAt = Unset; + type Collection = Unset; + } + ///State transition - sets the `post` field to Set + pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPost<S> {} + impl<S: State> State for SetPost<S> { + type Post = Set<members::post>; + type CreatedAt = S::CreatedAt; + type Collection = S::Collection; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Post = S::Post; + type CreatedAt = Set<members::created_at>; + type Collection = S::Collection; + } + ///State transition - sets the `collection` field to Set + pub struct SetCollection<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCollection<S> {} + impl<S: State> State for SetCollection<S> { + type Post = S::Post; + type CreatedAt = S::CreatedAt; + type Collection = Set<members::collection>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `post` field + pub struct post(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `collection` field + pub struct collection(()); + } +} + +/// Builder for constructing an instance of this type +pub struct CollectionItemBuilder<'a, S: collection_item_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<i64>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> CollectionItem<'a> { + /// Create a new builder for this type + pub fn new() -> CollectionItemBuilder<'a, collection_item_state::Empty> { + CollectionItemBuilder::new() + } +} + +impl<'a> CollectionItemBuilder<'a, collection_item_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::Collection: collection_item_state::IsUnset, +{ + /// Set the `collection` field (required) + pub fn collection( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetCollection<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::CreatedAt: collection_item_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: collection_item_state::State> CollectionItemBuilder<'a, S> { + /// Set the `order` field (optional) + pub fn order(mut self, value: impl Into<Option<i64>>) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `order` field to an Option value (optional) + pub fn maybe_order(mut self, value: Option<i64>) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::Post: collection_item_state::IsUnset, +{ + /// Set the `post` field (required) + pub fn post( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> CollectionItemBuilder<'a, collection_item_state::SetPost<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + CollectionItemBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> CollectionItemBuilder<'a, S> +where + S: collection_item_state::State, + S::Post: collection_item_state::IsSet, + S::CreatedAt: collection_item_state::IsSet, + S::Collection: collection_item_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> CollectionItem<'a> { + CollectionItem { + collection: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + order: self.__unsafe_private_named.2, + post: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> CollectionItem<'a> { + CollectionItem { + collection: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + order: self.__unsafe_private_named.2, + post: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> CollectionItem<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, CollectionItemRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct CollectionItemGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: CollectionItem<'a>, +} + +impl From<CollectionItemGetRecordOutput<'_>> for CollectionItem<'_> { + fn from(output: CollectionItemGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for CollectionItem<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.collectionItem"; + type Record = CollectionItemRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct CollectionItemRecord; +impl jacquard_common::xrpc::XrpcResp for CollectionItemRecord { + const NSID: &'static str = "tech.tokimeki.kaku.collectionItem"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = CollectionItemGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for CollectionItemRecord { + const NSID: &'static str = "tech.tokimeki.kaku.collectionItem"; + type Record = CollectionItemRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CollectionItem<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.collectionItem" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_collectionItem() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.order { + if *value < 0i64 { + return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "order", + ), + min: 0i64, + actual: *value, + }); + } + } + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_collectionItem() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.collectionItem"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "An item in a collection linking to a post", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("collection"), + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "collection", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("order"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { + description: None, + default: None, + minimum: Some(0i64), + maximum: None, + r#enum: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/post.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/post.rs new file mode 100644 index 00000000..cb24090d --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/post.rs @@ -0,0 +1,578 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.post +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A drawing post created with the drawing tool +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Post<'a> { + /// Aspect ratio of the image + #[serde(borrow)] + pub aspect_ratio: crate::tech_tokimeki::kaku::AspectRatio<'a>, + /// Timestamp when the post was created + pub created_at: jacquard_common::types::string::Datetime, + /// The drawn image (max 1MB) + #[serde(borrow)] + pub image: jacquard_common::types::blob::BlobRef<'a>, + /// Bluesky post created for this drawing + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub linked_post: std::option::Option< + crate::com_atproto::repo::strong_ref::StrongRef<'a>, + >, + /// Reference to a related Bluesky post + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub subject: std::option::Option< + crate::com_atproto::repo::strong_ref::StrongRef<'a>, + >, + /// Tags for categorization + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Optional description or title + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub text: std::option::Option<jacquard_common::CowStr<'a>>, +} + +pub mod post_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type AspectRatio; + type Image; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type AspectRatio = Unset; + type Image = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `aspect_ratio` field to Set + pub struct SetAspectRatio<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAspectRatio<S> {} + impl<S: State> State for SetAspectRatio<S> { + type AspectRatio = Set<members::aspect_ratio>; + type Image = S::Image; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `image` field to Set + pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetImage<S> {} + impl<S: State> State for SetImage<S> { + type AspectRatio = S::AspectRatio; + type Image = Set<members::image>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type AspectRatio = S::AspectRatio; + type Image = S::Image; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `aspect_ratio` field + pub struct aspect_ratio(()); + ///Marker type for the `image` field + pub struct image(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct PostBuilder<'a, S: post_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<crate::tech_tokimeki::kaku::AspectRatio<'a>>, + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Post<'a> { + /// Create a new builder for this type + pub fn new() -> PostBuilder<'a, post_state::Empty> { + PostBuilder::new() + } +} + +impl<'a> PostBuilder<'a, post_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + PostBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostBuilder<'a, S> +where + S: post_state::State, + S::AspectRatio: post_state::IsUnset, +{ + /// Set the `aspectRatio` field (required) + pub fn aspect_ratio( + mut self, + value: impl Into<crate::tech_tokimeki::kaku::AspectRatio<'a>>, + ) -> PostBuilder<'a, post_state::SetAspectRatio<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + PostBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostBuilder<'a, S> +where + S: post_state::State, + S::CreatedAt: post_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> PostBuilder<'a, post_state::SetCreatedAt<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + PostBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> PostBuilder<'a, S> +where + S: post_state::State, + S::Image: post_state::IsUnset, +{ + /// Set the `image` field (required) + pub fn image( + mut self, + value: impl Into<jacquard_common::types::blob::BlobRef<'a>>, + ) -> PostBuilder<'a, post_state::SetImage<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + PostBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: post_state::State> PostBuilder<'a, S> { + /// Set the `linkedPost` field (optional) + pub fn linked_post( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `linkedPost` field to an Option value (optional) + pub fn maybe_linked_post( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: post_state::State> PostBuilder<'a, S> { + /// Set the `subject` field (optional) + pub fn subject( + mut self, + value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `subject` field to an Option value (optional) + pub fn maybe_subject( + mut self, + value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S: post_state::State> PostBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.5 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.5 = value; + self + } +} + +impl<'a, S: post_state::State> PostBuilder<'a, S> { + /// Set the `text` field (optional) + pub fn text( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.6 = value.into(); + self + } + /// Set the `text` field to an Option value (optional) + pub fn maybe_text(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.6 = value; + self + } +} + +impl<'a, S> PostBuilder<'a, S> +where + S: post_state::State, + S::AspectRatio: post_state::IsSet, + S::Image: post_state::IsSet, + S::CreatedAt: post_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Post<'a> { + Post { + aspect_ratio: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + image: self.__unsafe_private_named.2.unwrap(), + linked_post: self.__unsafe_private_named.3, + subject: self.__unsafe_private_named.4, + tags: self.__unsafe_private_named.5, + text: self.__unsafe_private_named.6, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Post<'a> { + Post { + aspect_ratio: self.__unsafe_private_named.0.unwrap(), + created_at: self.__unsafe_private_named.1.unwrap(), + image: self.__unsafe_private_named.2.unwrap(), + linked_post: self.__unsafe_private_named.3, + subject: self.__unsafe_private_named.4, + tags: self.__unsafe_private_named.5, + text: self.__unsafe_private_named.6, + extra_data: Some(extra_data), + } + } +} + +impl<'a> Post<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, PostRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct PostGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Post<'a>, +} + +impl From<PostGetRecordOutput<'_>> for Post<'_> { + fn from(output: PostGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Post<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.post"; + type Record = PostRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct PostRecord; +impl jacquard_common::xrpc::XrpcResp for PostRecord { + const NSID: &'static str = "tech.tokimeki.kaku.post"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = PostGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for PostRecord { + const NSID: &'static str = "tech.tokimeki.kaku.post"; + type Record = PostRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Post<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.post" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_post() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 8usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 8usize, + actual: value.len(), + }); + } + } + if let Some(ref value) = self.text { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.text { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_post() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.post"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A drawing post created with the drawing tool", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "aspectRatio", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "tech.tokimeki.kaku.defs#aspectRatio", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the post was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("image"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "linkedPost", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("subject"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Tags for categorization", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: Some(32usize), + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(8usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional description or title", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/reaction.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/reaction.rs new file mode 100644 index 00000000..1021a6af --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/reaction.rs @@ -0,0 +1,472 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.reaction +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A reaction to a post +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Reaction<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// Reference to the post being reacted to + #[serde(borrow)] + pub subject: crate::com_atproto::repo::strong_ref::StrongRef<'a>, + /// Type of reaction + #[serde(borrow)] + pub r#type: ReactionType<'a>, +} + +pub mod reaction_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Subject; + type CreatedAt; + type Type; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Subject = Unset; + type CreatedAt = Unset; + type Type = Unset; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Subject = Set<members::subject>; + type CreatedAt = S::CreatedAt; + type Type = S::Type; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; + type Type = S::Type; + } + ///State transition - sets the `type` field to Set + pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetType<S> {} + impl<S: State> State for SetType<S> { + type Subject = S::Subject; + type CreatedAt = S::CreatedAt; + type Type = Set<members::r#type>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `subject` field + pub struct subject(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `type` field + pub struct r#type(()); + } +} + +/// Builder for constructing an instance of this type +pub struct ReactionBuilder<'a, S: reaction_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<ReactionType<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Reaction<'a> { + /// Create a new builder for this type + pub fn new() -> ReactionBuilder<'a, reaction_state::Empty> { + ReactionBuilder::new() + } +} + +impl<'a> ReactionBuilder<'a, reaction_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + ReactionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReactionBuilder<'a, S> +where + S: reaction_state::State, + S::CreatedAt: reaction_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> ReactionBuilder<'a, reaction_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + ReactionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReactionBuilder<'a, S> +where + S: reaction_state::State, + S::Subject: reaction_state::IsUnset, +{ + /// Set the `subject` field (required) + pub fn subject( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> ReactionBuilder<'a, reaction_state::SetSubject<S>> { + self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); + ReactionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReactionBuilder<'a, S> +where + S: reaction_state::State, + S::Type: reaction_state::IsUnset, +{ + /// Set the `type` field (required) + pub fn r#type( + mut self, + value: impl Into<ReactionType<'a>>, + ) -> ReactionBuilder<'a, reaction_state::SetType<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + ReactionBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> ReactionBuilder<'a, S> +where + S: reaction_state::State, + S::Subject: reaction_state::IsSet, + S::CreatedAt: reaction_state::IsSet, + S::Type: reaction_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Reaction<'a> { + Reaction { + created_at: self.__unsafe_private_named.0.unwrap(), + subject: self.__unsafe_private_named.1.unwrap(), + r#type: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Reaction<'a> { + Reaction { + created_at: self.__unsafe_private_named.0.unwrap(), + subject: self.__unsafe_private_named.1.unwrap(), + r#type: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Reaction<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, ReactionRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Type of reaction +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ReactionType<'a> { + Suki, + Tasukaru, + Sugoi, + Kawaii, + Kami, + Other(jacquard_common::CowStr<'a>), +} + +impl<'a> ReactionType<'a> { + pub fn as_str(&self) -> &str { + match self { + Self::Suki => "suki", + Self::Tasukaru => "tasukaru", + Self::Sugoi => "sugoi", + Self::Kawaii => "kawaii", + Self::Kami => "kami", + Self::Other(s) => s.as_ref(), + } + } +} + +impl<'a> From<&'a str> for ReactionType<'a> { + fn from(s: &'a str) -> Self { + match s { + "suki" => Self::Suki, + "tasukaru" => Self::Tasukaru, + "sugoi" => Self::Sugoi, + "kawaii" => Self::Kawaii, + "kami" => Self::Kami, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> From<String> for ReactionType<'a> { + fn from(s: String) -> Self { + match s.as_str() { + "suki" => Self::Suki, + "tasukaru" => Self::Tasukaru, + "sugoi" => Self::Sugoi, + "kawaii" => Self::Kawaii, + "kami" => Self::Kami, + _ => Self::Other(jacquard_common::CowStr::from(s)), + } + } +} + +impl<'a> core::fmt::Display for ReactionType<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +impl<'a> AsRef<str> for ReactionType<'a> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'a> serde::Serialize for ReactionType<'a> { + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} + +impl<'de, 'a> serde::Deserialize<'de> for ReactionType<'a> +where + 'de: 'a, +{ + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: serde::Deserializer<'de>, + { + let s = <&'de str>::deserialize(deserializer)?; + Ok(Self::from(s)) + } +} + +impl<'a> Default for ReactionType<'a> { + fn default() -> Self { + Self::Other(Default::default()) + } +} + +impl jacquard_common::IntoStatic for ReactionType<'_> { + type Output = ReactionType<'static>; + fn into_static(self) -> Self::Output { + match self { + ReactionType::Suki => ReactionType::Suki, + ReactionType::Tasukaru => ReactionType::Tasukaru, + ReactionType::Sugoi => ReactionType::Sugoi, + ReactionType::Kawaii => ReactionType::Kawaii, + ReactionType::Kami => ReactionType::Kami, + ReactionType::Other(v) => ReactionType::Other(v.into_static()), + } + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct ReactionGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Reaction<'a>, +} + +impl From<ReactionGetRecordOutput<'_>> for Reaction<'_> { + fn from(output: ReactionGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Reaction<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.reaction"; + type Record = ReactionRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct ReactionRecord; +impl jacquard_common::xrpc::XrpcResp for ReactionRecord { + const NSID: &'static str = "tech.tokimeki.kaku.reaction"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = ReactionGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for ReactionRecord { + const NSID: &'static str = "tech.tokimeki.kaku.reaction"; + type Record = ReactionRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Reaction<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.reaction" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_reaction() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_reaction() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.reaction"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static("A reaction to a post"), + ), + key: Some(::jacquard_common::CowStr::new_static("any")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("subject"), + ::jacquard_common::smol_str::SmolStr::new_static("type"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("subject"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("type"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static("Type of reaction"), + ), + format: None, + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/request.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/request.rs new file mode 100644 index 00000000..e057df1e --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/request.rs @@ -0,0 +1,551 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.request +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A request for someone to draw something +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct Request<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// Whether still accepting responses + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub is_open: std::option::Option<bool>, + /// Reference images for the request + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub reference_images: std::option::Option< + Vec<jacquard_common::types::blob::BlobRef<'a>>, + >, + /// Tags for categorization + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, + /// Optional: specific artist to request + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub target_actor: std::option::Option<jacquard_common::types::string::Did<'a>>, + /// Description of what to draw + #[serde(borrow)] + pub text: jacquard_common::CowStr<'a>, +} + +pub mod request_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Text; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Text = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `text` field to Set + pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetText<S> {} + impl<S: State> State for SetText<S> { + type Text = Set<members::text>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Text = S::Text; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `text` field + pub struct text(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RequestBuilder<'a, S: request_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<bool>, + ::core::option::Option<Vec<jacquard_common::types::blob::BlobRef<'a>>>, + ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, + ::core::option::Option<jacquard_common::types::string::Did<'a>>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> Request<'a> { + /// Create a new builder for this type + pub fn new() -> RequestBuilder<'a, request_state::Empty> { + RequestBuilder::new() + } +} + +impl<'a> RequestBuilder<'a, request_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::CreatedAt: request_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RequestBuilder<'a, request_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `isOpen` field (optional) + pub fn is_open(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `isOpen` field to an Option value (optional) + pub fn maybe_is_open(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `referenceImages` field (optional) + pub fn reference_images( + mut self, + value: impl Into<Option<Vec<jacquard_common::types::blob::BlobRef<'a>>>>, + ) -> Self { + self.__unsafe_private_named.2 = value.into(); + self + } + /// Set the `referenceImages` field to an Option value (optional) + pub fn maybe_reference_images( + mut self, + value: Option<Vec<jacquard_common::types::blob::BlobRef<'a>>>, + ) -> Self { + self.__unsafe_private_named.2 = value; + self + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `tags` field (optional) + pub fn tags( + mut self, + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, + ) -> Self { + self.__unsafe_private_named.3 = value.into(); + self + } + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags( + mut self, + value: Option<Vec<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.3 = value; + self + } +} + +impl<'a, S: request_state::State> RequestBuilder<'a, S> { + /// Set the `targetActor` field (optional) + pub fn target_actor( + mut self, + value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, + ) -> Self { + self.__unsafe_private_named.4 = value.into(); + self + } + /// Set the `targetActor` field to an Option value (optional) + pub fn maybe_target_actor( + mut self, + value: Option<jacquard_common::types::string::Did<'a>>, + ) -> Self { + self.__unsafe_private_named.4 = value; + self + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::Text: request_state::IsUnset, +{ + /// Set the `text` field (required) + pub fn text( + mut self, + value: impl Into<jacquard_common::CowStr<'a>>, + ) -> RequestBuilder<'a, request_state::SetText<S>> { + self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); + RequestBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestBuilder<'a, S> +where + S: request_state::State, + S::Text: request_state::IsSet, + S::CreatedAt: request_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> Request<'a> { + Request { + created_at: self.__unsafe_private_named.0.unwrap(), + is_open: self.__unsafe_private_named.1, + reference_images: self.__unsafe_private_named.2, + tags: self.__unsafe_private_named.3, + target_actor: self.__unsafe_private_named.4, + text: self.__unsafe_private_named.5.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> Request<'a> { + Request { + created_at: self.__unsafe_private_named.0.unwrap(), + is_open: self.__unsafe_private_named.1, + reference_images: self.__unsafe_private_named.2, + tags: self.__unsafe_private_named.3, + target_actor: self.__unsafe_private_named.4, + text: self.__unsafe_private_named.5.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> Request<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, RequestRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: Request<'a>, +} + +impl From<RequestGetRecordOutput<'_>> for Request<'_> { + fn from(output: RequestGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for Request<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.request"; + type Record = RequestRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct RequestRecord; +impl jacquard_common::xrpc::XrpcResp for RequestRecord { + const NSID: &'static str = "tech.tokimeki.kaku.request"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = RequestGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for RequestRecord { + const NSID: &'static str = "tech.tokimeki.kaku.request"; + type Record = RequestRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Request<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.request" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_request() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.reference_images { + #[allow(unused_comparisons)] + if value.len() > 4usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "reference_images", + ), + max: 4usize, + actual: value.len(), + }); + } + } + if let Some(ref value) = self.tags { + #[allow(unused_comparisons)] + if value.len() > 8usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "tags", + ), + max: 8usize, + actual: value.len(), + }); + } + } + { + let value = &self.text; + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 1000usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 1000usize, + actual: <str>::len(value.as_ref()), + }); + } + } + { + let value = &self.text; + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 300usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "text", + ), + max: 300usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_request() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.request"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A request for someone to draw something", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("isOpen"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "referenceImages", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Reference images for the request", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::Blob(::jacquard_lexicon::lexicon::LexBlob { + description: None, + accept: None, + max_size: None, + }), + min_length: None, + max_length: Some(4usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("tags"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { + description: Some( + ::jacquard_common::CowStr::new_static( + "Tags for categorization", + ), + ), + items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: None, + default: None, + min_length: None, + max_length: Some(64usize), + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + min_length: None, + max_length: Some(8usize), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "targetActor", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional: specific artist to request", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Did, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("text"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Description of what to draw", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(1000usize), + min_graphemes: None, + max_graphemes: Some(300usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/request_response.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/request_response.rs new file mode 100644 index 00000000..0319916f --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/request_response.rs @@ -0,0 +1,434 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.requestResponse +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// A post created in response to a request +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestResponse<'a> { + pub created_at: jacquard_common::types::string::Datetime, + /// Optional message to the requester + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub message: std::option::Option<jacquard_common::CowStr<'a>>, + /// Reference to the post created as response + #[serde(borrow)] + pub post: crate::com_atproto::repo::strong_ref::StrongRef<'a>, + /// Reference to the request + #[serde(borrow)] + pub request: crate::com_atproto::repo::strong_ref::StrongRef<'a>, +} + +pub mod request_response_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type Request; + type Post; + type CreatedAt; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type Request = Unset; + type Post = Unset; + type CreatedAt = Unset; + } + ///State transition - sets the `request` field to Set + pub struct SetRequest<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRequest<S> {} + impl<S: State> State for SetRequest<S> { + type Request = Set<members::request>; + type Post = S::Post; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `post` field to Set + pub struct SetPost<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPost<S> {} + impl<S: State> State for SetPost<S> { + type Request = S::Request; + type Post = Set<members::post>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Request = S::Request; + type Post = S::Post; + type CreatedAt = Set<members::created_at>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `request` field + pub struct request(()); + ///Marker type for the `post` field + pub struct post(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RequestResponseBuilder<'a, S: request_response_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<jacquard_common::CowStr<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> RequestResponse<'a> { + /// Create a new builder for this type + pub fn new() -> RequestResponseBuilder<'a, request_response_state::Empty> { + RequestResponseBuilder::new() + } +} + +impl<'a> RequestResponseBuilder<'a, request_response_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RequestResponseBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseBuilder<'a, S> +where + S: request_response_state::State, + S::CreatedAt: request_response_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RequestResponseBuilder<'a, request_response_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RequestResponseBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: request_response_state::State> RequestResponseBuilder<'a, S> { + /// Set the `message` field (optional) + pub fn message( + mut self, + value: impl Into<Option<jacquard_common::CowStr<'a>>>, + ) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `message` field to an Option value (optional) + pub fn maybe_message(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> RequestResponseBuilder<'a, S> +where + S: request_response_state::State, + S::Post: request_response_state::IsUnset, +{ + /// Set the `post` field (required) + pub fn post( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> RequestResponseBuilder<'a, request_response_state::SetPost<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RequestResponseBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseBuilder<'a, S> +where + S: request_response_state::State, + S::Request: request_response_state::IsUnset, +{ + /// Set the `request` field (required) + pub fn request( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> RequestResponseBuilder<'a, request_response_state::SetRequest<S>> { + self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); + RequestResponseBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RequestResponseBuilder<'a, S> +where + S: request_response_state::State, + S::Request: request_response_state::IsSet, + S::Post: request_response_state::IsSet, + S::CreatedAt: request_response_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> RequestResponse<'a> { + RequestResponse { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1, + post: self.__unsafe_private_named.2.unwrap(), + request: self.__unsafe_private_named.3.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> RequestResponse<'a> { + RequestResponse { + created_at: self.__unsafe_private_named.0.unwrap(), + message: self.__unsafe_private_named.1, + post: self.__unsafe_private_named.2.unwrap(), + request: self.__unsafe_private_named.3.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> RequestResponse<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, RequestResponseRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RequestResponseGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: RequestResponse<'a>, +} + +impl From<RequestResponseGetRecordOutput<'_>> for RequestResponse<'_> { + fn from(output: RequestResponseGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for RequestResponse<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.requestResponse"; + type Record = RequestResponseRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct RequestResponseRecord; +impl jacquard_common::xrpc::XrpcResp for RequestResponseRecord { + const NSID: &'static str = "tech.tokimeki.kaku.requestResponse"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = RequestResponseGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for RequestResponseRecord { + const NSID: &'static str = "tech.tokimeki.kaku.requestResponse"; + type Record = RequestResponseRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RequestResponse<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.requestResponse" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_requestResponse() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + if let Some(ref value) = self.message { + #[allow(unused_comparisons)] + if <str>::len(value.as_ref()) > 500usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 500usize, + actual: <str>::len(value.as_ref()), + }); + } + } + if let Some(ref value) = self.message { + { + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( + value.as_ref(), + true, + ) + .count(); + if count > 150usize { + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { + path: ::jacquard_lexicon::validation::ValidationPath::from_field( + "message", + ), + max: 150usize, + actual: count, + }); + } + } + } + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_requestResponse() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.requestResponse"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "A post created in response to a request", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("request"), + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: None, + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("message"), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Optional message to the requester", + ), + ), + format: None, + default: None, + min_length: None, + max_length: Some(500usize), + min_graphemes: None, + max_graphemes: Some(150usize), + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("post"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("request"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/kaku/room_gate.rs b/crates/jacquard-api/src/tech_tokimeki/kaku/room_gate.rs new file mode 100644 index 00000000..4606db31 --- /dev/null +++ b/crates/jacquard-api/src/tech_tokimeki/kaku/room_gate.rs @@ -0,0 +1,346 @@ +// @generated by jacquard-lexicon. DO NOT EDIT. +// +// Lexicon: tech.tokimeki.kaku.roomGate +// +// This file was automatically generated from Lexicon schemas. +// Any manual changes will be overwritten on the next regeneration. + +/// Gate settings for a ROOM post (like threadgate) +#[jacquard_derive::lexicon] +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RoomGate<'a> { + /// Timestamp when the gate was created + pub created_at: jacquard_common::types::string::Datetime, + /// Whether the room is closed for new replies + #[serde(skip_serializing_if = "std::option::Option::is_none")] + pub is_closed: std::option::Option<bool>, + /// Reference to the ROOM post + #[serde(borrow)] + pub room: crate::com_atproto::repo::strong_ref::StrongRef<'a>, +} + +pub mod room_gate_state { + + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; + #[allow(unused)] + use ::core::marker::PhantomData; + mod sealed { + pub trait Sealed {} + } + /// State trait tracking which required fields have been set + pub trait State: sealed::Sealed { + type CreatedAt; + type Room; + } + /// Empty state - all required fields are unset + pub struct Empty(()); + impl sealed::Sealed for Empty {} + impl State for Empty { + type CreatedAt = Unset; + type Room = Unset; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; + type Room = S::Room; + } + ///State transition - sets the `room` field to Set + pub struct SetRoom<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRoom<S> {} + impl<S: State> State for SetRoom<S> { + type CreatedAt = S::CreatedAt; + type Room = Set<members::room>; + } + /// Marker types for field names + #[allow(non_camel_case_types)] + pub mod members { + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `room` field + pub struct room(()); + } +} + +/// Builder for constructing an instance of this type +pub struct RoomGateBuilder<'a, S: room_gate_state::State> { + _phantom_state: ::core::marker::PhantomData<fn() -> S>, + __unsafe_private_named: ( + ::core::option::Option<jacquard_common::types::string::Datetime>, + ::core::option::Option<bool>, + ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ), + _phantom: ::core::marker::PhantomData<&'a ()>, +} + +impl<'a> RoomGate<'a> { + /// Create a new builder for this type + pub fn new() -> RoomGateBuilder<'a, room_gate_state::Empty> { + RoomGateBuilder::new() + } +} + +impl<'a> RoomGateBuilder<'a, room_gate_state::Empty> { + /// Create a new builder with all fields unset + pub fn new() -> Self { + RoomGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: (None, None, None), + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RoomGateBuilder<'a, S> +where + S: room_gate_state::State, + S::CreatedAt: room_gate_state::IsUnset, +{ + /// Set the `createdAt` field (required) + pub fn created_at( + mut self, + value: impl Into<jacquard_common::types::string::Datetime>, + ) -> RoomGateBuilder<'a, room_gate_state::SetCreatedAt<S>> { + self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); + RoomGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S: room_gate_state::State> RoomGateBuilder<'a, S> { + /// Set the `isClosed` field (optional) + pub fn is_closed(mut self, value: impl Into<Option<bool>>) -> Self { + self.__unsafe_private_named.1 = value.into(); + self + } + /// Set the `isClosed` field to an Option value (optional) + pub fn maybe_is_closed(mut self, value: Option<bool>) -> Self { + self.__unsafe_private_named.1 = value; + self + } +} + +impl<'a, S> RoomGateBuilder<'a, S> +where + S: room_gate_state::State, + S::Room: room_gate_state::IsUnset, +{ + /// Set the `room` field (required) + pub fn room( + mut self, + value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, + ) -> RoomGateBuilder<'a, room_gate_state::SetRoom<S>> { + self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); + RoomGateBuilder { + _phantom_state: ::core::marker::PhantomData, + __unsafe_private_named: self.__unsafe_private_named, + _phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, S> RoomGateBuilder<'a, S> +where + S: room_gate_state::State, + S::CreatedAt: room_gate_state::IsSet, + S::Room: room_gate_state::IsSet, +{ + /// Build the final struct + pub fn build(self) -> RoomGate<'a> { + RoomGate { + created_at: self.__unsafe_private_named.0.unwrap(), + is_closed: self.__unsafe_private_named.1, + room: self.__unsafe_private_named.2.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data + pub fn build_with_data( + self, + extra_data: std::collections::BTreeMap< + jacquard_common::smol_str::SmolStr, + jacquard_common::types::value::Data<'a>, + >, + ) -> RoomGate<'a> { + RoomGate { + created_at: self.__unsafe_private_named.0.unwrap(), + is_closed: self.__unsafe_private_named.1, + room: self.__unsafe_private_named.2.unwrap(), + extra_data: Some(extra_data), + } + } +} + +impl<'a> RoomGate<'a> { + pub fn uri( + uri: impl Into<jacquard_common::CowStr<'a>>, + ) -> Result< + jacquard_common::types::uri::RecordUri<'a, RoomGateRecord>, + jacquard_common::types::uri::UriError, + > { + jacquard_common::types::uri::RecordUri::try_from_uri( + jacquard_common::types::string::AtUri::new_cow(uri.into())?, + ) + } +} + +/// Typed wrapper for GetRecord response with this collection's record type. +#[derive( + serde::Serialize, + serde::Deserialize, + Debug, + Clone, + PartialEq, + Eq, + jacquard_derive::IntoStatic +)] +#[serde(rename_all = "camelCase")] +pub struct RoomGateGetRecordOutput<'a> { + #[serde(skip_serializing_if = "std::option::Option::is_none")] + #[serde(borrow)] + pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, + #[serde(borrow)] + pub uri: jacquard_common::types::string::AtUri<'a>, + #[serde(borrow)] + pub value: RoomGate<'a>, +} + +impl From<RoomGateGetRecordOutput<'_>> for RoomGate<'_> { + fn from(output: RoomGateGetRecordOutput<'_>) -> Self { + use jacquard_common::IntoStatic; + output.value.into_static() + } +} + +impl jacquard_common::types::collection::Collection for RoomGate<'_> { + const NSID: &'static str = "tech.tokimeki.kaku.roomGate"; + type Record = RoomGateRecord; +} + +/// Marker type for deserializing records from this collection. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct RoomGateRecord; +impl jacquard_common::xrpc::XrpcResp for RoomGateRecord { + const NSID: &'static str = "tech.tokimeki.kaku.roomGate"; + const ENCODING: &'static str = "application/json"; + type Output<'de> = RoomGateGetRecordOutput<'de>; + type Err<'de> = jacquard_common::types::collection::RecordError<'de>; +} + +impl jacquard_common::types::collection::Collection for RoomGateRecord { + const NSID: &'static str = "tech.tokimeki.kaku.roomGate"; + type Record = RoomGateRecord; +} + +impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RoomGate<'a> { + fn nsid() -> &'static str { + "tech.tokimeki.kaku.roomGate" + } + fn def_name() -> &'static str { + "main" + } + fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { + lexicon_doc_tech_tokimeki_kaku_roomGate() + } + fn validate( + &self, + ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { + Ok(()) + } +} + +fn lexicon_doc_tech_tokimeki_kaku_roomGate() -> ::jacquard_lexicon::lexicon::LexiconDoc< + 'static, +> { + ::jacquard_lexicon::lexicon::LexiconDoc { + lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, + id: ::jacquard_common::CowStr::new_static("tech.tokimeki.kaku.roomGate"), + revision: None, + description: None, + defs: { + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("main"), + ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { + description: Some( + ::jacquard_common::CowStr::new_static( + "Gate settings for a ROOM post (like threadgate)", + ), + ), + key: Some(::jacquard_common::CowStr::new_static("tid")), + record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { + description: None, + required: Some( + vec![ + ::jacquard_common::smol_str::SmolStr::new_static("room"), + ::jacquard_common::smol_str::SmolStr::new_static("createdAt") + ], + ), + nullable: None, + properties: { + #[allow(unused_mut)] + let mut map = ::alloc::collections::BTreeMap::new(); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "createdAt", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { + description: Some( + ::jacquard_common::CowStr::new_static( + "Timestamp when the gate was created", + ), + ), + format: Some( + ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, + ), + default: None, + min_length: None, + max_length: None, + min_graphemes: None, + max_graphemes: None, + r#enum: None, + r#const: None, + known_values: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static( + "isClosed", + ), + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { + description: None, + default: None, + r#const: None, + }), + ); + map.insert( + ::jacquard_common::smol_str::SmolStr::new_static("room"), + ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { + description: None, + r#ref: ::jacquard_common::CowStr::new_static( + "com.atproto.repo.strongRef", + ), + }), + ); + map + }, + }), + }), + ); + map + }, + } +} \ No newline at end of file diff --git a/crates/jacquard-api/src/tech_tokimeki/poll/poll.rs b/crates/jacquard-api/src/tech_tokimeki/poll/poll.rs index bf6958cb..6688dc02 100644 --- a/crates/jacquard-api/src/tech_tokimeki/poll/poll.rs +++ b/crates/jacquard-api/src/tech_tokimeki/poll/poll.rs @@ -42,51 +42,51 @@ pub mod poll_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type EndsAt; type Options; type CreatedAt; + type EndsAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type EndsAt = Unset; type Options = Unset; type CreatedAt = Unset; - } - ///State transition - sets the `ends_at` field to Set - pub struct SetEndsAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEndsAt<S> {} - impl<S: State> State for SetEndsAt<S> { - type EndsAt = Set<members::ends_at>; - type Options = S::Options; - type CreatedAt = S::CreatedAt; + type EndsAt = Unset; } ///State transition - sets the `options` field to Set pub struct SetOptions<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetOptions<S> {} impl<S: State> State for SetOptions<S> { - type EndsAt = S::EndsAt; type Options = Set<members::options>; type CreatedAt = S::CreatedAt; + type EndsAt = S::EndsAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type EndsAt = S::EndsAt; type Options = S::Options; type CreatedAt = Set<members::created_at>; + type EndsAt = S::EndsAt; + } + ///State transition - sets the `ends_at` field to Set + pub struct SetEndsAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEndsAt<S> {} + impl<S: State> State for SetEndsAt<S> { + type Options = S::Options; + type CreatedAt = S::CreatedAt; + type EndsAt = Set<members::ends_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `ends_at` field - pub struct ends_at(()); ///Marker type for the `options` field pub struct options(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `ends_at` field + pub struct ends_at(()); } } @@ -199,9 +199,9 @@ impl<'a, S: poll_state::State> PollBuilder<'a, S> { impl<'a, S> PollBuilder<'a, S> where S: poll_state::State, - S::EndsAt: poll_state::IsSet, S::Options: poll_state::IsSet, S::CreatedAt: poll_state::IsSet, + S::EndsAt: poll_state::IsSet, { /// Build the final struct pub fn build(self) -> Poll<'a> { diff --git a/crates/jacquard-api/src/tech_tokimeki/poll/vote.rs b/crates/jacquard-api/src/tech_tokimeki/poll/vote.rs index 4e200d28..ab251aee 100644 --- a/crates/jacquard-api/src/tech_tokimeki/poll/vote.rs +++ b/crates/jacquard-api/src/tech_tokimeki/poll/vote.rs @@ -36,51 +36,51 @@ pub mod vote_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type OptionIndex; type CreatedAt; type Poll; - type OptionIndex; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type OptionIndex = Unset; type CreatedAt = Unset; type Poll = Unset; - type OptionIndex = Unset; + } + ///State transition - sets the `option_index` field to Set + pub struct SetOptionIndex<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetOptionIndex<S> {} + impl<S: State> State for SetOptionIndex<S> { + type OptionIndex = Set<members::option_index>; + type CreatedAt = S::CreatedAt; + type Poll = S::Poll; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type OptionIndex = S::OptionIndex; type CreatedAt = Set<members::created_at>; type Poll = S::Poll; - type OptionIndex = S::OptionIndex; } ///State transition - sets the `poll` field to Set pub struct SetPoll<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPoll<S> {} impl<S: State> State for SetPoll<S> { - type CreatedAt = S::CreatedAt; - type Poll = Set<members::poll>; type OptionIndex = S::OptionIndex; - } - ///State transition - sets the `option_index` field to Set - pub struct SetOptionIndex<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetOptionIndex<S> {} - impl<S: State> State for SetOptionIndex<S> { type CreatedAt = S::CreatedAt; - type Poll = S::Poll; - type OptionIndex = Set<members::option_index>; + type Poll = Set<members::poll>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `option_index` field + pub struct option_index(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `poll` field pub struct poll(()); - ///Marker type for the `option_index` field - pub struct option_index(()); } } @@ -173,9 +173,9 @@ where impl<'a, S> VoteBuilder<'a, S> where S: vote_state::State, + S::OptionIndex: vote_state::IsSet, S::CreatedAt: vote_state::IsSet, S::Poll: vote_state::IsSet, - S::OptionIndex: vote_state::IsSet, { /// Build the final struct pub fn build(self) -> Vote<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/communication.rs b/crates/jacquard-api/src/tools_ozone/communication.rs index 36f7c1d5..76490534 100644 --- a/crates/jacquard-api/src/tools_ozone/communication.rs +++ b/crates/jacquard-api/src/tools_ozone/communication.rs @@ -55,127 +55,127 @@ pub mod template_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type LastUpdatedBy; - type CreatedAt; - type ContentMarkdown; - type UpdatedAt; type Name; type Disabled; + type LastUpdatedBy; + type UpdatedAt; type Id; + type ContentMarkdown; + type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type LastUpdatedBy = Unset; - type CreatedAt = Unset; - type ContentMarkdown = Unset; - type UpdatedAt = Unset; type Name = Unset; type Disabled = Unset; + type LastUpdatedBy = Unset; + type UpdatedAt = Unset; type Id = Unset; + type ContentMarkdown = Unset; + type CreatedAt = Unset; } - ///State transition - sets the `last_updated_by` field to Set - pub struct SetLastUpdatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLastUpdatedBy<S> {} - impl<S: State> State for SetLastUpdatedBy<S> { - type LastUpdatedBy = Set<members::last_updated_by>; - type CreatedAt = S::CreatedAt; - type ContentMarkdown = S::ContentMarkdown; - type UpdatedAt = S::UpdatedAt; - type Name = S::Name; + ///State transition - sets the `name` field to Set + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetName<S> {} + impl<S: State> State for SetName<S> { + type Name = Set<members::name>; type Disabled = S::Disabled; - type Id = S::Id; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = Set<members::created_at>; - type ContentMarkdown = S::ContentMarkdown; type UpdatedAt = S::UpdatedAt; - type Name = S::Name; - type Disabled = S::Disabled; type Id = S::Id; + type ContentMarkdown = S::ContentMarkdown; + type CreatedAt = S::CreatedAt; } - ///State transition - sets the `content_markdown` field to Set - pub struct SetContentMarkdown<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContentMarkdown<S> {} - impl<S: State> State for SetContentMarkdown<S> { + ///State transition - sets the `disabled` field to Set + pub struct SetDisabled<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisabled<S> {} + impl<S: State> State for SetDisabled<S> { + type Name = S::Name; + type Disabled = Set<members::disabled>; type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = S::CreatedAt; - type ContentMarkdown = Set<members::content_markdown>; type UpdatedAt = S::UpdatedAt; + type Id = S::Id; + type ContentMarkdown = S::ContentMarkdown; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `last_updated_by` field to Set + pub struct SetLastUpdatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLastUpdatedBy<S> {} + impl<S: State> State for SetLastUpdatedBy<S> { type Name = S::Name; type Disabled = S::Disabled; + type LastUpdatedBy = Set<members::last_updated_by>; + type UpdatedAt = S::UpdatedAt; type Id = S::Id; + type ContentMarkdown = S::ContentMarkdown; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `updated_at` field to Set pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} impl<S: State> State for SetUpdatedAt<S> { - type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = S::CreatedAt; - type ContentMarkdown = S::ContentMarkdown; - type UpdatedAt = Set<members::updated_at>; type Name = S::Name; type Disabled = S::Disabled; - type Id = S::Id; - } - ///State transition - sets the `name` field to Set - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetName<S> {} - impl<S: State> State for SetName<S> { type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = S::CreatedAt; - type ContentMarkdown = S::ContentMarkdown; - type UpdatedAt = S::UpdatedAt; - type Name = Set<members::name>; - type Disabled = S::Disabled; + type UpdatedAt = Set<members::updated_at>; type Id = S::Id; - } - ///State transition - sets the `disabled` field to Set - pub struct SetDisabled<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisabled<S> {} - impl<S: State> State for SetDisabled<S> { - type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = S::CreatedAt; type ContentMarkdown = S::ContentMarkdown; - type UpdatedAt = S::UpdatedAt; - type Name = S::Name; - type Disabled = Set<members::disabled>; - type Id = S::Id; + type CreatedAt = S::CreatedAt; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { + type Name = S::Name; + type Disabled = S::Disabled; type LastUpdatedBy = S::LastUpdatedBy; - type CreatedAt = S::CreatedAt; + type UpdatedAt = S::UpdatedAt; + type Id = Set<members::id>; type ContentMarkdown = S::ContentMarkdown; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `content_markdown` field to Set + pub struct SetContentMarkdown<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContentMarkdown<S> {} + impl<S: State> State for SetContentMarkdown<S> { + type Name = S::Name; + type Disabled = S::Disabled; + type LastUpdatedBy = S::LastUpdatedBy; type UpdatedAt = S::UpdatedAt; + type Id = S::Id; + type ContentMarkdown = Set<members::content_markdown>; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Name = S::Name; type Disabled = S::Disabled; - type Id = Set<members::id>; + type LastUpdatedBy = S::LastUpdatedBy; + type UpdatedAt = S::UpdatedAt; + type Id = S::Id; + type ContentMarkdown = S::ContentMarkdown; + type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `last_updated_by` field - pub struct last_updated_by(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `content_markdown` field - pub struct content_markdown(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `disabled` field pub struct disabled(()); + ///Marker type for the `last_updated_by` field + pub struct last_updated_by(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); ///Marker type for the `id` field pub struct id(()); + ///Marker type for the `content_markdown` field + pub struct content_markdown(()); + ///Marker type for the `created_at` field + pub struct created_at(()); } } @@ -395,13 +395,13 @@ where impl<'a, S> TemplateViewBuilder<'a, S> where S: template_view_state::State, - S::LastUpdatedBy: template_view_state::IsSet, - S::CreatedAt: template_view_state::IsSet, - S::ContentMarkdown: template_view_state::IsSet, - S::UpdatedAt: template_view_state::IsSet, S::Name: template_view_state::IsSet, S::Disabled: template_view_state::IsSet, + S::LastUpdatedBy: template_view_state::IsSet, + S::UpdatedAt: template_view_state::IsSet, S::Id: template_view_state::IsSet, + S::ContentMarkdown: template_view_state::IsSet, + S::CreatedAt: template_view_state::IsSet, { /// Build the final struct pub fn build(self) -> TemplateView<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/hosting/get_account_history.rs b/crates/jacquard-api/src/tools_ozone/hosting/get_account_history.rs index 0ea33ef0..6c44b403 100644 --- a/crates/jacquard-api/src/tools_ozone/hosting/get_account_history.rs +++ b/crates/jacquard-api/src/tools_ozone/hosting/get_account_history.rs @@ -462,51 +462,51 @@ pub mod event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Details; - type CreatedBy; type CreatedAt; + type CreatedBy; + type Details; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Details = Unset; - type CreatedBy = Unset; type CreatedAt = Unset; + type CreatedBy = Unset; + type Details = Unset; } - ///State transition - sets the `details` field to Set - pub struct SetDetails<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDetails<S> {} - impl<S: State> State for SetDetails<S> { - type Details = Set<members::details>; + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; + type Details = S::Details; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { - type Details = S::Details; - type CreatedBy = Set<members::created_by>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + type CreatedBy = Set<members::created_by>; type Details = S::Details; + } + ///State transition - sets the `details` field to Set + pub struct SetDetails<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDetails<S> {} + impl<S: State> State for SetDetails<S> { + type CreatedAt = S::CreatedAt; type CreatedBy = S::CreatedBy; - type CreatedAt = Set<members::created_at>; + type Details = Set<members::details>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `details` field - pub struct details(()); - ///Marker type for the `created_by` field - pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `created_by` field + pub struct created_by(()); + ///Marker type for the `details` field + pub struct details(()); } } @@ -599,9 +599,9 @@ where impl<'a, S> EventBuilder<'a, S> where S: event_state::State, - S::Details: event_state::IsSet, - S::CreatedBy: event_state::IsSet, S::CreatedAt: event_state::IsSet, + S::CreatedBy: event_state::IsSet, + S::Details: event_state::IsSet, { /// Build the final struct pub fn build(self) -> Event<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/moderation.rs b/crates/jacquard-api/src/tools_ozone/moderation.rs index a3f40e3b..4f7b537c 100644 --- a/crates/jacquard-api/src/tools_ozone/moderation.rs +++ b/crates/jacquard-api/src/tools_ozone/moderation.rs @@ -55,37 +55,37 @@ pub mod account_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Timestamp; type Active; + type Timestamp; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Timestamp = Unset; type Active = Unset; - } - ///State transition - sets the `timestamp` field to Set - pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTimestamp<S> {} - impl<S: State> State for SetTimestamp<S> { - type Timestamp = Set<members::timestamp>; - type Active = S::Active; + type Timestamp = Unset; } ///State transition - sets the `active` field to Set pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetActive<S> {} impl<S: State> State for SetActive<S> { - type Timestamp = S::Timestamp; type Active = Set<members::active>; + type Timestamp = S::Timestamp; + } + ///State transition - sets the `timestamp` field to Set + pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTimestamp<S> {} + impl<S: State> State for SetTimestamp<S> { + type Active = S::Active; + type Timestamp = Set<members::timestamp>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `timestamp` field - pub struct timestamp(()); ///Marker type for the `active` field pub struct active(()); + ///Marker type for the `timestamp` field + pub struct timestamp(()); } } @@ -189,8 +189,8 @@ where impl<'a, S> AccountEventBuilder<'a, S> where S: account_event_state::State, - S::Timestamp: account_event_state::IsSet, S::Active: account_event_state::IsSet, + S::Timestamp: account_event_state::IsSet, { /// Build the final struct pub fn build(self) -> AccountEvent<'a> { @@ -5307,51 +5307,51 @@ pub mod age_assurance_event_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Status; - type AttemptId; type CreatedAt; + type AttemptId; + type Status; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Status = Unset; - type AttemptId = Unset; type CreatedAt = Unset; + type AttemptId = Unset; + type Status = Unset; } - ///State transition - sets the `status` field to Set - pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetStatus<S> {} - impl<S: State> State for SetStatus<S> { - type Status = Set<members::status>; + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedAt = Set<members::created_at>; type AttemptId = S::AttemptId; - type CreatedAt = S::CreatedAt; + type Status = S::Status; } ///State transition - sets the `attempt_id` field to Set pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAttemptId<S> {} impl<S: State> State for SetAttemptId<S> { - type Status = S::Status; - type AttemptId = Set<members::attempt_id>; type CreatedAt = S::CreatedAt; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + type AttemptId = Set<members::attempt_id>; type Status = S::Status; + } + ///State transition - sets the `status` field to Set + pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetStatus<S> {} + impl<S: State> State for SetStatus<S> { + type CreatedAt = S::CreatedAt; type AttemptId = S::AttemptId; - type CreatedAt = Set<members::created_at>; + type Status = Set<members::status>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `status` field - pub struct status(()); - ///Marker type for the `attempt_id` field - pub struct attempt_id(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `attempt_id` field + pub struct attempt_id(()); + ///Marker type for the `status` field + pub struct status(()); } } @@ -5589,9 +5589,9 @@ where impl<'a, S> AgeAssuranceEventBuilder<'a, S> where S: age_assurance_event_state::State, - S::Status: age_assurance_event_state::IsSet, - S::AttemptId: age_assurance_event_state::IsSet, S::CreatedAt: age_assurance_event_state::IsSet, + S::AttemptId: age_assurance_event_state::IsSet, + S::Status: age_assurance_event_state::IsSet, { /// Build the final struct pub fn build(self) -> AgeAssuranceEvent<'a> { @@ -5940,66 +5940,66 @@ pub mod blob_view_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; - type Size; - type MimeType; type CreatedAt; + type MimeType; + type Size; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; - type Size = Unset; - type MimeType = Unset; type CreatedAt = Unset; + type MimeType = Unset; + type Size = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Cid = Set<members::cid>; - type Size = S::Size; - type MimeType = S::MimeType; type CreatedAt = S::CreatedAt; + type MimeType = S::MimeType; + type Size = S::Size; } - ///State transition - sets the `size` field to Set - pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSize<S> {} - impl<S: State> State for SetSize<S> { + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type Cid = S::Cid; - type Size = Set<members::size>; + type CreatedAt = Set<members::created_at>; type MimeType = S::MimeType; - type CreatedAt = S::CreatedAt; + type Size = S::Size; } ///State transition - sets the `mime_type` field to Set pub struct SetMimeType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetMimeType<S> {} impl<S: State> State for SetMimeType<S> { type Cid = S::Cid; - type Size = S::Size; - type MimeType = Set<members::mime_type>; type CreatedAt = S::CreatedAt; + type MimeType = Set<members::mime_type>; + type Size = S::Size; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { + ///State transition - sets the `size` field to Set + pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSize<S> {} + impl<S: State> State for SetSize<S> { type Cid = S::Cid; - type Size = S::Size; + type CreatedAt = S::CreatedAt; type MimeType = S::MimeType; - type CreatedAt = Set<members::created_at>; + type Size = Set<members::size>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `cid` field pub struct cid(()); - ///Marker type for the `size` field - pub struct size(()); - ///Marker type for the `mime_type` field - pub struct mime_type(()); ///Marker type for the `created_at` field pub struct created_at(()); + ///Marker type for the `mime_type` field + pub struct mime_type(()); + ///Marker type for the `size` field + pub struct size(()); } } @@ -6147,9 +6147,9 @@ impl<'a, S> BlobViewBuilder<'a, S> where S: blob_view_state::State, S::Cid: blob_view_state::IsSet, - S::Size: blob_view_state::IsSet, - S::MimeType: blob_view_state::IsSet, S::CreatedAt: blob_view_state::IsSet, + S::MimeType: blob_view_state::IsSet, + S::Size: blob_view_state::IsSet, { /// Build the final struct pub fn build(self) -> BlobView<'a> { @@ -6909,37 +6909,37 @@ pub mod mod_event_label_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreateLabelVals; type NegateLabelVals; + type CreateLabelVals; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreateLabelVals = Unset; type NegateLabelVals = Unset; - } - ///State transition - sets the `create_label_vals` field to Set - pub struct SetCreateLabelVals<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreateLabelVals<S> {} - impl<S: State> State for SetCreateLabelVals<S> { - type CreateLabelVals = Set<members::create_label_vals>; - type NegateLabelVals = S::NegateLabelVals; + type CreateLabelVals = Unset; } ///State transition - sets the `negate_label_vals` field to Set pub struct SetNegateLabelVals<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNegateLabelVals<S> {} impl<S: State> State for SetNegateLabelVals<S> { - type CreateLabelVals = S::CreateLabelVals; type NegateLabelVals = Set<members::negate_label_vals>; + type CreateLabelVals = S::CreateLabelVals; + } + ///State transition - sets the `create_label_vals` field to Set + pub struct SetCreateLabelVals<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreateLabelVals<S> {} + impl<S: State> State for SetCreateLabelVals<S> { + type NegateLabelVals = S::NegateLabelVals; + type CreateLabelVals = Set<members::create_label_vals>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `create_label_vals` field - pub struct create_label_vals(()); ///Marker type for the `negate_label_vals` field pub struct negate_label_vals(()); + ///Marker type for the `create_label_vals` field + pub struct create_label_vals(()); } } @@ -7043,8 +7043,8 @@ where impl<'a, S> ModEventLabelBuilder<'a, S> where S: mod_event_label_state::State, - S::CreateLabelVals: mod_event_label_state::IsSet, S::NegateLabelVals: mod_event_label_state::IsSet, + S::CreateLabelVals: mod_event_label_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventLabel<'a> { @@ -7790,37 +7790,37 @@ pub mod mod_event_tag_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Add; type Remove; + type Add; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Add = Unset; type Remove = Unset; - } - ///State transition - sets the `add` field to Set - pub struct SetAdd<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAdd<S> {} - impl<S: State> State for SetAdd<S> { - type Add = Set<members::add>; - type Remove = S::Remove; + type Add = Unset; } ///State transition - sets the `remove` field to Set pub struct SetRemove<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRemove<S> {} impl<S: State> State for SetRemove<S> { - type Add = S::Add; type Remove = Set<members::remove>; + type Add = S::Add; + } + ///State transition - sets the `add` field to Set + pub struct SetAdd<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAdd<S> {} + impl<S: State> State for SetAdd<S> { + type Remove = S::Remove; + type Add = Set<members::add>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `add` field - pub struct add(()); ///Marker type for the `remove` field pub struct remove(()); + ///Marker type for the `add` field + pub struct add(()); } } @@ -7910,8 +7910,8 @@ where impl<'a, S> ModEventTagBuilder<'a, S> where S: mod_event_tag_state::State, - S::Add: mod_event_tag_state::IsSet, S::Remove: mod_event_tag_state::IsSet, + S::Add: mod_event_tag_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventTag<'a> { @@ -8145,105 +8145,105 @@ pub mod mod_event_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Event; type CreatedBy; type CreatedAt; - type Event; - type Subject; type Id; type SubjectBlobCids; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type Event = Unset; type CreatedBy = Unset; type CreatedAt = Unset; - type Event = Unset; - type Subject = Unset; type Id = Unset; type SubjectBlobCids = Unset; + type Subject = Unset; + } + ///State transition - sets the `event` field to Set + pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEvent<S> {} + impl<S: State> State for SetEvent<S> { + type Event = Set<members::event>; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Id = S::Id; + type SubjectBlobCids = S::SubjectBlobCids; + type Subject = S::Subject; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { + type Event = S::Event; type CreatedBy = Set<members::created_by>; type CreatedAt = S::CreatedAt; - type Event = S::Event; - type Subject = S::Subject; type Id = S::Id; type SubjectBlobCids = S::SubjectBlobCids; + type Subject = S::Subject; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { + type Event = S::Event; type CreatedBy = S::CreatedBy; type CreatedAt = Set<members::created_at>; - type Event = S::Event; - type Subject = S::Subject; type Id = S::Id; type SubjectBlobCids = S::SubjectBlobCids; - } - ///State transition - sets the `event` field to Set - pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEvent<S> {} - impl<S: State> State for SetEvent<S> { - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Event = Set<members::event>; type Subject = S::Subject; - type Id = S::Id; - type SubjectBlobCids = S::SubjectBlobCids; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type Event = S::Event; - type Subject = Set<members::subject>; - type Id = S::Id; - type SubjectBlobCids = S::SubjectBlobCids; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { + type Event = S::Event; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Event = S::Event; - type Subject = S::Subject; type Id = Set<members::id>; type SubjectBlobCids = S::SubjectBlobCids; + type Subject = S::Subject; } ///State transition - sets the `subject_blob_cids` field to Set pub struct SetSubjectBlobCids<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubjectBlobCids<S> {} impl<S: State> State for SetSubjectBlobCids<S> { + type Event = S::Event; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Event = S::Event; - type Subject = S::Subject; type Id = S::Id; type SubjectBlobCids = Set<members::subject_blob_cids>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Event = S::Event; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Id = S::Id; + type SubjectBlobCids = S::SubjectBlobCids; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `event` field + pub struct event(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `event` field - pub struct event(()); - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `subject_blob_cids` field pub struct subject_blob_cids(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -8466,12 +8466,12 @@ impl<'a, S: mod_event_view_state::State> ModEventViewBuilder<'a, S> { impl<'a, S> ModEventViewBuilder<'a, S> where S: mod_event_view_state::State, + S::Event: mod_event_view_state::IsSet, S::CreatedBy: mod_event_view_state::IsSet, S::CreatedAt: mod_event_view_state::IsSet, - S::Event: mod_event_view_state::IsSet, - S::Subject: mod_event_view_state::IsSet, S::Id: mod_event_view_state::IsSet, S::SubjectBlobCids: mod_event_view_state::IsSet, + S::Subject: mod_event_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventView<'a> { @@ -8666,104 +8666,104 @@ pub mod mod_event_view_detail_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type SubjectBlobs; - type CreatedAt; - type Event; + type CreatedBy; type Id; type Subject; - type CreatedBy; + type CreatedAt; + type Event; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type SubjectBlobs = Unset; - type CreatedAt = Unset; - type Event = Unset; + type CreatedBy = Unset; type Id = Unset; type Subject = Unset; - type CreatedBy = Unset; + type CreatedAt = Unset; + type Event = Unset; } ///State transition - sets the `subject_blobs` field to Set pub struct SetSubjectBlobs<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubjectBlobs<S> {} impl<S: State> State for SetSubjectBlobs<S> { type SubjectBlobs = Set<members::subject_blobs>; - type CreatedAt = S::CreatedAt; - type Event = S::Event; - type Id = S::Id; - type Subject = S::Subject; type CreatedBy = S::CreatedBy; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type SubjectBlobs = S::SubjectBlobs; - type CreatedAt = Set<members::created_at>; - type Event = S::Event; type Id = S::Id; type Subject = S::Subject; - type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Event = S::Event; } - ///State transition - sets the `event` field to Set - pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEvent<S> {} - impl<S: State> State for SetEvent<S> { + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedBy<S> {} + impl<S: State> State for SetCreatedBy<S> { type SubjectBlobs = S::SubjectBlobs; - type CreatedAt = S::CreatedAt; - type Event = Set<members::event>; + type CreatedBy = Set<members::created_by>; type Id = S::Id; type Subject = S::Subject; - type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Event = S::Event; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { type SubjectBlobs = S::SubjectBlobs; - type CreatedAt = S::CreatedAt; - type Event = S::Event; + type CreatedBy = S::CreatedBy; type Id = Set<members::id>; type Subject = S::Subject; - type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Event = S::Event; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { type SubjectBlobs = S::SubjectBlobs; - type CreatedAt = S::CreatedAt; - type Event = S::Event; + type CreatedBy = S::CreatedBy; type Id = S::Id; type Subject = Set<members::subject>; - type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Event = S::Event; } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedBy<S> {} - impl<S: State> State for SetCreatedBy<S> { + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { type SubjectBlobs = S::SubjectBlobs; - type CreatedAt = S::CreatedAt; + type CreatedBy = S::CreatedBy; + type Id = S::Id; + type Subject = S::Subject; + type CreatedAt = Set<members::created_at>; type Event = S::Event; + } + ///State transition - sets the `event` field to Set + pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEvent<S> {} + impl<S: State> State for SetEvent<S> { + type SubjectBlobs = S::SubjectBlobs; + type CreatedBy = S::CreatedBy; type Id = S::Id; type Subject = S::Subject; - type CreatedBy = Set<members::created_by>; + type CreatedAt = S::CreatedAt; + type Event = Set<members::event>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `subject_blobs` field pub struct subject_blobs(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `event` field - pub struct event(()); + ///Marker type for the `created_by` field + pub struct created_by(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `subject` field pub struct subject(()); - ///Marker type for the `created_by` field - pub struct created_by(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `event` field + pub struct event(()); } } @@ -8937,11 +8937,11 @@ impl<'a, S> ModEventViewDetailBuilder<'a, S> where S: mod_event_view_detail_state::State, S::SubjectBlobs: mod_event_view_detail_state::IsSet, - S::CreatedAt: mod_event_view_detail_state::IsSet, - S::Event: mod_event_view_detail_state::IsSet, + S::CreatedBy: mod_event_view_detail_state::IsSet, S::Id: mod_event_view_detail_state::IsSet, S::Subject: mod_event_view_detail_state::IsSet, - S::CreatedBy: mod_event_view_detail_state::IsSet, + S::CreatedAt: mod_event_view_detail_state::IsSet, + S::Event: mod_event_view_detail_state::IsSet, { /// Build the final struct pub fn build(self) -> ModEventViewDetail<'a> { @@ -9690,127 +9690,127 @@ pub mod record_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Cid; type Repo; - type IndexedAt; - type BlobCids; + type Uri; type Moderation; + type BlobCids; + type Cid; type Value; - type Uri; + type IndexedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Cid = Unset; type Repo = Unset; - type IndexedAt = Unset; - type BlobCids = Unset; + type Uri = Unset; type Moderation = Unset; + type BlobCids = Unset; + type Cid = Unset; type Value = Unset; - type Uri = Unset; - } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { - type Cid = Set<members::cid>; - type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type BlobCids = S::BlobCids; - type Moderation = S::Moderation; - type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = Unset; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { - type Cid = S::Cid; type Repo = Set<members::repo>; - type IndexedAt = S::IndexedAt; - type BlobCids = S::BlobCids; + type Uri = S::Uri; type Moderation = S::Moderation; + type BlobCids = S::BlobCids; + type Cid = S::Cid; type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { - type Cid = S::Cid; + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type Repo = S::Repo; - type IndexedAt = Set<members::indexed_at>; - type BlobCids = S::BlobCids; + type Uri = Set<members::uri>; type Moderation = S::Moderation; + type BlobCids = S::BlobCids; + type Cid = S::Cid; type Value = S::Value; + type IndexedAt = S::IndexedAt; + } + ///State transition - sets the `moderation` field to Set + pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetModeration<S> {} + impl<S: State> State for SetModeration<S> { + type Repo = S::Repo; type Uri = S::Uri; + type Moderation = Set<members::moderation>; + type BlobCids = S::BlobCids; + type Cid = S::Cid; + type Value = S::Value; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `blob_cids` field to Set pub struct SetBlobCids<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBlobCids<S> {} impl<S: State> State for SetBlobCids<S> { - type Cid = S::Cid; type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type BlobCids = Set<members::blob_cids>; + type Uri = S::Uri; type Moderation = S::Moderation; + type BlobCids = Set<members::blob_cids>; + type Cid = S::Cid; type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `moderation` field to Set - pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetModeration<S> {} - impl<S: State> State for SetModeration<S> { - type Cid = S::Cid; + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Repo = S::Repo; - type IndexedAt = S::IndexedAt; + type Uri = S::Uri; + type Moderation = S::Moderation; type BlobCids = S::BlobCids; - type Moderation = Set<members::moderation>; + type Cid = Set<members::cid>; type Value = S::Value; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Cid = S::Cid; type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type BlobCids = S::BlobCids; + type Uri = S::Uri; type Moderation = S::Moderation; + type BlobCids = S::BlobCids; + type Cid = S::Cid; type Value = Set<members::value>; - type Uri = S::Uri; + type IndexedAt = S::IndexedAt; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type Cid = S::Cid; + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { type Repo = S::Repo; - type IndexedAt = S::IndexedAt; - type BlobCids = S::BlobCids; + type Uri = S::Uri; type Moderation = S::Moderation; + type BlobCids = S::BlobCids; + type Cid = S::Cid; type Value = S::Value; - type Uri = Set<members::uri>; + type IndexedAt = Set<members::indexed_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `cid` field - pub struct cid(()); ///Marker type for the `repo` field pub struct repo(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); - ///Marker type for the `blob_cids` field - pub struct blob_cids(()); + ///Marker type for the `uri` field + pub struct uri(()); ///Marker type for the `moderation` field pub struct moderation(()); + ///Marker type for the `blob_cids` field + pub struct blob_cids(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `uri` field - pub struct uri(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); } } @@ -9983,13 +9983,13 @@ where impl<'a, S> RecordViewBuilder<'a, S> where S: record_view_state::State, - S::Cid: record_view_state::IsSet, S::Repo: record_view_state::IsSet, - S::IndexedAt: record_view_state::IsSet, - S::BlobCids: record_view_state::IsSet, + S::Uri: record_view_state::IsSet, S::Moderation: record_view_state::IsSet, + S::BlobCids: record_view_state::IsSet, + S::Cid: record_view_state::IsSet, S::Value: record_view_state::IsSet, - S::Uri: record_view_state::IsSet, + S::IndexedAt: record_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RecordView<'a> { @@ -10083,11 +10083,11 @@ pub mod record_view_detail_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Value; - type Cid; + type Blobs; type IndexedAt; type Moderation; type Uri; - type Blobs; + type Cid; type Repo; } /// Empty state - all required fields are unset @@ -10095,11 +10095,11 @@ pub mod record_view_detail_state { impl sealed::Sealed for Empty {} impl State for Empty { type Value = Unset; - type Cid = Unset; + type Blobs = Unset; type IndexedAt = Unset; type Moderation = Unset; type Uri = Unset; - type Blobs = Unset; + type Cid = Unset; type Repo = Unset; } ///State transition - sets the `value` field to Set @@ -10107,23 +10107,23 @@ pub mod record_view_detail_state { impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { type Value = Set<members::value>; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = S::Repo; } - ///State transition - sets the `cid` field to Set - pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCid<S> {} - impl<S: State> State for SetCid<S> { + ///State transition - sets the `blobs` field to Set + pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetBlobs<S> {} + impl<S: State> State for SetBlobs<S> { type Value = S::Value; - type Cid = Set<members::cid>; + type Blobs = Set<members::blobs>; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = S::Repo; } ///State transition - sets the `indexed_at` field to Set @@ -10131,11 +10131,11 @@ pub mod record_view_detail_state { impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { type Value = S::Value; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = Set<members::indexed_at>; type Moderation = S::Moderation; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = S::Repo; } ///State transition - sets the `moderation` field to Set @@ -10143,11 +10143,11 @@ pub mod record_view_detail_state { impl<S: State> sealed::Sealed for SetModeration<S> {} impl<S: State> State for SetModeration<S> { type Value = S::Value; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = S::IndexedAt; type Moderation = Set<members::moderation>; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = S::Repo; } ///State transition - sets the `uri` field to Set @@ -10155,23 +10155,23 @@ pub mod record_view_detail_state { impl<S: State> sealed::Sealed for SetUri<S> {} impl<S: State> State for SetUri<S> { type Value = S::Value; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type Uri = Set<members::uri>; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = S::Repo; } - ///State transition - sets the `blobs` field to Set - pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetBlobs<S> {} - impl<S: State> State for SetBlobs<S> { + ///State transition - sets the `cid` field to Set + pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCid<S> {} + impl<S: State> State for SetCid<S> { type Value = S::Value; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type Uri = S::Uri; - type Blobs = Set<members::blobs>; + type Cid = Set<members::cid>; type Repo = S::Repo; } ///State transition - sets the `repo` field to Set @@ -10179,11 +10179,11 @@ pub mod record_view_detail_state { impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { type Value = S::Value; - type Cid = S::Cid; + type Blobs = S::Blobs; type IndexedAt = S::IndexedAt; type Moderation = S::Moderation; type Uri = S::Uri; - type Blobs = S::Blobs; + type Cid = S::Cid; type Repo = Set<members::repo>; } /// Marker types for field names @@ -10191,16 +10191,16 @@ pub mod record_view_detail_state { pub mod members { ///Marker type for the `value` field pub struct value(()); - ///Marker type for the `cid` field - pub struct cid(()); + ///Marker type for the `blobs` field + pub struct blobs(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `moderation` field pub struct moderation(()); ///Marker type for the `uri` field pub struct uri(()); - ///Marker type for the `blobs` field - pub struct blobs(()); + ///Marker type for the `cid` field + pub struct cid(()); ///Marker type for the `repo` field pub struct repo(()); } @@ -10396,11 +10396,11 @@ impl<'a, S> RecordViewDetailBuilder<'a, S> where S: record_view_detail_state::State, S::Value: record_view_detail_state::IsSet, - S::Cid: record_view_detail_state::IsSet, + S::Blobs: record_view_detail_state::IsSet, S::IndexedAt: record_view_detail_state::IsSet, S::Moderation: record_view_detail_state::IsSet, S::Uri: record_view_detail_state::IsSet, - S::Blobs: record_view_detail_state::IsSet, + S::Cid: record_view_detail_state::IsSet, S::Repo: record_view_detail_state::IsSet, { /// Build the final struct @@ -10704,9 +10704,9 @@ pub mod repo_view_state { pub trait State: sealed::Sealed { type RelatedRecords; type Moderation; - type Did; - type Handle; type IndexedAt; + type Handle; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -10714,9 +10714,9 @@ pub mod repo_view_state { impl State for Empty { type RelatedRecords = Unset; type Moderation = Unset; - type Did = Unset; - type Handle = Unset; type IndexedAt = Unset; + type Handle = Unset; + type Did = Unset; } ///State transition - sets the `related_records` field to Set pub struct SetRelatedRecords<S: State = Empty>(PhantomData<fn() -> S>); @@ -10724,9 +10724,9 @@ pub mod repo_view_state { impl<S: State> State for SetRelatedRecords<S> { type RelatedRecords = Set<members::related_records>; type Moderation = S::Moderation; - type Did = S::Did; - type Handle = S::Handle; type IndexedAt = S::IndexedAt; + type Handle = S::Handle; + type Did = S::Did; } ///State transition - sets the `moderation` field to Set pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); @@ -10734,19 +10734,19 @@ pub mod repo_view_state { impl<S: State> State for SetModeration<S> { type RelatedRecords = S::RelatedRecords; type Moderation = Set<members::moderation>; - type Did = S::Did; - type Handle = S::Handle; type IndexedAt = S::IndexedAt; + type Handle = S::Handle; + type Did = S::Did; } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetIndexedAt<S> {} + impl<S: State> State for SetIndexedAt<S> { type RelatedRecords = S::RelatedRecords; type Moderation = S::Moderation; - type Did = Set<members::did>; + type IndexedAt = Set<members::indexed_at>; type Handle = S::Handle; - type IndexedAt = S::IndexedAt; + type Did = S::Did; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); @@ -10754,19 +10754,19 @@ pub mod repo_view_state { impl<S: State> State for SetHandle<S> { type RelatedRecords = S::RelatedRecords; type Moderation = S::Moderation; - type Did = S::Did; - type Handle = Set<members::handle>; type IndexedAt = S::IndexedAt; + type Handle = Set<members::handle>; + type Did = S::Did; } - ///State transition - sets the `indexed_at` field to Set - pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetIndexedAt<S> {} - impl<S: State> State for SetIndexedAt<S> { + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { type RelatedRecords = S::RelatedRecords; type Moderation = S::Moderation; - type Did = S::Did; + type IndexedAt = S::IndexedAt; type Handle = S::Handle; - type IndexedAt = Set<members::indexed_at>; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -10775,12 +10775,12 @@ pub mod repo_view_state { pub struct related_records(()); ///Marker type for the `moderation` field pub struct moderation(()); - ///Marker type for the `did` field - pub struct did(()); - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `handle` field + pub struct handle(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -11038,9 +11038,9 @@ where S: repo_view_state::State, S::RelatedRecords: repo_view_state::IsSet, S::Moderation: repo_view_state::IsSet, - S::Did: repo_view_state::IsSet, - S::Handle: repo_view_state::IsSet, S::IndexedAt: repo_view_state::IsSet, + S::Handle: repo_view_state::IsSet, + S::Did: repo_view_state::IsSet, { /// Build the final struct pub fn build(self) -> RepoView<'a> { @@ -11162,85 +11162,85 @@ pub mod repo_view_detail_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type RelatedRecords; - type Handle; type Did; - type IndexedAt; type Moderation; + type IndexedAt; + type RelatedRecords; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type RelatedRecords = Unset; - type Handle = Unset; type Did = Unset; - type IndexedAt = Unset; type Moderation = Unset; - } - ///State transition - sets the `related_records` field to Set - pub struct SetRelatedRecords<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRelatedRecords<S> {} - impl<S: State> State for SetRelatedRecords<S> { - type RelatedRecords = Set<members::related_records>; - type Handle = S::Handle; - type Did = S::Did; - type IndexedAt = S::IndexedAt; - type Moderation = S::Moderation; - } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { - type RelatedRecords = S::RelatedRecords; - type Handle = Set<members::handle>; - type Did = S::Did; - type IndexedAt = S::IndexedAt; - type Moderation = S::Moderation; + type IndexedAt = Unset; + type RelatedRecords = Unset; + type Handle = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { + type Did = Set<members::did>; + type Moderation = S::Moderation; + type IndexedAt = S::IndexedAt; type RelatedRecords = S::RelatedRecords; type Handle = S::Handle; - type Did = Set<members::did>; + } + ///State transition - sets the `moderation` field to Set + pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetModeration<S> {} + impl<S: State> State for SetModeration<S> { + type Did = S::Did; + type Moderation = Set<members::moderation>; type IndexedAt = S::IndexedAt; - type Moderation = S::Moderation; + type RelatedRecords = S::RelatedRecords; + type Handle = S::Handle; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetIndexedAt<S> {} impl<S: State> State for SetIndexedAt<S> { + type Did = S::Did; + type Moderation = S::Moderation; + type IndexedAt = Set<members::indexed_at>; type RelatedRecords = S::RelatedRecords; type Handle = S::Handle; + } + ///State transition - sets the `related_records` field to Set + pub struct SetRelatedRecords<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRelatedRecords<S> {} + impl<S: State> State for SetRelatedRecords<S> { type Did = S::Did; - type IndexedAt = Set<members::indexed_at>; type Moderation = S::Moderation; - } - ///State transition - sets the `moderation` field to Set - pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetModeration<S> {} - impl<S: State> State for SetModeration<S> { - type RelatedRecords = S::RelatedRecords; + type IndexedAt = S::IndexedAt; + type RelatedRecords = Set<members::related_records>; type Handle = S::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { type Did = S::Did; + type Moderation = S::Moderation; type IndexedAt = S::IndexedAt; - type Moderation = Set<members::moderation>; + type RelatedRecords = S::RelatedRecords; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `related_records` field - pub struct related_records(()); - ///Marker type for the `handle` field - pub struct handle(()); ///Marker type for the `did` field pub struct did(()); - ///Marker type for the `indexed_at` field - pub struct indexed_at(()); ///Marker type for the `moderation` field pub struct moderation(()); + ///Marker type for the `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `related_records` field + pub struct related_records(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -11559,11 +11559,11 @@ impl<'a, S: repo_view_detail_state::State> RepoViewDetailBuilder<'a, S> { impl<'a, S> RepoViewDetailBuilder<'a, S> where S: repo_view_detail_state::State, - S::RelatedRecords: repo_view_detail_state::IsSet, - S::Handle: repo_view_detail_state::IsSet, S::Did: repo_view_detail_state::IsSet, - S::IndexedAt: repo_view_detail_state::IsSet, S::Moderation: repo_view_detail_state::IsSet, + S::IndexedAt: repo_view_detail_state::IsSet, + S::RelatedRecords: repo_view_detail_state::IsSet, + S::Handle: repo_view_detail_state::IsSet, { /// Build the final struct pub fn build(self) -> RepoViewDetail<'a> { @@ -11810,177 +11810,177 @@ pub mod reporter_stats_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type ReportedAccountCount; - type ReportedRecordCount; - type Did; type LabeledRecordCount; type TakendownAccountCount; - type AccountReportCount; - type LabeledAccountCount; + type ReportedAccountCount; type RecordReportCount; + type AccountReportCount; type TakendownRecordCount; + type ReportedRecordCount; + type LabeledAccountCount; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type ReportedAccountCount = Unset; - type ReportedRecordCount = Unset; - type Did = Unset; type LabeledRecordCount = Unset; type TakendownAccountCount = Unset; - type AccountReportCount = Unset; - type LabeledAccountCount = Unset; + type ReportedAccountCount = Unset; type RecordReportCount = Unset; + type AccountReportCount = Unset; type TakendownRecordCount = Unset; - } - ///State transition - sets the `reported_account_count` field to Set - pub struct SetReportedAccountCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReportedAccountCount<S> {} - impl<S: State> State for SetReportedAccountCount<S> { - type ReportedAccountCount = Set<members::reported_account_count>; - type ReportedRecordCount = S::ReportedRecordCount; - type Did = S::Did; - type LabeledRecordCount = S::LabeledRecordCount; - type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = S::RecordReportCount; - type TakendownRecordCount = S::TakendownRecordCount; - } - ///State transition - sets the `reported_record_count` field to Set - pub struct SetReportedRecordCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetReportedRecordCount<S> {} - impl<S: State> State for SetReportedRecordCount<S> { - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = Set<members::reported_record_count>; - type Did = S::Did; - type LabeledRecordCount = S::LabeledRecordCount; - type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = S::RecordReportCount; - type TakendownRecordCount = S::TakendownRecordCount; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; - type Did = Set<members::did>; - type LabeledRecordCount = S::LabeledRecordCount; - type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = S::RecordReportCount; - type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = Unset; + type LabeledAccountCount = Unset; + type Did = Unset; } ///State transition - sets the `labeled_record_count` field to Set pub struct SetLabeledRecordCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetLabeledRecordCount<S> {} impl<S: State> State for SetLabeledRecordCount<S> { - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; - type Did = S::Did; type LabeledRecordCount = Set<members::labeled_record_count>; type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = S::LabeledAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type RecordReportCount = S::RecordReportCount; + type AccountReportCount = S::AccountReportCount; type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; + type Did = S::Did; } ///State transition - sets the `takendown_account_count` field to Set pub struct SetTakendownAccountCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetTakendownAccountCount<S> {} impl<S: State> State for SetTakendownAccountCount<S> { + type LabeledRecordCount = S::LabeledRecordCount; + type TakendownAccountCount = Set<members::takendown_account_count>; type ReportedAccountCount = S::ReportedAccountCount; + type RecordReportCount = S::RecordReportCount; + type AccountReportCount = S::AccountReportCount; + type TakendownRecordCount = S::TakendownRecordCount; type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; type Did = S::Did; + } + ///State transition - sets the `reported_account_count` field to Set + pub struct SetReportedAccountCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReportedAccountCount<S> {} + impl<S: State> State for SetReportedAccountCount<S> { type LabeledRecordCount = S::LabeledRecordCount; - type TakendownAccountCount = Set<members::takendown_account_count>; + type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = Set<members::reported_account_count>; + type RecordReportCount = S::RecordReportCount; type AccountReportCount = S::AccountReportCount; + type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = S::ReportedRecordCount; type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = S::RecordReportCount; + type Did = S::Did; + } + ///State transition - sets the `record_report_count` field to Set + pub struct SetRecordReportCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetRecordReportCount<S> {} + impl<S: State> State for SetRecordReportCount<S> { + type LabeledRecordCount = S::LabeledRecordCount; + type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; + type RecordReportCount = Set<members::record_report_count>; + type AccountReportCount = S::AccountReportCount; type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; + type Did = S::Did; } ///State transition - sets the `account_report_count` field to Set pub struct SetAccountReportCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAccountReportCount<S> {} impl<S: State> State for SetAccountReportCount<S> { - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; - type Did = S::Did; type LabeledRecordCount = S::LabeledRecordCount; type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = Set<members::account_report_count>; - type LabeledAccountCount = S::LabeledAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; type RecordReportCount = S::RecordReportCount; + type AccountReportCount = Set<members::account_report_count>; type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; + type Did = S::Did; } - ///State transition - sets the `labeled_account_count` field to Set - pub struct SetLabeledAccountCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLabeledAccountCount<S> {} - impl<S: State> State for SetLabeledAccountCount<S> { + ///State transition - sets the `takendown_record_count` field to Set + pub struct SetTakendownRecordCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTakendownRecordCount<S> {} + impl<S: State> State for SetTakendownRecordCount<S> { + type LabeledRecordCount = S::LabeledRecordCount; + type TakendownAccountCount = S::TakendownAccountCount; type ReportedAccountCount = S::ReportedAccountCount; + type RecordReportCount = S::RecordReportCount; + type AccountReportCount = S::AccountReportCount; + type TakendownRecordCount = Set<members::takendown_record_count>; type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = S::LabeledAccountCount; type Did = S::Did; + } + ///State transition - sets the `reported_record_count` field to Set + pub struct SetReportedRecordCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetReportedRecordCount<S> {} + impl<S: State> State for SetReportedRecordCount<S> { type LabeledRecordCount = S::LabeledRecordCount; type TakendownAccountCount = S::TakendownAccountCount; - type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = Set<members::labeled_account_count>; + type ReportedAccountCount = S::ReportedAccountCount; type RecordReportCount = S::RecordReportCount; + type AccountReportCount = S::AccountReportCount; type TakendownRecordCount = S::TakendownRecordCount; - } - ///State transition - sets the `record_report_count` field to Set - pub struct SetRecordReportCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetRecordReportCount<S> {} - impl<S: State> State for SetRecordReportCount<S> { - type ReportedAccountCount = S::ReportedAccountCount; - type ReportedRecordCount = S::ReportedRecordCount; + type ReportedRecordCount = Set<members::reported_record_count>; + type LabeledAccountCount = S::LabeledAccountCount; type Did = S::Did; + } + ///State transition - sets the `labeled_account_count` field to Set + pub struct SetLabeledAccountCount<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLabeledAccountCount<S> {} + impl<S: State> State for SetLabeledAccountCount<S> { type LabeledRecordCount = S::LabeledRecordCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; + type RecordReportCount = S::RecordReportCount; type AccountReportCount = S::AccountReportCount; - type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = Set<members::record_report_count>; type TakendownRecordCount = S::TakendownRecordCount; - } - ///State transition - sets the `takendown_record_count` field to Set - pub struct SetTakendownRecordCount<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTakendownRecordCount<S> {} - impl<S: State> State for SetTakendownRecordCount<S> { - type ReportedAccountCount = S::ReportedAccountCount; type ReportedRecordCount = S::ReportedRecordCount; + type LabeledAccountCount = Set<members::labeled_account_count>; type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { type LabeledRecordCount = S::LabeledRecordCount; type TakendownAccountCount = S::TakendownAccountCount; + type ReportedAccountCount = S::ReportedAccountCount; + type RecordReportCount = S::RecordReportCount; type AccountReportCount = S::AccountReportCount; + type TakendownRecordCount = S::TakendownRecordCount; + type ReportedRecordCount = S::ReportedRecordCount; type LabeledAccountCount = S::LabeledAccountCount; - type RecordReportCount = S::RecordReportCount; - type TakendownRecordCount = Set<members::takendown_record_count>; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `reported_account_count` field - pub struct reported_account_count(()); - ///Marker type for the `reported_record_count` field - pub struct reported_record_count(()); - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `labeled_record_count` field pub struct labeled_record_count(()); ///Marker type for the `takendown_account_count` field pub struct takendown_account_count(()); - ///Marker type for the `account_report_count` field - pub struct account_report_count(()); - ///Marker type for the `labeled_account_count` field - pub struct labeled_account_count(()); + ///Marker type for the `reported_account_count` field + pub struct reported_account_count(()); ///Marker type for the `record_report_count` field pub struct record_report_count(()); + ///Marker type for the `account_report_count` field + pub struct account_report_count(()); ///Marker type for the `takendown_record_count` field pub struct takendown_record_count(()); + ///Marker type for the `reported_record_count` field + pub struct reported_record_count(()); + ///Marker type for the `labeled_account_count` field + pub struct labeled_account_count(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -12203,15 +12203,15 @@ where impl<'a, S> ReporterStatsBuilder<'a, S> where S: reporter_stats_state::State, - S::ReportedAccountCount: reporter_stats_state::IsSet, - S::ReportedRecordCount: reporter_stats_state::IsSet, - S::Did: reporter_stats_state::IsSet, S::LabeledRecordCount: reporter_stats_state::IsSet, S::TakendownAccountCount: reporter_stats_state::IsSet, - S::AccountReportCount: reporter_stats_state::IsSet, - S::LabeledAccountCount: reporter_stats_state::IsSet, + S::ReportedAccountCount: reporter_stats_state::IsSet, S::RecordReportCount: reporter_stats_state::IsSet, + S::AccountReportCount: reporter_stats_state::IsSet, S::TakendownRecordCount: reporter_stats_state::IsSet, + S::ReportedRecordCount: reporter_stats_state::IsSet, + S::LabeledAccountCount: reporter_stats_state::IsSet, + S::Did: reporter_stats_state::IsSet, { /// Build the final struct pub fn build(self) -> ReporterStats<'a> { @@ -12502,105 +12502,105 @@ pub mod scheduled_action_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type CreatedBy; - type Action; - type Status; type Id; + type CreatedAt; + type Status; type Did; + type Action; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type CreatedBy = Unset; - type Action = Unset; - type Status = Unset; type Id = Unset; + type CreatedAt = Unset; + type Status = Unset; type Did = Unset; - } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type CreatedBy = S::CreatedBy; - type Action = S::Action; - type Status = S::Status; - type Id = S::Id; - type Did = S::Did; + type Action = Unset; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { - type CreatedAt = S::CreatedAt; type CreatedBy = Set<members::created_by>; - type Action = S::Action; - type Status = S::Status; type Id = S::Id; + type CreatedAt = S::CreatedAt; + type Status = S::Status; type Did = S::Did; + type Action = S::Action; } - ///State transition - sets the `action` field to Set - pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAction<S> {} - impl<S: State> State for SetAction<S> { - type CreatedAt = S::CreatedAt; + ///State transition - sets the `id` field to Set + pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetId<S> {} + impl<S: State> State for SetId<S> { type CreatedBy = S::CreatedBy; - type Action = Set<members::action>; + type Id = Set<members::id>; + type CreatedAt = S::CreatedAt; type Status = S::Status; + type Did = S::Did; + type Action = S::Action; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type CreatedBy = S::CreatedBy; type Id = S::Id; + type CreatedAt = Set<members::created_at>; + type Status = S::Status; type Did = S::Did; + type Action = S::Action; } ///State transition - sets the `status` field to Set pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStatus<S> {} impl<S: State> State for SetStatus<S> { - type CreatedAt = S::CreatedAt; type CreatedBy = S::CreatedBy; - type Action = S::Action; - type Status = Set<members::status>; type Id = S::Id; - type Did = S::Did; - } - ///State transition - sets the `id` field to Set - pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetId<S> {} - impl<S: State> State for SetId<S> { type CreatedAt = S::CreatedAt; - type CreatedBy = S::CreatedBy; - type Action = S::Action; - type Status = S::Status; - type Id = Set<members::id>; + type Status = Set<members::status>; type Did = S::Did; + type Action = S::Action; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type CreatedAt = S::CreatedAt; type CreatedBy = S::CreatedBy; - type Action = S::Action; - type Status = S::Status; type Id = S::Id; + type CreatedAt = S::CreatedAt; + type Status = S::Status; type Did = Set<members::did>; + type Action = S::Action; + } + ///State transition - sets the `action` field to Set + pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAction<S> {} + impl<S: State> State for SetAction<S> { + type CreatedBy = S::CreatedBy; + type Id = S::Id; + type CreatedAt = S::CreatedAt; + type Status = S::Status; + type Did = S::Did; + type Action = Set<members::action>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `created_by` field pub struct created_by(()); - ///Marker type for the `action` field - pub struct action(()); - ///Marker type for the `status` field - pub struct status(()); ///Marker type for the `id` field pub struct id(()); + ///Marker type for the `created_at` field + pub struct created_at(()); + ///Marker type for the `status` field + pub struct status(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `action` field + pub struct action(()); } } @@ -12937,12 +12937,12 @@ impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, S impl<'a, S> ScheduledActionViewBuilder<'a, S> where S: scheduled_action_view_state::State, - S::CreatedAt: scheduled_action_view_state::IsSet, S::CreatedBy: scheduled_action_view_state::IsSet, - S::Action: scheduled_action_view_state::IsSet, - S::Status: scheduled_action_view_state::IsSet, S::Id: scheduled_action_view_state::IsSet, + S::CreatedAt: scheduled_action_view_state::IsSet, + S::Status: scheduled_action_view_state::IsSet, S::Did: scheduled_action_view_state::IsSet, + S::Action: scheduled_action_view_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduledActionView<'a> { @@ -13427,8 +13427,8 @@ pub mod subject_status_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedAt; type Id; + type CreatedAt; type ReviewState; type Subject; type UpdatedAt; @@ -13437,28 +13437,28 @@ pub mod subject_status_view_state { pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedAt = Unset; type Id = Unset; + type CreatedAt = Unset; type ReviewState = Unset; type Subject = Unset; type UpdatedAt = Unset; } - ///State transition - sets the `created_at` field to Set - pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedAt<S> {} - impl<S: State> State for SetCreatedAt<S> { - type CreatedAt = Set<members::created_at>; - type Id = S::Id; - type ReviewState = S::ReviewState; - type Subject = S::Subject; - type UpdatedAt = S::UpdatedAt; - } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { - type CreatedAt = S::CreatedAt; type Id = Set<members::id>; + type CreatedAt = S::CreatedAt; + type ReviewState = S::ReviewState; + type Subject = S::Subject; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `created_at` field to Set + pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedAt<S> {} + impl<S: State> State for SetCreatedAt<S> { + type Id = S::Id; + type CreatedAt = Set<members::created_at>; type ReviewState = S::ReviewState; type Subject = S::Subject; type UpdatedAt = S::UpdatedAt; @@ -13467,8 +13467,8 @@ pub mod subject_status_view_state { pub struct SetReviewState<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReviewState<S> {} impl<S: State> State for SetReviewState<S> { - type CreatedAt = S::CreatedAt; type Id = S::Id; + type CreatedAt = S::CreatedAt; type ReviewState = Set<members::review_state>; type Subject = S::Subject; type UpdatedAt = S::UpdatedAt; @@ -13477,8 +13477,8 @@ pub mod subject_status_view_state { pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type CreatedAt = S::CreatedAt; type Id = S::Id; + type CreatedAt = S::CreatedAt; type ReviewState = S::ReviewState; type Subject = Set<members::subject>; type UpdatedAt = S::UpdatedAt; @@ -13487,8 +13487,8 @@ pub mod subject_status_view_state { pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} impl<S: State> State for SetUpdatedAt<S> { - type CreatedAt = S::CreatedAt; type Id = S::Id; + type CreatedAt = S::CreatedAt; type ReviewState = S::ReviewState; type Subject = S::Subject; type UpdatedAt = Set<members::updated_at>; @@ -13496,10 +13496,10 @@ pub mod subject_status_view_state { /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_at` field - pub struct created_at(()); ///Marker type for the `id` field pub struct id(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `review_state` field pub struct review_state(()); ///Marker type for the `subject` field @@ -14040,8 +14040,8 @@ where impl<'a, S> SubjectStatusViewBuilder<'a, S> where S: subject_status_view_state::State, - S::CreatedAt: subject_status_view_state::IsSet, S::Id: subject_status_view_state::IsSet, + S::CreatedAt: subject_status_view_state::IsSet, S::ReviewState: subject_status_view_state::IsSet, S::Subject: subject_status_view_state::IsSet, S::UpdatedAt: subject_status_view_state::IsSet, @@ -14451,37 +14451,37 @@ pub mod subject_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Type; type Subject; + type Type; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Type = Unset; type Subject = Unset; - } - ///State transition - sets the `type` field to Set - pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetType<S> {} - impl<S: State> State for SetType<S> { - type Type = Set<members::r#type>; - type Subject = S::Subject; + type Type = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type Type = S::Type; type Subject = Set<members::subject>; + type Type = S::Type; + } + ///State transition - sets the `type` field to Set + pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetType<S> {} + impl<S: State> State for SetType<S> { + type Subject = S::Subject; + type Type = Set<members::r#type>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `type` field - pub struct r#type(()); ///Marker type for the `subject` field pub struct subject(()); + ///Marker type for the `type` field + pub struct r#type(()); } } @@ -14634,8 +14634,8 @@ where impl<'a, S> SubjectViewBuilder<'a, S> where S: subject_view_state::State, - S::Type: subject_view_state::IsSet, S::Subject: subject_view_state::IsSet, + S::Type: subject_view_state::IsSet, { /// Build the final struct pub fn build(self) -> SubjectView<'a> { @@ -14767,51 +14767,51 @@ pub mod video_details_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Length; type Width; type Height; + type Length; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Length = Unset; type Width = Unset; type Height = Unset; - } - ///State transition - sets the `length` field to Set - pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLength<S> {} - impl<S: State> State for SetLength<S> { - type Length = Set<members::length>; - type Width = S::Width; - type Height = S::Height; + type Length = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWidth<S> {} impl<S: State> State for SetWidth<S> { - type Length = S::Length; type Width = Set<members::width>; type Height = S::Height; + type Length = S::Length; } ///State transition - sets the `height` field to Set pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeight<S> {} impl<S: State> State for SetHeight<S> { - type Length = S::Length; type Width = S::Width; type Height = Set<members::height>; + type Length = S::Length; + } + ///State transition - sets the `length` field to Set + pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLength<S> {} + impl<S: State> State for SetLength<S> { + type Width = S::Width; + type Height = S::Height; + type Length = Set<members::length>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `length` field - pub struct length(()); ///Marker type for the `width` field pub struct width(()); ///Marker type for the `height` field pub struct height(()); + ///Marker type for the `length` field + pub struct length(()); } } @@ -14904,9 +14904,9 @@ where impl<'a, S> VideoDetailsBuilder<'a, S> where S: video_details_state::State, - S::Length: video_details_state::IsSet, S::Width: video_details_state::IsSet, S::Height: video_details_state::IsSet, + S::Length: video_details_state::IsSet, { /// Build the final struct pub fn build(self) -> VideoDetails<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/moderation/get_account_timeline.rs b/crates/jacquard-api/src/tools_ozone/moderation/get_account_timeline.rs index 0079811e..81171762 100644 --- a/crates/jacquard-api/src/tools_ozone/moderation/get_account_timeline.rs +++ b/crates/jacquard-api/src/tools_ozone/moderation/get_account_timeline.rs @@ -576,50 +576,50 @@ pub mod timeline_item_summary_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Count; - type EventSubjectType; type EventType; + type EventSubjectType; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Count = Unset; - type EventSubjectType = Unset; type EventType = Unset; + type EventSubjectType = Unset; } ///State transition - sets the `count` field to Set pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCount<S> {} impl<S: State> State for SetCount<S> { type Count = Set<members::count>; - type EventSubjectType = S::EventSubjectType; - type EventType = S::EventType; - } - ///State transition - sets the `event_subject_type` field to Set - pub struct SetEventSubjectType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEventSubjectType<S> {} - impl<S: State> State for SetEventSubjectType<S> { - type Count = S::Count; - type EventSubjectType = Set<members::event_subject_type>; type EventType = S::EventType; + type EventSubjectType = S::EventSubjectType; } ///State transition - sets the `event_type` field to Set pub struct SetEventType<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetEventType<S> {} impl<S: State> State for SetEventType<S> { type Count = S::Count; - type EventSubjectType = S::EventSubjectType; type EventType = Set<members::event_type>; + type EventSubjectType = S::EventSubjectType; + } + ///State transition - sets the `event_subject_type` field to Set + pub struct SetEventSubjectType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEventSubjectType<S> {} + impl<S: State> State for SetEventSubjectType<S> { + type Count = S::Count; + type EventType = S::EventType; + type EventSubjectType = Set<members::event_subject_type>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `count` field pub struct count(()); - ///Marker type for the `event_subject_type` field - pub struct event_subject_type(()); ///Marker type for the `event_type` field pub struct event_type(()); + ///Marker type for the `event_subject_type` field + pub struct event_subject_type(()); } } @@ -716,8 +716,8 @@ impl<'a, S> TimelineItemSummaryBuilder<'a, S> where S: timeline_item_summary_state::State, S::Count: timeline_item_summary_state::IsSet, - S::EventSubjectType: timeline_item_summary_state::IsSet, S::EventType: timeline_item_summary_state::IsSet, + S::EventSubjectType: timeline_item_summary_state::IsSet, { /// Build the final struct pub fn build(self) -> TimelineItemSummary<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/moderation/schedule_action.rs b/crates/jacquard-api/src/tools_ozone/moderation/schedule_action.rs index a1008e2c..a3a7bdd7 100644 --- a/crates/jacquard-api/src/tools_ozone/moderation/schedule_action.rs +++ b/crates/jacquard-api/src/tools_ozone/moderation/schedule_action.rs @@ -36,37 +36,37 @@ pub mod failed_scheduling_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type Error; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type Error = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type Subject = Set<members::subject>; - type Error = S::Error; + type Subject = Unset; } ///State transition - sets the `error` field to Set pub struct SetError<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetError<S> {} impl<S: State> State for SetError<S> { - type Subject = S::Subject; type Error = Set<members::error>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Error = S::Error; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `error` field pub struct error(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -159,8 +159,8 @@ where impl<'a, S> FailedSchedulingBuilder<'a, S> where S: failed_scheduling_state::State, - S::Subject: failed_scheduling_state::IsSet, S::Error: failed_scheduling_state::IsSet, + S::Subject: failed_scheduling_state::IsSet, { /// Build the final struct pub fn build(self) -> FailedScheduling<'a> { @@ -761,67 +761,67 @@ pub mod schedule_action_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subjects; type Action; - type Scheduling; + type Subjects; type CreatedBy; + type Scheduling; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subjects = Unset; type Action = Unset; - type Scheduling = Unset; + type Subjects = Unset; type CreatedBy = Unset; - } - ///State transition - sets the `subjects` field to Set - pub struct SetSubjects<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubjects<S> {} - impl<S: State> State for SetSubjects<S> { - type Subjects = Set<members::subjects>; - type Action = S::Action; - type Scheduling = S::Scheduling; - type CreatedBy = S::CreatedBy; + type Scheduling = Unset; } ///State transition - sets the `action` field to Set pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAction<S> {} impl<S: State> State for SetAction<S> { - type Subjects = S::Subjects; type Action = Set<members::action>; - type Scheduling = S::Scheduling; + type Subjects = S::Subjects; type CreatedBy = S::CreatedBy; + type Scheduling = S::Scheduling; } - ///State transition - sets the `scheduling` field to Set - pub struct SetScheduling<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetScheduling<S> {} - impl<S: State> State for SetScheduling<S> { - type Subjects = S::Subjects; + ///State transition - sets the `subjects` field to Set + pub struct SetSubjects<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubjects<S> {} + impl<S: State> State for SetSubjects<S> { type Action = S::Action; - type Scheduling = Set<members::scheduling>; + type Subjects = Set<members::subjects>; type CreatedBy = S::CreatedBy; + type Scheduling = S::Scheduling; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { - type Subjects = S::Subjects; type Action = S::Action; - type Scheduling = S::Scheduling; + type Subjects = S::Subjects; type CreatedBy = Set<members::created_by>; + type Scheduling = S::Scheduling; + } + ///State transition - sets the `scheduling` field to Set + pub struct SetScheduling<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetScheduling<S> {} + impl<S: State> State for SetScheduling<S> { + type Action = S::Action; + type Subjects = S::Subjects; + type CreatedBy = S::CreatedBy; + type Scheduling = Set<members::scheduling>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subjects` field - pub struct subjects(()); ///Marker type for the `action` field pub struct action(()); - ///Marker type for the `scheduling` field - pub struct scheduling(()); + ///Marker type for the `subjects` field + pub struct subjects(()); ///Marker type for the `created_by` field pub struct created_by(()); + ///Marker type for the `scheduling` field + pub struct scheduling(()); } } @@ -960,10 +960,10 @@ where impl<'a, S> ScheduleActionBuilder<'a, S> where S: schedule_action_state::State, - S::Subjects: schedule_action_state::IsSet, S::Action: schedule_action_state::IsSet, - S::Scheduling: schedule_action_state::IsSet, + S::Subjects: schedule_action_state::IsSet, S::CreatedBy: schedule_action_state::IsSet, + S::Scheduling: schedule_action_state::IsSet, { /// Build the final struct pub fn build(self) -> ScheduleAction<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/safelink.rs b/crates/jacquard-api/src/tools_ozone/safelink.rs index f56dcb51..bb68c4bd 100644 --- a/crates/jacquard-api/src/tools_ozone/safelink.rs +++ b/crates/jacquard-api/src/tools_ozone/safelink.rs @@ -145,12 +145,12 @@ pub mod event_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Url; + type Id; + type Pattern; type CreatedBy; + type CreatedAt; type Action; - type Id; type EventType; - type CreatedAt; - type Pattern; type Reason; } /// Empty state - all required fields are unset @@ -158,12 +158,12 @@ pub mod event_state { impl sealed::Sealed for Empty {} impl State for Empty { type Url = Unset; + type Id = Unset; + type Pattern = Unset; type CreatedBy = Unset; + type CreatedAt = Unset; type Action = Unset; - type Id = Unset; type EventType = Unset; - type CreatedAt = Unset; - type Pattern = Unset; type Reason = Unset; } ///State transition - sets the `url` field to Set @@ -171,38 +171,12 @@ pub mod event_state { impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { type Url = Set<members::url>; - type CreatedBy = S::CreatedBy; - type Action = S::Action; - type Id = S::Id; - type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Pattern = S::Pattern; - type Reason = S::Reason; - } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedBy<S> {} - impl<S: State> State for SetCreatedBy<S> { - type Url = S::Url; - type CreatedBy = Set<members::created_by>; - type Action = S::Action; type Id = S::Id; - type EventType = S::EventType; - type CreatedAt = S::CreatedAt; type Pattern = S::Pattern; - type Reason = S::Reason; - } - ///State transition - sets the `action` field to Set - pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAction<S> {} - impl<S: State> State for SetAction<S> { - type Url = S::Url; type CreatedBy = S::CreatedBy; - type Action = Set<members::action>; - type Id = S::Id; - type EventType = S::EventType; type CreatedAt = S::CreatedAt; - type Pattern = S::Pattern; + type Action = S::Action; + type EventType = S::EventType; type Reason = S::Reason; } ///State transition - sets the `id` field to Set @@ -210,25 +184,38 @@ pub mod event_state { impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { type Url = S::Url; + type Id = Set<members::id>; + type Pattern = S::Pattern; type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; type Action = S::Action; - type Id = Set<members::id>; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Pattern = S::Pattern; type Reason = S::Reason; } - ///State transition - sets the `event_type` field to Set - pub struct SetEventType<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetEventType<S> {} - impl<S: State> State for SetEventType<S> { + ///State transition - sets the `pattern` field to Set + pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPattern<S> {} + impl<S: State> State for SetPattern<S> { type Url = S::Url; + type Id = S::Id; + type Pattern = Set<members::pattern>; type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; type Action = S::Action; + type EventType = S::EventType; + type Reason = S::Reason; + } + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedBy<S> {} + impl<S: State> State for SetCreatedBy<S> { + type Url = S::Url; type Id = S::Id; - type EventType = Set<members::event_type>; - type CreatedAt = S::CreatedAt; type Pattern = S::Pattern; + type CreatedBy = Set<members::created_by>; + type CreatedAt = S::CreatedAt; + type Action = S::Action; + type EventType = S::EventType; type Reason = S::Reason; } ///State transition - sets the `created_at` field to Set @@ -236,25 +223,38 @@ pub mod event_state { impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Url = S::Url; + type Id = S::Id; + type Pattern = S::Pattern; type CreatedBy = S::CreatedBy; + type CreatedAt = Set<members::created_at>; type Action = S::Action; - type Id = S::Id; type EventType = S::EventType; - type CreatedAt = Set<members::created_at>; - type Pattern = S::Pattern; type Reason = S::Reason; } - ///State transition - sets the `pattern` field to Set - pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPattern<S> {} - impl<S: State> State for SetPattern<S> { + ///State transition - sets the `action` field to Set + pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAction<S> {} + impl<S: State> State for SetAction<S> { type Url = S::Url; - type CreatedBy = S::CreatedBy; - type Action = S::Action; type Id = S::Id; + type Pattern = S::Pattern; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Action = Set<members::action>; type EventType = S::EventType; + type Reason = S::Reason; + } + ///State transition - sets the `event_type` field to Set + pub struct SetEventType<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetEventType<S> {} + impl<S: State> State for SetEventType<S> { + type Url = S::Url; + type Id = S::Id; + type Pattern = S::Pattern; + type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type Pattern = Set<members::pattern>; + type Action = S::Action; + type EventType = Set<members::event_type>; type Reason = S::Reason; } ///State transition - sets the `reason` field to Set @@ -262,12 +262,12 @@ pub mod event_state { impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { type Url = S::Url; + type Id = S::Id; + type Pattern = S::Pattern; type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; type Action = S::Action; - type Id = S::Id; type EventType = S::EventType; - type CreatedAt = S::CreatedAt; - type Pattern = S::Pattern; type Reason = Set<members::reason>; } /// Marker types for field names @@ -275,18 +275,18 @@ pub mod event_state { pub mod members { ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `id` field + pub struct id(()); + ///Marker type for the `pattern` field + pub struct pattern(()); ///Marker type for the `created_by` field pub struct created_by(()); + ///Marker type for the `created_at` field + pub struct created_at(()); ///Marker type for the `action` field pub struct action(()); - ///Marker type for the `id` field - pub struct id(()); ///Marker type for the `event_type` field pub struct event_type(()); - ///Marker type for the `created_at` field - pub struct created_at(()); - ///Marker type for the `pattern` field - pub struct pattern(()); ///Marker type for the `reason` field pub struct reason(()); } @@ -509,12 +509,12 @@ impl<'a, S> EventBuilder<'a, S> where S: event_state::State, S::Url: event_state::IsSet, + S::Id: event_state::IsSet, + S::Pattern: event_state::IsSet, S::CreatedBy: event_state::IsSet, + S::CreatedAt: event_state::IsSet, S::Action: event_state::IsSet, - S::Id: event_state::IsSet, S::EventType: event_state::IsSet, - S::CreatedAt: event_state::IsSet, - S::Pattern: event_state::IsSet, S::Reason: event_state::IsSet, { /// Build the final struct @@ -1258,126 +1258,126 @@ pub mod url_rule_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Reason; + type Pattern; + type Action; type CreatedBy; type CreatedAt; - type UpdatedAt; type Url; - type Pattern; - type Action; + type UpdatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Reason = Unset; + type Pattern = Unset; + type Action = Unset; type CreatedBy = Unset; type CreatedAt = Unset; - type UpdatedAt = Unset; type Url = Unset; - type Pattern = Unset; - type Action = Unset; + type UpdatedAt = Unset; } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { type Reason = Set<members::reason>; + type Pattern = S::Pattern; + type Action = S::Action; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; + type Url = S::Url; type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `pattern` field to Set + pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPattern<S> {} + impl<S: State> State for SetPattern<S> { + type Reason = S::Reason; + type Pattern = Set<members::pattern>; + type Action = S::Action; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; type Url = S::Url; + type UpdatedAt = S::UpdatedAt; + } + ///State transition - sets the `action` field to Set + pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAction<S> {} + impl<S: State> State for SetAction<S> { + type Reason = S::Reason; type Pattern = S::Pattern; - type Action = S::Action; + type Action = Set<members::action>; + type CreatedBy = S::CreatedBy; + type CreatedAt = S::CreatedAt; + type Url = S::Url; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `created_by` field to Set pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedBy<S> {} impl<S: State> State for SetCreatedBy<S> { type Reason = S::Reason; + type Pattern = S::Pattern; + type Action = S::Action; type CreatedBy = Set<members::created_by>; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Url = S::Url; - type Pattern = S::Pattern; - type Action = S::Action; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Reason = S::Reason; - type CreatedBy = S::CreatedBy; - type CreatedAt = Set<members::created_at>; - type UpdatedAt = S::UpdatedAt; - type Url = S::Url; type Pattern = S::Pattern; type Action = S::Action; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { - type Reason = S::Reason; type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type UpdatedAt = Set<members::updated_at>; + type CreatedAt = Set<members::created_at>; type Url = S::Url; - type Pattern = S::Pattern; - type Action = S::Action; + type UpdatedAt = S::UpdatedAt; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { type Reason = S::Reason; - type CreatedBy = S::CreatedBy; - type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; - type Url = Set<members::url>; type Pattern = S::Pattern; type Action = S::Action; - } - ///State transition - sets the `pattern` field to Set - pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPattern<S> {} - impl<S: State> State for SetPattern<S> { - type Reason = S::Reason; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; + type Url = Set<members::url>; type UpdatedAt = S::UpdatedAt; - type Url = S::Url; - type Pattern = Set<members::pattern>; - type Action = S::Action; } - ///State transition - sets the `action` field to Set - pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAction<S> {} - impl<S: State> State for SetAction<S> { + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { type Reason = S::Reason; + type Pattern = S::Pattern; + type Action = S::Action; type CreatedBy = S::CreatedBy; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Url = S::Url; - type Pattern = S::Pattern; - type Action = Set<members::action>; + type UpdatedAt = Set<members::updated_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `reason` field pub struct reason(()); + ///Marker type for the `pattern` field + pub struct pattern(()); + ///Marker type for the `action` field + pub struct action(()); ///Marker type for the `created_by` field pub struct created_by(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `url` field pub struct url(()); - ///Marker type for the `pattern` field - pub struct pattern(()); - ///Marker type for the `action` field - pub struct action(()); + ///Marker type for the `updated_at` field + pub struct updated_at(()); } } @@ -1568,12 +1568,12 @@ impl<'a, S> UrlRuleBuilder<'a, S> where S: url_rule_state::State, S::Reason: url_rule_state::IsSet, + S::Pattern: url_rule_state::IsSet, + S::Action: url_rule_state::IsSet, S::CreatedBy: url_rule_state::IsSet, S::CreatedAt: url_rule_state::IsSet, - S::UpdatedAt: url_rule_state::IsSet, S::Url: url_rule_state::IsSet, - S::Pattern: url_rule_state::IsSet, - S::Action: url_rule_state::IsSet, + S::UpdatedAt: url_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> UrlRule<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/safelink/add_rule.rs b/crates/jacquard-api/src/tools_ozone/safelink/add_rule.rs index 1dea244e..891d18ea 100644 --- a/crates/jacquard-api/src/tools_ozone/safelink/add_rule.rs +++ b/crates/jacquard-api/src/tools_ozone/safelink/add_rule.rs @@ -46,67 +46,67 @@ pub mod add_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Url; type Pattern; type Action; type Reason; + type Url; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Url = Unset; type Pattern = Unset; type Action = Unset; type Reason = Unset; - } - ///State transition - sets the `url` field to Set - pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUrl<S> {} - impl<S: State> State for SetUrl<S> { - type Url = Set<members::url>; - type Pattern = S::Pattern; - type Action = S::Action; - type Reason = S::Reason; + type Url = Unset; } ///State transition - sets the `pattern` field to Set pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPattern<S> {} impl<S: State> State for SetPattern<S> { - type Url = S::Url; type Pattern = Set<members::pattern>; type Action = S::Action; type Reason = S::Reason; + type Url = S::Url; } ///State transition - sets the `action` field to Set pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetAction<S> {} impl<S: State> State for SetAction<S> { - type Url = S::Url; type Pattern = S::Pattern; type Action = Set<members::action>; type Reason = S::Reason; + type Url = S::Url; } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { - type Url = S::Url; type Pattern = S::Pattern; type Action = S::Action; type Reason = Set<members::reason>; + type Url = S::Url; + } + ///State transition - sets the `url` field to Set + pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUrl<S> {} + impl<S: State> State for SetUrl<S> { + type Pattern = S::Pattern; + type Action = S::Action; + type Reason = S::Reason; + type Url = Set<members::url>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `url` field - pub struct url(()); ///Marker type for the `pattern` field pub struct pattern(()); ///Marker type for the `action` field pub struct action(()); ///Marker type for the `reason` field pub struct reason(()); + ///Marker type for the `url` field + pub struct url(()); } } @@ -256,10 +256,10 @@ where impl<'a, S> AddRuleBuilder<'a, S> where S: add_rule_state::State, - S::Url: add_rule_state::IsSet, S::Pattern: add_rule_state::IsSet, S::Action: add_rule_state::IsSet, S::Reason: add_rule_state::IsSet, + S::Url: add_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> AddRule<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/safelink/remove_rule.rs b/crates/jacquard-api/src/tools_ozone/safelink/remove_rule.rs index 45dfdab4..dd969021 100644 --- a/crates/jacquard-api/src/tools_ozone/safelink/remove_rule.rs +++ b/crates/jacquard-api/src/tools_ozone/safelink/remove_rule.rs @@ -42,37 +42,37 @@ pub mod remove_rule_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Pattern; type Url; + type Pattern; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Pattern = Unset; type Url = Unset; - } - ///State transition - sets the `pattern` field to Set - pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPattern<S> {} - impl<S: State> State for SetPattern<S> { - type Pattern = Set<members::pattern>; - type Url = S::Url; + type Pattern = Unset; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { - type Pattern = S::Pattern; type Url = Set<members::url>; + type Pattern = S::Pattern; + } + ///State transition - sets the `pattern` field to Set + pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPattern<S> {} + impl<S: State> State for SetPattern<S> { + type Url = S::Url; + type Pattern = Set<members::pattern>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `pattern` field - pub struct pattern(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `pattern` field + pub struct pattern(()); } } @@ -182,8 +182,8 @@ where impl<'a, S> RemoveRuleBuilder<'a, S> where S: remove_rule_state::State, - S::Pattern: remove_rule_state::IsSet, S::Url: remove_rule_state::IsSet, + S::Pattern: remove_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> RemoveRule<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/safelink/update_rule.rs b/crates/jacquard-api/src/tools_ozone/safelink/update_rule.rs index a715db13..7eea89a9 100644 --- a/crates/jacquard-api/src/tools_ozone/safelink/update_rule.rs +++ b/crates/jacquard-api/src/tools_ozone/safelink/update_rule.rs @@ -47,66 +47,66 @@ pub mod update_rule_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Reason; - type Action; type Pattern; type Url; + type Action; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Reason = Unset; - type Action = Unset; type Pattern = Unset; type Url = Unset; + type Action = Unset; } ///State transition - sets the `reason` field to Set pub struct SetReason<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetReason<S> {} impl<S: State> State for SetReason<S> { type Reason = Set<members::reason>; - type Action = S::Action; - type Pattern = S::Pattern; - type Url = S::Url; - } - ///State transition - sets the `action` field to Set - pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetAction<S> {} - impl<S: State> State for SetAction<S> { - type Reason = S::Reason; - type Action = Set<members::action>; type Pattern = S::Pattern; type Url = S::Url; + type Action = S::Action; } ///State transition - sets the `pattern` field to Set pub struct SetPattern<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPattern<S> {} impl<S: State> State for SetPattern<S> { type Reason = S::Reason; - type Action = S::Action; type Pattern = Set<members::pattern>; type Url = S::Url; + type Action = S::Action; } ///State transition - sets the `url` field to Set pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetUrl<S> {} impl<S: State> State for SetUrl<S> { type Reason = S::Reason; - type Action = S::Action; type Pattern = S::Pattern; type Url = Set<members::url>; + type Action = S::Action; + } + ///State transition - sets the `action` field to Set + pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetAction<S> {} + impl<S: State> State for SetAction<S> { + type Reason = S::Reason; + type Pattern = S::Pattern; + type Url = S::Url; + type Action = Set<members::action>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `reason` field pub struct reason(()); - ///Marker type for the `action` field - pub struct action(()); ///Marker type for the `pattern` field pub struct pattern(()); ///Marker type for the `url` field pub struct url(()); + ///Marker type for the `action` field + pub struct action(()); } } @@ -257,9 +257,9 @@ impl<'a, S> UpdateRuleBuilder<'a, S> where S: update_rule_state::State, S::Reason: update_rule_state::IsSet, - S::Action: update_rule_state::IsSet, S::Pattern: update_rule_state::IsSet, S::Url: update_rule_state::IsSet, + S::Action: update_rule_state::IsSet, { /// Build the final struct pub fn build(self) -> UpdateRule<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/set.rs b/crates/jacquard-api/src/tools_ozone/set.rs index c380e4f0..04d206fe 100644 --- a/crates/jacquard-api/src/tools_ozone/set.rs +++ b/crates/jacquard-api/src/tools_ozone/set.rs @@ -300,65 +300,65 @@ pub mod set_view_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type UpdatedAt; type SetSize; type CreatedAt; - type UpdatedAt; type Name; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { + type UpdatedAt = Unset; type SetSize = Unset; type CreatedAt = Unset; - type UpdatedAt = Unset; type Name = Unset; } + ///State transition - sets the `updated_at` field to Set + pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} + impl<S: State> State for SetUpdatedAt<S> { + type UpdatedAt = Set<members::updated_at>; + type SetSize = S::SetSize; + type CreatedAt = S::CreatedAt; + type Name = S::Name; + } ///State transition - sets the `set_size` field to Set pub struct SetSetSize<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSetSize<S> {} impl<S: State> State for SetSetSize<S> { + type UpdatedAt = S::UpdatedAt; type SetSize = Set<members::set_size>; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Name = S::Name; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type SetSize = S::SetSize; - type CreatedAt = Set<members::created_at>; type UpdatedAt = S::UpdatedAt; - type Name = S::Name; - } - ///State transition - sets the `updated_at` field to Set - pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUpdatedAt<S> {} - impl<S: State> State for SetUpdatedAt<S> { type SetSize = S::SetSize; - type CreatedAt = S::CreatedAt; - type UpdatedAt = Set<members::updated_at>; + type CreatedAt = Set<members::created_at>; type Name = S::Name; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { + type UpdatedAt = S::UpdatedAt; type SetSize = S::SetSize; type CreatedAt = S::CreatedAt; - type UpdatedAt = S::UpdatedAt; type Name = Set<members::name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { + ///Marker type for the `updated_at` field + pub struct updated_at(()); ///Marker type for the `set_size` field pub struct set_size(()); ///Marker type for the `created_at` field pub struct created_at(()); - ///Marker type for the `updated_at` field - pub struct updated_at(()); ///Marker type for the `name` field pub struct name(()); } @@ -493,9 +493,9 @@ where impl<'a, S> SetViewBuilder<'a, S> where S: set_view_state::State, + S::UpdatedAt: set_view_state::IsSet, S::SetSize: set_view_state::IsSet, S::CreatedAt: set_view_state::IsSet, - S::UpdatedAt: set_view_state::IsSet, S::Name: set_view_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/tools_ozone/set/delete_values.rs b/crates/jacquard-api/src/tools_ozone/set/delete_values.rs index b8a9c48b..fedac145 100644 --- a/crates/jacquard-api/src/tools_ozone/set/delete_values.rs +++ b/crates/jacquard-api/src/tools_ozone/set/delete_values.rs @@ -35,37 +35,37 @@ pub mod delete_values_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Values; type Name; + type Values; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Values = Unset; type Name = Unset; - } - ///State transition - sets the `values` field to Set - pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetValues<S> {} - impl<S: State> State for SetValues<S> { - type Values = Set<members::values>; - type Name = S::Name; + type Values = Unset; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Values = S::Values; type Name = Set<members::name>; + type Values = S::Values; + } + ///State transition - sets the `values` field to Set + pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValues<S> {} + impl<S: State> State for SetValues<S> { + type Name = S::Name; + type Values = Set<members::values>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `values` field - pub struct values(()); ///Marker type for the `name` field pub struct name(()); + ///Marker type for the `values` field + pub struct values(()); } } @@ -138,8 +138,8 @@ where impl<'a, S> DeleteValuesBuilder<'a, S> where S: delete_values_state::State, - S::Values: delete_values_state::IsSet, S::Name: delete_values_state::IsSet, + S::Values: delete_values_state::IsSet, { /// Build the final struct pub fn build(self) -> DeleteValues<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/setting.rs b/crates/jacquard-api/src/tools_ozone/setting.rs index 9dc1916d..2d60b8b9 100644 --- a/crates/jacquard-api/src/tools_ozone/setting.rs +++ b/crates/jacquard-api/src/tools_ozone/setting.rs @@ -55,105 +55,105 @@ pub mod defs_option_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type CreatedBy; + type LastUpdatedBy; type Key; - type Value; type Scope; - type LastUpdatedBy; + type CreatedBy; type Did; + type Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type CreatedBy = Unset; + type LastUpdatedBy = Unset; type Key = Unset; - type Value = Unset; type Scope = Unset; - type LastUpdatedBy = Unset; + type CreatedBy = Unset; type Did = Unset; + type Value = Unset; } - ///State transition - sets the `created_by` field to Set - pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetCreatedBy<S> {} - impl<S: State> State for SetCreatedBy<S> { - type CreatedBy = Set<members::created_by>; + ///State transition - sets the `last_updated_by` field to Set + pub struct SetLastUpdatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetLastUpdatedBy<S> {} + impl<S: State> State for SetLastUpdatedBy<S> { + type LastUpdatedBy = Set<members::last_updated_by>; type Key = S::Key; - type Value = S::Value; type Scope = S::Scope; - type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = S::CreatedBy; type Did = S::Did; + type Value = S::Value; } ///State transition - sets the `key` field to Set pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetKey<S> {} impl<S: State> State for SetKey<S> { - type CreatedBy = S::CreatedBy; + type LastUpdatedBy = S::LastUpdatedBy; type Key = Set<members::key>; - type Value = S::Value; type Scope = S::Scope; - type LastUpdatedBy = S::LastUpdatedBy; - type Did = S::Did; - } - ///State transition - sets the `value` field to Set - pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetValue<S> {} - impl<S: State> State for SetValue<S> { type CreatedBy = S::CreatedBy; - type Key = S::Key; - type Value = Set<members::value>; - type Scope = S::Scope; - type LastUpdatedBy = S::LastUpdatedBy; type Did = S::Did; + type Value = S::Value; } ///State transition - sets the `scope` field to Set pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetScope<S> {} impl<S: State> State for SetScope<S> { - type CreatedBy = S::CreatedBy; + type LastUpdatedBy = S::LastUpdatedBy; type Key = S::Key; - type Value = S::Value; type Scope = Set<members::scope>; - type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = S::CreatedBy; type Did = S::Did; + type Value = S::Value; } - ///State transition - sets the `last_updated_by` field to Set - pub struct SetLastUpdatedBy<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetLastUpdatedBy<S> {} - impl<S: State> State for SetLastUpdatedBy<S> { - type CreatedBy = S::CreatedBy; + ///State transition - sets the `created_by` field to Set + pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetCreatedBy<S> {} + impl<S: State> State for SetCreatedBy<S> { + type LastUpdatedBy = S::LastUpdatedBy; type Key = S::Key; - type Value = S::Value; type Scope = S::Scope; - type LastUpdatedBy = Set<members::last_updated_by>; + type CreatedBy = Set<members::created_by>; type Did = S::Did; + type Value = S::Value; } ///State transition - sets the `did` field to Set pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDid<S> {} impl<S: State> State for SetDid<S> { - type CreatedBy = S::CreatedBy; + type LastUpdatedBy = S::LastUpdatedBy; type Key = S::Key; - type Value = S::Value; type Scope = S::Scope; - type LastUpdatedBy = S::LastUpdatedBy; + type CreatedBy = S::CreatedBy; type Did = Set<members::did>; + type Value = S::Value; + } + ///State transition - sets the `value` field to Set + pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetValue<S> {} + impl<S: State> State for SetValue<S> { + type LastUpdatedBy = S::LastUpdatedBy; + type Key = S::Key; + type Scope = S::Scope; + type CreatedBy = S::CreatedBy; + type Did = S::Did; + type Value = Set<members::value>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `created_by` field - pub struct created_by(()); + ///Marker type for the `last_updated_by` field + pub struct last_updated_by(()); ///Marker type for the `key` field pub struct key(()); - ///Marker type for the `value` field - pub struct value(()); ///Marker type for the `scope` field pub struct scope(()); - ///Marker type for the `last_updated_by` field - pub struct last_updated_by(()); + ///Marker type for the `created_by` field + pub struct created_by(()); ///Marker type for the `did` field pub struct did(()); + ///Marker type for the `value` field + pub struct value(()); } } @@ -397,12 +397,12 @@ where impl<'a, S> DefsOptionBuilder<'a, S> where S: defs_option_state::State, - S::CreatedBy: defs_option_state::IsSet, + S::LastUpdatedBy: defs_option_state::IsSet, S::Key: defs_option_state::IsSet, - S::Value: defs_option_state::IsSet, S::Scope: defs_option_state::IsSet, - S::LastUpdatedBy: defs_option_state::IsSet, + S::CreatedBy: defs_option_state::IsSet, S::Did: defs_option_state::IsSet, + S::Value: defs_option_state::IsSet, { /// Build the final struct pub fn build(self) -> DefsOption<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/setting/upsert_option.rs b/crates/jacquard-api/src/tools_ozone/setting/upsert_option.rs index 4da22d46..3b6e480b 100644 --- a/crates/jacquard-api/src/tools_ozone/setting/upsert_option.rs +++ b/crates/jacquard-api/src/tools_ozone/setting/upsert_option.rs @@ -41,51 +41,51 @@ pub mod upsert_option_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Key; type Scope; type Value; + type Key; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Key = Unset; type Scope = Unset; type Value = Unset; - } - ///State transition - sets the `key` field to Set - pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetKey<S> {} - impl<S: State> State for SetKey<S> { - type Key = Set<members::key>; - type Scope = S::Scope; - type Value = S::Value; + type Key = Unset; } ///State transition - sets the `scope` field to Set pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetScope<S> {} impl<S: State> State for SetScope<S> { - type Key = S::Key; type Scope = Set<members::scope>; type Value = S::Value; + type Key = S::Key; } ///State transition - sets the `value` field to Set pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetValue<S> {} impl<S: State> State for SetValue<S> { - type Key = S::Key; type Scope = S::Scope; type Value = Set<members::value>; + type Key = S::Key; + } + ///State transition - sets the `key` field to Set + pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetKey<S> {} + impl<S: State> State for SetKey<S> { + type Scope = S::Scope; + type Value = S::Value; + type Key = Set<members::key>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `key` field - pub struct key(()); ///Marker type for the `scope` field pub struct scope(()); ///Marker type for the `value` field pub struct value(()); + ///Marker type for the `key` field + pub struct key(()); } } @@ -218,9 +218,9 @@ where impl<'a, S> UpsertOptionBuilder<'a, S> where S: upsert_option_state::State, - S::Key: upsert_option_state::IsSet, S::Scope: upsert_option_state::IsSet, S::Value: upsert_option_state::IsSet, + S::Key: upsert_option_state::IsSet, { /// Build the final struct pub fn build(self) -> UpsertOption<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/team.rs b/crates/jacquard-api/src/tools_ozone/team.rs index 3f3adbd0..291edf50 100644 --- a/crates/jacquard-api/src/tools_ozone/team.rs +++ b/crates/jacquard-api/src/tools_ozone/team.rs @@ -50,37 +50,37 @@ pub mod member_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Role; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Role = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Role = S::Role; + type Did = Unset; } ///State transition - sets the `role` field to Set pub struct SetRole<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRole<S> {} impl<S: State> State for SetRole<S> { - type Did = S::Did; type Role = Set<members::role>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Role = S::Role; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `role` field pub struct role(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -247,8 +247,8 @@ impl<'a, S: member_state::State> MemberBuilder<'a, S> { impl<'a, S> MemberBuilder<'a, S> where S: member_state::State, - S::Did: member_state::IsSet, S::Role: member_state::IsSet, + S::Did: member_state::IsSet, { /// Build the final struct pub fn build(self) -> Member<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/team/add_member.rs b/crates/jacquard-api/src/tools_ozone/team/add_member.rs index e2de037c..94b3e758 100644 --- a/crates/jacquard-api/src/tools_ozone/team/add_member.rs +++ b/crates/jacquard-api/src/tools_ozone/team/add_member.rs @@ -33,37 +33,37 @@ pub mod add_member_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Did; type Role; + type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Did = Unset; type Role = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDid<S> {} - impl<S: State> State for SetDid<S> { - type Did = Set<members::did>; - type Role = S::Role; + type Did = Unset; } ///State transition - sets the `role` field to Set pub struct SetRole<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRole<S> {} impl<S: State> State for SetRole<S> { - type Did = S::Did; type Role = Set<members::role>; + type Did = S::Did; + } + ///State transition - sets the `did` field to Set + pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDid<S> {} + impl<S: State> State for SetDid<S> { + type Role = S::Role; + type Did = Set<members::did>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `did` field - pub struct did(()); ///Marker type for the `role` field pub struct role(()); + ///Marker type for the `did` field + pub struct did(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> AddMemberBuilder<'a, S> where S: add_member_state::State, - S::Did: add_member_state::IsSet, S::Role: add_member_state::IsSet, + S::Did: add_member_state::IsSet, { /// Build the final struct pub fn build(self) -> AddMember<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/verification.rs b/crates/jacquard-api/src/tools_ozone/verification.rs index 67439175..d012c6a2 100644 --- a/crates/jacquard-api/src/tools_ozone/verification.rs +++ b/crates/jacquard-api/src/tools_ozone/verification.rs @@ -77,9 +77,9 @@ pub mod verification_view_state { type DisplayName; type CreatedAt; type Issuer; - type Handle; - type Subject; type Uri; + type Subject; + type Handle; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -88,9 +88,9 @@ pub mod verification_view_state { type DisplayName = Unset; type CreatedAt = Unset; type Issuer = Unset; - type Handle = Unset; - type Subject = Unset; type Uri = Unset; + type Subject = Unset; + type Handle = Unset; } ///State transition - sets the `display_name` field to Set pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); @@ -99,9 +99,9 @@ pub mod verification_view_state { type DisplayName = Set<members::display_name>; type CreatedAt = S::CreatedAt; type Issuer = S::Issuer; - type Handle = S::Handle; - type Subject = S::Subject; type Uri = S::Uri; + type Subject = S::Subject; + type Handle = S::Handle; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); @@ -110,9 +110,9 @@ pub mod verification_view_state { type DisplayName = S::DisplayName; type CreatedAt = Set<members::created_at>; type Issuer = S::Issuer; - type Handle = S::Handle; - type Subject = S::Subject; type Uri = S::Uri; + type Subject = S::Subject; + type Handle = S::Handle; } ///State transition - sets the `issuer` field to Set pub struct SetIssuer<S: State = Empty>(PhantomData<fn() -> S>); @@ -121,20 +121,20 @@ pub mod verification_view_state { type DisplayName = S::DisplayName; type CreatedAt = S::CreatedAt; type Issuer = Set<members::issuer>; - type Handle = S::Handle; - type Subject = S::Subject; type Uri = S::Uri; + type Subject = S::Subject; + type Handle = S::Handle; } - ///State transition - sets the `handle` field to Set - pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetHandle<S> {} - impl<S: State> State for SetHandle<S> { + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { type DisplayName = S::DisplayName; type CreatedAt = S::CreatedAt; type Issuer = S::Issuer; - type Handle = Set<members::handle>; + type Uri = Set<members::uri>; type Subject = S::Subject; - type Uri = S::Uri; + type Handle = S::Handle; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); @@ -143,20 +143,20 @@ pub mod verification_view_state { type DisplayName = S::DisplayName; type CreatedAt = S::CreatedAt; type Issuer = S::Issuer; - type Handle = S::Handle; - type Subject = Set<members::subject>; type Uri = S::Uri; + type Subject = Set<members::subject>; + type Handle = S::Handle; } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { + ///State transition - sets the `handle` field to Set + pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetHandle<S> {} + impl<S: State> State for SetHandle<S> { type DisplayName = S::DisplayName; type CreatedAt = S::CreatedAt; type Issuer = S::Issuer; - type Handle = S::Handle; + type Uri = S::Uri; type Subject = S::Subject; - type Uri = Set<members::uri>; + type Handle = Set<members::handle>; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -167,12 +167,12 @@ pub mod verification_view_state { pub struct created_at(()); ///Marker type for the `issuer` field pub struct issuer(()); - ///Marker type for the `handle` field - pub struct handle(()); - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `subject` field + pub struct subject(()); + ///Marker type for the `handle` field + pub struct handle(()); } } @@ -482,9 +482,9 @@ where S::DisplayName: verification_view_state::IsSet, S::CreatedAt: verification_view_state::IsSet, S::Issuer: verification_view_state::IsSet, - S::Handle: verification_view_state::IsSet, - S::Subject: verification_view_state::IsSet, S::Uri: verification_view_state::IsSet, + S::Subject: verification_view_state::IsSet, + S::Handle: verification_view_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationView<'a> { diff --git a/crates/jacquard-api/src/tools_ozone/verification/grant_verifications.rs b/crates/jacquard-api/src/tools_ozone/verification/grant_verifications.rs index dd466c87..4da206d0 100644 --- a/crates/jacquard-api/src/tools_ozone/verification/grant_verifications.rs +++ b/crates/jacquard-api/src/tools_ozone/verification/grant_verifications.rs @@ -36,37 +36,37 @@ pub mod grant_error_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Subject; type Error; + type Subject; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Subject = Unset; type Error = Unset; - } - ///State transition - sets the `subject` field to Set - pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSubject<S> {} - impl<S: State> State for SetSubject<S> { - type Subject = Set<members::subject>; - type Error = S::Error; + type Subject = Unset; } ///State transition - sets the `error` field to Set pub struct SetError<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetError<S> {} impl<S: State> State for SetError<S> { - type Subject = S::Subject; type Error = Set<members::error>; + type Subject = S::Subject; + } + ///State transition - sets the `subject` field to Set + pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSubject<S> {} + impl<S: State> State for SetSubject<S> { + type Error = S::Error; + type Subject = Set<members::subject>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `subject` field - pub struct subject(()); ///Marker type for the `error` field pub struct error(()); + ///Marker type for the `subject` field + pub struct subject(()); } } @@ -139,8 +139,8 @@ where impl<'a, S> GrantErrorBuilder<'a, S> where S: grant_error_state::State, - S::Subject: grant_error_state::IsSet, S::Error: grant_error_state::IsSet, + S::Subject: grant_error_state::IsSet, { /// Build the final struct pub fn build(self) -> GrantError<'a> { @@ -640,51 +640,51 @@ pub mod verification_input_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type DisplayName; type Subject; type Handle; + type DisplayName; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type DisplayName = Unset; type Subject = Unset; type Handle = Unset; - } - ///State transition - sets the `display_name` field to Set - pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDisplayName<S> {} - impl<S: State> State for SetDisplayName<S> { - type DisplayName = Set<members::display_name>; - type Subject = S::Subject; - type Handle = S::Handle; + type DisplayName = Unset; } ///State transition - sets the `subject` field to Set pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSubject<S> {} impl<S: State> State for SetSubject<S> { - type DisplayName = S::DisplayName; type Subject = Set<members::subject>; type Handle = S::Handle; + type DisplayName = S::DisplayName; } ///State transition - sets the `handle` field to Set pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHandle<S> {} impl<S: State> State for SetHandle<S> { - type DisplayName = S::DisplayName; type Subject = S::Subject; type Handle = Set<members::handle>; + type DisplayName = S::DisplayName; + } + ///State transition - sets the `display_name` field to Set + pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDisplayName<S> {} + impl<S: State> State for SetDisplayName<S> { + type Subject = S::Subject; + type Handle = S::Handle; + type DisplayName = Set<members::display_name>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `display_name` field - pub struct display_name(()); ///Marker type for the `subject` field pub struct subject(()); ///Marker type for the `handle` field pub struct handle(()); + ///Marker type for the `display_name` field + pub struct display_name(()); } } @@ -797,9 +797,9 @@ where impl<'a, S> VerificationInputBuilder<'a, S> where S: verification_input_state::State, - S::DisplayName: verification_input_state::IsSet, S::Subject: verification_input_state::IsSet, S::Handle: verification_input_state::IsSet, + S::DisplayName: verification_input_state::IsSet, { /// Build the final struct pub fn build(self) -> VerificationInput<'a> { diff --git a/crates/jacquard-api/src/uk_skyblur/post.rs b/crates/jacquard-api/src/uk_skyblur/post.rs index ecf1ccee..7c98f74b 100644 --- a/crates/jacquard-api/src/uk_skyblur/post.rs +++ b/crates/jacquard-api/src/uk_skyblur/post.rs @@ -37,7 +37,7 @@ pub struct Post<'a> { pub text: jacquard_common::CowStr<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, - /// For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody. + /// For 'login', the post requires login to view (Bluesky account required). For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody. #[serde(borrow)] pub visibility: jacquard_common::CowStr<'a>, } @@ -54,8 +54,8 @@ pub mod post_state { pub trait State: sealed::Sealed { type CreatedAt; type Text; - type Uri; type Visibility; + type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -63,8 +63,8 @@ pub mod post_state { impl State for Empty { type CreatedAt = Unset; type Text = Unset; - type Uri = Unset; type Visibility = Unset; + type Uri = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); @@ -72,8 +72,8 @@ pub mod post_state { impl<S: State> State for SetCreatedAt<S> { type CreatedAt = Set<members::created_at>; type Text = S::Text; - type Uri = S::Uri; type Visibility = S::Visibility; + type Uri = S::Uri; } ///State transition - sets the `text` field to Set pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>); @@ -81,17 +81,8 @@ pub mod post_state { impl<S: State> State for SetText<S> { type CreatedAt = S::CreatedAt; type Text = Set<members::text>; - type Uri = S::Uri; - type Visibility = S::Visibility; - } - ///State transition - sets the `uri` field to Set - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetUri<S> {} - impl<S: State> State for SetUri<S> { - type CreatedAt = S::CreatedAt; - type Text = S::Text; - type Uri = Set<members::uri>; type Visibility = S::Visibility; + type Uri = S::Uri; } ///State transition - sets the `visibility` field to Set pub struct SetVisibility<S: State = Empty>(PhantomData<fn() -> S>); @@ -99,8 +90,17 @@ pub mod post_state { impl<S: State> State for SetVisibility<S> { type CreatedAt = S::CreatedAt; type Text = S::Text; - type Uri = S::Uri; type Visibility = Set<members::visibility>; + type Uri = S::Uri; + } + ///State transition - sets the `uri` field to Set + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetUri<S> {} + impl<S: State> State for SetUri<S> { + type CreatedAt = S::CreatedAt; + type Text = S::Text; + type Visibility = S::Visibility; + type Uri = Set<members::uri>; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -109,10 +109,10 @@ pub mod post_state { pub struct created_at(()); ///Marker type for the `text` field pub struct text(()); - ///Marker type for the `uri` field - pub struct uri(()); ///Marker type for the `visibility` field pub struct visibility(()); + ///Marker type for the `uri` field + pub struct uri(()); } } @@ -267,8 +267,8 @@ where S: post_state::State, S::CreatedAt: post_state::IsSet, S::Text: post_state::IsSet, - S::Uri: post_state::IsSet, S::Visibility: post_state::IsSet, + S::Uri: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { @@ -602,7 +602,7 @@ fn lexicon_doc_uk_skyblur_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<'sta ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( - "For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody.", + "For 'login', the post requires login to view (Bluesky account required). For 'password', the text only contains blurred text, and additional is always empty. The unblurred text and additional are included in the encryptBody.", ), ), format: None, diff --git a/crates/jacquard-api/src/uk_skyblur/post/decrypt_by_cid.rs b/crates/jacquard-api/src/uk_skyblur/post/decrypt_by_cid.rs index c2f1fc3a..f4103b62 100644 --- a/crates/jacquard-api/src/uk_skyblur/post/decrypt_by_cid.rs +++ b/crates/jacquard-api/src/uk_skyblur/post/decrypt_by_cid.rs @@ -38,66 +38,66 @@ pub mod decrypt_by_cid_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Pds; - type Password; type Cid; type Repo; + type Password; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Pds = Unset; - type Password = Unset; type Cid = Unset; type Repo = Unset; + type Password = Unset; } ///State transition - sets the `pds` field to Set pub struct SetPds<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetPds<S> {} impl<S: State> State for SetPds<S> { type Pds = Set<members::pds>; - type Password = S::Password; - type Cid = S::Cid; - type Repo = S::Repo; - } - ///State transition - sets the `password` field to Set - pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetPassword<S> {} - impl<S: State> State for SetPassword<S> { - type Pds = S::Pds; - type Password = Set<members::password>; type Cid = S::Cid; type Repo = S::Repo; + type Password = S::Password; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Pds = S::Pds; - type Password = S::Password; type Cid = Set<members::cid>; type Repo = S::Repo; + type Password = S::Password; } ///State transition - sets the `repo` field to Set pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRepo<S> {} impl<S: State> State for SetRepo<S> { type Pds = S::Pds; - type Password = S::Password; type Cid = S::Cid; type Repo = Set<members::repo>; + type Password = S::Password; + } + ///State transition - sets the `password` field to Set + pub struct SetPassword<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetPassword<S> {} + impl<S: State> State for SetPassword<S> { + type Pds = S::Pds; + type Cid = S::Cid; + type Repo = S::Repo; + type Password = Set<members::password>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `pds` field pub struct pds(()); - ///Marker type for the `password` field - pub struct password(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `repo` field pub struct repo(()); + ///Marker type for the `password` field + pub struct password(()); } } @@ -211,9 +211,9 @@ impl<'a, S> DecryptByCidBuilder<'a, S> where S: decrypt_by_cid_state::State, S::Pds: decrypt_by_cid_state::IsSet, - S::Password: decrypt_by_cid_state::IsSet, S::Cid: decrypt_by_cid_state::IsSet, S::Repo: decrypt_by_cid_state::IsSet, + S::Password: decrypt_by_cid_state::IsSet, { /// Build the final struct pub fn build(self) -> DecryptByCid<'a> { diff --git a/crates/jacquard-api/src/us_polhem/blog.rs b/crates/jacquard-api/src/us_polhem/blog.rs index 56cec713..bab45003 100644 --- a/crates/jacquard-api/src/us_polhem/blog.rs +++ b/crates/jacquard-api/src/us_polhem/blog.rs @@ -36,37 +36,37 @@ pub mod aspect_ratio_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Width; type Height; + type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Width = Unset; type Height = Unset; - } - ///State transition - sets the `width` field to Set - pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetWidth<S> {} - impl<S: State> State for SetWidth<S> { - type Width = Set<members::width>; - type Height = S::Height; + type Width = Unset; } ///State transition - sets the `height` field to Set pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeight<S> {} impl<S: State> State for SetHeight<S> { - type Width = S::Width; type Height = Set<members::height>; + type Width = S::Width; + } + ///State transition - sets the `width` field to Set + pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetWidth<S> {} + impl<S: State> State for SetWidth<S> { + type Height = S::Height; + type Width = Set<members::width>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `width` field - pub struct width(()); ///Marker type for the `height` field pub struct height(()); + ///Marker type for the `width` field + pub struct width(()); } } @@ -136,8 +136,8 @@ where impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, - S::Width: aspect_ratio_state::IsSet, S::Height: aspect_ratio_state::IsSet, + S::Width: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { diff --git a/crates/jacquard-api/src/us_polhem/blog/content.rs b/crates/jacquard-api/src/us_polhem/blog/content.rs index e3232d73..d566bda7 100644 --- a/crates/jacquard-api/src/us_polhem/blog/content.rs +++ b/crates/jacquard-api/src/us_polhem/blog/content.rs @@ -38,49 +38,49 @@ pub mod content_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Content; type Slug; + type Content; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Content = Unset; type Slug = Unset; + type Content = Unset; type CreatedAt = Unset; } - ///State transition - sets the `content` field to Set - pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetContent<S> {} - impl<S: State> State for SetContent<S> { - type Content = Set<members::content>; - type Slug = S::Slug; - type CreatedAt = S::CreatedAt; - } ///State transition - sets the `slug` field to Set pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSlug<S> {} impl<S: State> State for SetSlug<S> { - type Content = S::Content; type Slug = Set<members::slug>; + type Content = S::Content; + type CreatedAt = S::CreatedAt; + } + ///State transition - sets the `content` field to Set + pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetContent<S> {} + impl<S: State> State for SetContent<S> { + type Slug = S::Slug; + type Content = Set<members::content>; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Content = S::Content; type Slug = S::Slug; + type Content = S::Content; type CreatedAt = Set<members::created_at>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `content` field - pub struct content(()); ///Marker type for the `slug` field pub struct slug(()); + ///Marker type for the `content` field + pub struct content(()); ///Marker type for the `created_at` field pub struct created_at(()); } @@ -195,8 +195,8 @@ where impl<'a, S> ContentBuilder<'a, S> where S: content_state::State, - S::Content: content_state::IsSet, S::Slug: content_state::IsSet, + S::Content: content_state::IsSet, S::CreatedAt: content_state::IsSet, { /// Build the final struct diff --git a/crates/jacquard-api/src/us_polhem/blog/post.rs b/crates/jacquard-api/src/us_polhem/blog/post.rs index 37b87b66..23b2ec78 100644 --- a/crates/jacquard-api/src/us_polhem/blog/post.rs +++ b/crates/jacquard-api/src/us_polhem/blog/post.rs @@ -54,66 +54,66 @@ pub mod post_state { /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Slug; - type Title; type CreatedAt; type Content; + type Title; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Slug = Unset; - type Title = Unset; type CreatedAt = Unset; type Content = Unset; + type Title = Unset; } ///State transition - sets the `slug` field to Set pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSlug<S> {} impl<S: State> State for SetSlug<S> { type Slug = Set<members::slug>; - type Title = S::Title; - type CreatedAt = S::CreatedAt; - type Content = S::Content; - } - ///State transition - sets the `title` field to Set - pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTitle<S> {} - impl<S: State> State for SetTitle<S> { - type Slug = S::Slug; - type Title = Set<members::title>; type CreatedAt = S::CreatedAt; type Content = S::Content; + type Title = S::Title; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { type Slug = S::Slug; - type Title = S::Title; type CreatedAt = Set<members::created_at>; type Content = S::Content; + type Title = S::Title; } ///State transition - sets the `content` field to Set pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetContent<S> {} impl<S: State> State for SetContent<S> { type Slug = S::Slug; - type Title = S::Title; type CreatedAt = S::CreatedAt; type Content = Set<members::content>; + type Title = S::Title; + } + ///State transition - sets the `title` field to Set + pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTitle<S> {} + impl<S: State> State for SetTitle<S> { + type Slug = S::Slug; + type CreatedAt = S::CreatedAt; + type Content = S::Content; + type Title = Set<members::title>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `slug` field pub struct slug(()); - ///Marker type for the `title` field - pub struct title(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `content` field pub struct content(()); + ///Marker type for the `title` field + pub struct title(()); } } @@ -334,9 +334,9 @@ impl<'a, S> PostBuilder<'a, S> where S: post_state::State, S::Slug: post_state::IsSet, - S::Title: post_state::IsSet, S::CreatedAt: post_state::IsSet, S::Content: post_state::IsSet, + S::Title: post_state::IsSet, { /// Build the final struct pub fn build(self) -> Post<'a> { diff --git a/crates/jacquard-api/src/us_polhem/blog/tag.rs b/crates/jacquard-api/src/us_polhem/blog/tag.rs index 4ea8edc5..99ad2956 100644 --- a/crates/jacquard-api/src/us_polhem/blog/tag.rs +++ b/crates/jacquard-api/src/us_polhem/blog/tag.rs @@ -37,67 +37,67 @@ pub mod tag_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Slug; + type Description; type CreatedAt; type Name; - type Description; + type Slug; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Slug = Unset; + type Description = Unset; type CreatedAt = Unset; type Name = Unset; - type Description = Unset; + type Slug = Unset; } - ///State transition - sets the `slug` field to Set - pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetSlug<S> {} - impl<S: State> State for SetSlug<S> { - type Slug = Set<members::slug>; + ///State transition - sets the `description` field to Set + pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetDescription<S> {} + impl<S: State> State for SetDescription<S> { + type Description = Set<members::description>; type CreatedAt = S::CreatedAt; type Name = S::Name; - type Description = S::Description; + type Slug = S::Slug; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreatedAt<S> {} impl<S: State> State for SetCreatedAt<S> { - type Slug = S::Slug; + type Description = S::Description; type CreatedAt = Set<members::created_at>; type Name = S::Name; - type Description = S::Description; + type Slug = S::Slug; } ///State transition - sets the `name` field to Set pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetName<S> {} impl<S: State> State for SetName<S> { - type Slug = S::Slug; + type Description = S::Description; type CreatedAt = S::CreatedAt; type Name = Set<members::name>; - type Description = S::Description; - } - ///State transition - sets the `description` field to Set - pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetDescription<S> {} - impl<S: State> State for SetDescription<S> { type Slug = S::Slug; + } + ///State transition - sets the `slug` field to Set + pub struct SetSlug<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetSlug<S> {} + impl<S: State> State for SetSlug<S> { + type Description = S::Description; type CreatedAt = S::CreatedAt; type Name = S::Name; - type Description = Set<members::description>; + type Slug = Set<members::slug>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `slug` field - pub struct slug(()); + ///Marker type for the `description` field + pub struct description(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); - ///Marker type for the `description` field - pub struct description(()); + ///Marker type for the `slug` field + pub struct slug(()); } } @@ -210,10 +210,10 @@ where impl<'a, S> TagBuilder<'a, S> where S: tag_state::State, - S::Slug: tag_state::IsSet, + S::Description: tag_state::IsSet, S::CreatedAt: tag_state::IsSet, S::Name: tag_state::IsSet, - S::Description: tag_state::IsSet, + S::Slug: tag_state::IsSet, { /// Build the final struct pub fn build(self) -> Tag<'a> { diff --git a/crates/jacquard-api/src/win_tomo_x/pushat/push_notify.rs b/crates/jacquard-api/src/win_tomo_x/pushat/push_notify.rs index 74e21929..4af7fcb3 100644 --- a/crates/jacquard-api/src/win_tomo_x/pushat/push_notify.rs +++ b/crates/jacquard-api/src/win_tomo_x/pushat/push_notify.rs @@ -34,37 +34,37 @@ pub mod push_notify_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { - type Target; type Body; + type Target; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { - type Target = Unset; type Body = Unset; - } - ///State transition - sets the `target` field to Set - pub struct SetTarget<S: State = Empty>(PhantomData<fn() -> S>); - impl<S: State> sealed::Sealed for SetTarget<S> {} - impl<S: State> State for SetTarget<S> { - type Target = Set<members::target>; - type Body = S::Body; + type Target = Unset; } ///State transition - sets the `body` field to Set pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetBody<S> {} impl<S: State> State for SetBody<S> { - type Target = S::Target; type Body = Set<members::body>; + type Target = S::Target; + } + ///State transition - sets the `target` field to Set + pub struct SetTarget<S: State = Empty>(PhantomData<fn() -> S>); + impl<S: State> sealed::Sealed for SetTarget<S> {} + impl<S: State> State for SetTarget<S> { + type Body = S::Body; + type Target = Set<members::target>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { - ///Marker type for the `target` field - pub struct target(()); ///Marker type for the `body` field pub struct body(()); + ///Marker type for the `target` field + pub struct target(()); } } @@ -137,8 +137,8 @@ where impl<'a, S> PushNotifyBuilder<'a, S> where S: push_notify_state::State, - S::Target: push_notify_state::IsSet, S::Body: push_notify_state::IsSet, + S::Target: push_notify_state::IsSet, { /// Build the final struct pub fn build(self) -> PushNotify<'a> { diff --git a/crates/lazy-collections/Cargo.toml b/crates/lazy-collections/Cargo.toml new file mode 100644 index 00000000..fa4b532e --- /dev/null +++ b/crates/lazy-collections/Cargo.toml @@ -0,0 +1,84 @@ +[package] +name = "lazy-collections" +edition.workspace = true +version.workspace = true +authors.workspace = true +repository.workspace = true +keywords.workspace = true +categories.workspace = true +readme.workspace = true +exclude.workspace = true +homepage.workspace = true +license.workspace = true +description.workspace = true + +[features] +default = ["std", "tokio"] +std = [ + "alloc", + "serde/std", + "postcard/use-std", + "miette", + "chrono/std", + "chrono/clock", + "bytes/std", + "serde_bytes/std", + "embedded-io-async/std", + "embedded-io/std", + "dep:tokio", + "dep:n0-future", + "embedded-io-adapters/std", + "maitake-sync/std" +] +alloc = [ + "serde/alloc", + "serde_bytes/alloc", + "chrono/alloc", + "dep:bytes", + "embedded-io/alloc", + "embedded-io-async/alloc", + "postcard/alloc", + "maitake-sync/alloc", +] +tokio = [ + "embedded-io-adapters/tokio-1", +] + +[dependencies] + +serde.workspace = true +bytes = { workspace = true, optional = true } +chrono.workspace = true +serde_bytes.workspace = true +miette = { workspace = true, optional = true } +postcard = { version = "1.1.3", features = ["embedded-io-06"] } +embedded-io = { version = "0.6" } +embedded-io-async = { version = "0.6" } +embedded-io-adapters = { version = "0.6" } +maitake-sync = { version = "0.2", features = ["core-error"] } +tokio = { workspace = true, default-features = false, features = ["sync"], optional = true } +n0-future = { workspace = true, optional = true } +pin-project = "1" +heapless = "0.9" +managed = "0.8.0" +buffer = "0.1" +lock_api = "0.4" + +tracing = { git = "https://github.com/tokio-rs/tracing", default-features = false, features = ["attributes"] } + +[dev-dependencies] +proptest = "1" +tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", features = ["fmt", "env-filter"] } +tracing = { git = "https://github.com/tokio-rs/tracing", default-features = false, features = ["attributes", "std"] } + + +[target.'cfg(loom)'.dependencies] +loom = "0.7" + + +[target.'cfg(loom)'.dev-dependencies] +tracing_01 = { package = "tracing", version = "0.1.36" } +tracing-subscriber_03 = { package = "tracing-subscriber", version = "0.3.15", features = ["fmt", "env-filter"] } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)']} diff --git a/crates/lazy-collections/src/deferred.rs b/crates/lazy-collections/src/deferred.rs new file mode 100644 index 00000000..73bdf157 --- /dev/null +++ b/crates/lazy-collections/src/deferred.rs @@ -0,0 +1,53 @@ +//! Deferred closure execution (a.k.a. scope guards). +//! +//! See the [`Deferred`] type and the [`defer`] function for more information. + +/// Defers execution of a closure until a scope is exited. +/// +/// As seen in "The Go Programming Language". +#[must_use = "dropping a `Deferred` guard immediately executes \ + the deferred function"] +pub struct Deferred<F: FnOnce()>(Option<F>); + +impl<F: FnOnce()> Deferred<F> { + /// Defer execution of `f` until this scope is exited. + #[inline] + pub const fn new(f: F) -> Self { + Self(Some(f)) + } + + /// Cancel the deferred execution.of the closure passed to `defer`. + /// + /// Calling this method will prevent the closure from being executed when + /// this `Deferred` guard is dropped. + #[inline] + pub fn cancel(&mut self) { + self.0 = None; + } +} + +impl<F: FnOnce()> Drop for Deferred<F> { + #[inline] + fn drop(&mut self) { + if let Some(f) = self.0.take() { + f() + } + } +} + +impl<F: FnOnce()> core::fmt::Debug for Deferred<F> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_tuple("Deferred") + .field(&format_args!("{}", core::any::type_name::<F>())) + .finish() + } +} + +/// Defer execution of `f` until this scope is exited. +/// +/// This is equivalent to calling `Deferred::new(f)`. See [`Deferred`] for more +/// details. +#[inline(always)] +pub fn defer<F: FnOnce()>(f: F) -> Deferred<F> { + Deferred::new(f) +} diff --git a/crates/lazy-collections/src/io.rs b/crates/lazy-collections/src/io.rs new file mode 100644 index 00000000..d6691b5b --- /dev/null +++ b/crates/lazy-collections/src/io.rs @@ -0,0 +1,1180 @@ +//! A modified version of the Rust standard library's `std::io` module, suitable +//! for use in Mycelium and other kernels. +//! +//! The traits and functions here are mostly identical to (and copied from!) the +//! standard library's `std::io` module, with the following differences: +//! +//! - `Read::read_to_end` and `Read::read_to_string` require the "alloc" feature +//! flag on `mycelium_util` (which is enabled by default). Bootloaders & other +//! code which cannot allocate may disable this feature flag. +//! - `Read::read_vectored` and `Write::write_vectored` do not exist. +//! - Most of the `BufRead` utility functions (`lines`, `split`, `read_until`) +//! require the "alloc" feature +//! - `BufReader` and `BufWriter` require the "alloc" feature (and are not yet implemented). +//! - The `io::Error` type takes an `ErrorKind` and an optional `&'static str`, +//! and does not wrap another error. This is because we need to be able to +//! construct I/O errors even when we cannot allocate. +#[cfg(feature = "alloc")] +mod bufreader; +#[cfg(feature = "alloc")] +mod bufwriter; +mod cursor; +mod embedded; +mod error; +mod impls; +mod initializer; +pub mod prelude; +mod util; +pub use self::cursor::Cursor; +pub use self::error::{Error, ErrorKind, Result}; +pub use self::initializer::Initializer; +pub use self::util::{Empty, Repeat, Sink, copy, empty, repeat, sink}; +#[cfg(feature = "alloc")] +pub use bufreader::BufReader; +#[cfg(feature = "alloc")] +pub use bufwriter::BufWriter; +use core::{cmp, fmt, slice, str}; +pub use embedded::FromEmbed; + +#[cfg(feature = "std")] +mod std_io; +#[cfg(feature = "std")] +pub use std_io::ToStd; + +#[cfg(feature = "alloc")] +use crate::alloc::{string::String, vec::Vec}; +#[cfg(feature = "alloc")] +use crate::io::bufreader::BorrowedCursor; +const DEFAULT_BUF_SIZE: usize = 256; + +/// The `Read` trait allows for reading bytes from a source. +/// +/// Implementors of the `Read` trait are called 'readers'. +/// +/// Readers are defined by one required method, [`read()`]. Each call to [`read()`] +/// will attempt to pull bytes from this source into a provided buffer. A +/// number of other methods are implemented in terms of [`read()`], giving +/// implementors a number of ways to read bytes while only needing to implement +/// a single method. +/// +/// This is essentially a vendored version of the [`std::io::Read`] trait from +/// the Rust standard library, modified to work without `std`. See the +/// module-level docs for [`mycelium_util::io`] for more information on how +/// `mycelium_util`'s `io` module differs from `std`'s. +/// +/// [`read()`]: Self::read +/// [`mycelium_util::io`]: crate::io +pub trait Read { + /// Pull some bytes from this source into the specified buffer, returning + /// how many bytes were read. + /// + /// This function does not provide any guarantees about whether it blocks + /// waiting for data, but if an object needs to block for a read but cannot + /// it will typically signal this via an [`Err`] return value. + /// + /// If the return value of this method is [`Ok(n)`], then it must be + /// guaranteed that `0 <= n <= buf.len()`. A nonzero `n` value indicates + /// that the buffer `buf` has been filled in with `n` bytes of data from this + /// source. If `n` is `0`, then it can indicate one of two scenarios: + /// + /// 1. This reader has reached its "end of file" and will likely no longer + /// be able to produce bytes. Note that this does not mean that the + /// reader will *always* no longer be able to produce bytes. + /// 2. The buffer specified was 0 bytes in length. + /// + /// No guarantees are provided about the contents of `buf` when this + /// function is called, implementations cannot rely on any property of the + /// contents of `buf` being true. It is recommended that *implementations* + /// only write data to `buf` instead of reading its contents. + /// + /// Correspondingly, however, *callers* of this method may not assume any guarantees + /// about how the implementation uses `buf`. The trait is safe to implement, + /// so it is possible that the code that's supposed to write to the buffer might also read + /// from it. It is your responsibility to make sure that `buf` is initialized + /// before calling `read`. Calling `read` with an uninitialized `buf` (of the kind one + /// obtains via [`MaybeUninit<T>`]) is not safe, and can lead to undefined behavior. + /// + /// [`MaybeUninit<T>`]: ../mem/union.MaybeUninit.html + /// + /// # Errors + /// + /// If this function encounters any form of I/O or other error, an error + /// variant will be returned. If an error is returned then it must be + /// guaranteed that no bytes were read. + /// + /// An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the read + /// operation should be retried if there is nothing else to do. + fn read(&mut self, buf: &mut [u8]) -> Result<usize>; + + /// Determines if this `Read`er can work with buffers of uninitialized + /// memory. + /// + /// The default implementation returns an initializer which will zero + /// buffers. + /// + /// If a `Read`er guarantees that it can work properly with uninitialized + /// memory, it should call [`Initializer::nop()`]. See the documentation for + /// [`Initializer`] for details. + /// + /// The behavior of this method must be independent of the state of the + /// `Read`er - the method only takes `&self` so that it can be used through + /// trait objects. + /// + /// # Safety + /// + /// This method is unsafe because a `Read`er could otherwise return a + /// non-zeroing `Initializer` from another `Read` type without an `unsafe` + /// block. + /// + /// [`Initializer::nop()`]: struct.Initializer.html#method.nop + /// [`Initializer`]: struct.Initializer.html + #[inline] + unsafe fn initializer(&self) -> Initializer { + Initializer::zeroing() + } + + /// Read all bytes until EOF in this source, placing them into `buf`. + /// + /// All bytes read from this source will be appended to the specified buffer + /// `buf`. This function will continuously call [`read()`] to append more data to + /// `buf` until [`read()`] returns either [`Ok(0)`] or an error of + /// non-[`ErrorKind::Interrupted`] kind. + /// + /// If successful, this function will return the total number of bytes read. + /// + /// # Errors + /// + /// If this function encounters an error of the kind + /// [`ErrorKind::Interrupted`] then the error is ignored and the operation + /// will continue. + /// + /// If any other read error is encountered then this function immediately + /// returns. Any bytes which have already been read will be appended to + /// `buf`. + /// + /// [`read()`]: trait.Read.html#tymethod.read + /// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted + #[cfg(feature = "alloc")] + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + read_to_end(self, buf) + } + + #[cfg(feature = "alloc")] + fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()> { + default_read_buf(|b| self.read(b), buf) + } + + #[cfg(feature = "alloc")] + fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()> { + default_read_buf_exact(self, cursor) + } + + /// Read all bytes until EOF in this source, appending them to `buf`. + /// + /// If successful, this function returns the number of bytes which were read + /// and appended to `buf`. + /// + /// # Errors + /// + /// If the data in this stream is *not* valid UTF-8 then an error is + /// returned and `buf` is unchanged. + /// + /// See [`read_to_end`][readtoend] for other error semantics. + /// + /// [readtoend]: #method.read_to_end + #[cfg(feature = "alloc")] + fn read_to_string(&mut self, buf: &mut String) -> Result<usize> { + // Note that we do *not* call `.read_to_end()` here. We are passing + // `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end` + // method to fill it up. An arbitrary implementation could overwrite the + // entire contents of the vector, not just append to it (which is what + // we are expecting). + // + // To prevent extraneously checking the UTF-8-ness of the entire buffer + // we pass it to our hardcoded `read_to_end` implementation which we + // know is guaranteed to only read data into the end of the buffer. + append_to_string(buf, |b| read_to_end(self, b)) + } + + /// Read the exact number of bytes required to fill `buf`. + /// + /// This function reads as many bytes as necessary to completely fill the + /// specified buffer `buf`. + /// + /// No guarantees are provided about the contents of `buf` when this + /// function is called, implementations cannot rely on any property of the + /// contents of `buf` being true. It is recommended that implementations + /// only write data to `buf` instead of reading its contents. + /// + /// # Errors + /// + /// If this function encounters an error of the kind + /// [`ErrorKind::Interrupted`] then the error is ignored and the operation + /// will continue. + /// + /// If this function encounters an "end of file" before completely filling + /// the buffer, it returns an error of the kind [`ErrorKind::UnexpectedEof`]. + /// The contents of `buf` are unspecified in this case. + /// + /// If any other read error is encountered then this function immediately + /// returns. The contents of `buf` are unspecified in this case. + /// + /// If this function returns an error, it is unspecified how many bytes it + /// has read, but it will never read more than would be necessary to + /// completely fill the buffer. + /// + /// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted + /// [`ErrorKind::UnexpectedEof`]: enum.ErrorKind.html#variant.UnexpectedEof + fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> { + while !buf.is_empty() { + match self.read(buf) { + Ok(0) => break, + Ok(n) => { + let tmp = buf; + buf = &mut tmp[n..]; + } + Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) => return Err(e), + } + } + if !buf.is_empty() { + Err(Error::new( + ErrorKind::UnexpectedEof, + "failed to fill whole buffer".into(), + )) + } else { + Ok(()) + } + } + + /// Creates a "by reference" adaptor for this instance of `Read`. + /// + /// The returned adaptor also implements `Read` and will simply borrow this + /// current reader. + fn by_ref(&mut self) -> &mut Self + where + Self: Sized, + { + self + } + + /// Transforms this `Read` instance to an `Iterator` over its bytes. + /// + /// The returned type implements [`Iterator`] where the `Item` is + /// [`Result`]`<`[`u8`]`, `[`io::Error`]`>`. + /// The yielded item is [`Ok`] if a byte was successfully read and [`Err`] + /// otherwise. EOF is mapped to returning [`None`] from this iterator. + /// + /// [`Iterator`]: ../../std/iter/trait.Iterator.html + /// [`Result`]: ../../std/result/enum.Result.html + /// [`io::Error`]: ../../std/io/struct.Error.html + /// [`u8`]: ../../std/primitive.u8.html + /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok + /// [`Err`]: ../../std/result/enum.Result.html#variant.Err + /// [`None`]: ../../std/option/enum.Option.html#variant.None + fn bytes(self) -> Bytes<Self> + where + Self: Sized, + { + Bytes { inner: self } + } + + /// Creates an adaptor which will chain this stream with another. + /// + /// The returned `Read` instance will first read all bytes from this object + /// until EOF is encountered. Afterwards the output is equivalent to the + /// output of `next`. + /// + /// # Examples + /// + /// [`File`][file]s implement `Read`: + /// + /// [file]: ../fs/struct.File.html + /// + /// ```no_run + /// use std::io; + /// use std::io::prelude::*; + /// use std::fs::File; + /// + /// fn main() -> io::Result<()> { + /// let mut f1 = File::open("foo.txt")?; + /// let mut f2 = File::open("bar.txt")?; + /// + /// let mut handle = f1.chain(f2); + /// let mut buffer = String::new(); + /// + /// // read the value into a String. We could use any Read method here, + /// // this is just one example. + /// handle.read_to_string(&mut buffer)?; + /// Ok(()) + /// } + /// ``` + fn chain<R: Read>(self, next: R) -> Chain<Self, R> + where + Self: Sized, + { + Chain { + first: self, + second: next, + done_first: false, + } + } + + /// Creates an adaptor which will read at most `limit` bytes from it. + /// + /// This function returns a new instance of `Read` which will read at most + /// `limit` bytes, after which it will always return EOF ([`Ok(0)`]). Any + /// read errors will not count towards the number of bytes read and future + /// calls to [`read()`](Self::read) may succeed. + fn take(self, limit: u64) -> Take<Self> + where + Self: Sized, + { + Take { inner: self, limit } + } +} + +pub(crate) fn default_read_buf<F>(read: F, mut cursor: BorrowedCursor<'_>) -> Result<()> +where + F: FnOnce(&mut [u8]) -> Result<usize>, +{ + let n = read(cursor.ensure_init().init_mut())?; + cursor.advance(n); + Ok(()) +} + +pub(crate) fn default_read_buf_exact<R: Read + ?Sized>( + this: &mut R, + mut cursor: BorrowedCursor<'_>, +) -> Result<()> { + while cursor.capacity() > 0 { + let prev_written = cursor.written(); + match this.read_buf(cursor.reborrow()) { + Ok(()) => {} + Err(e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => return Err(e), + } + + if cursor.written() == prev_written { + return Err(Error::new( + ErrorKind::UnexpectedEof, + "failed to fill whole buffer".into(), + )); + } + } + + Ok(()) +} + +/// A trait for objects which are byte-oriented sinks. +/// +/// Implementors of the `Write` trait are sometimes called 'writers'. +/// +/// Writers are defined by two required methods, [`write`] and [`flush`]: +/// +/// * The [`write`] method will attempt to write some data into the object, +/// returning how many bytes were successfully written. +/// +/// * The [`flush`] method is useful for adapters and explicit buffers +/// themselves for ensuring that all buffered data has been pushed out to the +/// 'true sink'. +/// +/// This is essentially a vendored version of the [`std::io::Write`] trait from +/// the Rust standard library, modified to work without `std`. See the +/// module-level docs for [`mycelium_util::io`] for more information on how +/// `mycelium_util`'s `io` module differs from `std`'s. +/// +/// [`write`]: Write::write +/// [`flush`]: Write::flush +/// [`mycelium_util::io`]: crate::io +pub trait Write { + /// Write a buffer into this writer, returning how many bytes were written. + /// + /// This function will attempt to write the entire contents of `buf`, but + /// the entire write may not succeed, or the write may also generate an + /// error. A call to `write` represents *at most one* attempt to write to + /// any wrapped object. + /// + /// Calls to `write` are not guaranteed to block waiting for data to be + /// written, and a write which would otherwise block can be indicated through + /// an [`Err`] variant. + /// + /// If the return value is [`Ok(n)`] then it must be guaranteed that + /// `n <= buf.len()`. A return value of `0` typically means that the + /// underlying object is no longer able to accept bytes and will likely not + /// be able to in the future as well, or that the buffer provided is empty. + /// + /// # Errors + /// + /// Each call to `write` may generate an I/O error indicating that the + /// operation could not be completed. If an error is returned then no bytes + /// in the buffer were written to this writer. + /// + /// It is **not** considered an error if the entire buffer could not be + /// written to this writer. + /// + /// An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the + /// write operation should be retried if there is nothing else to do. + /// + /// [`Err`]: ../../std/result/enum.Result.html#variant.Err + /// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok + fn write(&mut self, buf: &[u8]) -> Result<usize>; + + /// Flush this output stream, ensuring that all intermediately buffered + /// contents reach their destination. + fn flush(&mut self) -> Result<()>; + + /// Attempts to write an entire buffer into this writer. + /// + /// This method will continuously call [`write`] until there is no more data + /// to be written or an error of non-[`ErrorKind::Interrupted`] kind is + /// returned. This method will not return until the entire buffer has been + /// successfully written or such an error occurs. The first error that is + /// not of [`ErrorKind::Interrupted`] kind generated from this method will be + /// returned. + /// + /// # Errors + /// + /// This function will return the first error of + /// non-[`ErrorKind::Interrupted`] kind that [`write`] returns. + /// + /// [`write`]: #tymethod.write + fn write_all(&mut self, mut buf: &[u8]) -> Result<()> { + while !buf.is_empty() { + match self.write(buf) { + Ok(0) => { + return Err(Error::new( + ErrorKind::WriteZero, + "failed to write whole buffer".into(), + )); + } + Ok(n) => buf = &buf[n..], + Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) => return Err(e), + } + } + Ok(()) + } + + /// Writes a formatted string into this writer, returning any error + /// encountered. + /// + /// This method is primarily used to interface with the + /// [`format_args!`][formatargs] macro, but it is rare that this should + /// explicitly be called. The [`write!`][write] macro should be favored to + /// invoke this method instead. + /// + /// [formatargs]: ../macro.format_args.html + /// [write]: ../macro.write.html + /// + /// This function internally uses the [`write_all`][writeall] method on + /// this trait and hence will continuously write data so long as no errors + /// are received. This also means that partial writes are not indicated in + /// this signature. + /// + /// [writeall]: #method.write_all + /// + /// # Errors + /// + /// This function will return any I/O error reported while formatting. + fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> { + let mut output = WriteFmtAdaptor::new(self); + match fmt::write(&mut output, fmt) { + Ok(()) => Ok(()), + Err(..) => { + // check if the error came from the underlying `Write` or not + if output.error.is_err() { + output.error + } else { + Err(Error::new(ErrorKind::Other, "formatter error".into())) + } + } + } + } + + /// Creates a "by reference" adaptor for this instance of `Write`. + /// + /// The returned adaptor also implements `Write` and will simply borrow this + /// current writer. + fn by_ref(&mut self) -> &mut Self + where + Self: Sized, + { + self + } +} + +/// The `Seek` trait provides a cursor which can be moved within a stream of +/// bytes. +/// +/// The stream typically has a fixed size, allowing seeking relative to either +/// end or the current offset. +pub trait Seek { + /// Seek to an offset, in bytes, in a stream. + /// + /// A seek beyond the end of a stream is allowed, but behavior is defined + /// by the implementation. + /// + /// If the seek operation completed successfully, + /// this method returns the new position from the start of the stream. + /// That position can be used later with [`SeekFrom::Start`]. + /// + /// # Errors + /// + /// Seeking to a negative offset is considered an error. + /// + /// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start + fn seek(&mut self, pos: SeekFrom) -> Result<u64>; + + /// Returns the length of this stream (in bytes). + /// + /// This method is implemented using up to three seek operations. If this + /// method returns successfully, the seek position is unchanged (i.e. the + /// position before calling this method is the same as afterwards). + /// However, if this method returns an error, the seek position is + /// unspecified. + /// + /// If you need to obtain the length of *many* streams and you don't care + /// about the seek position afterwards, you can reduce the number of seek + /// operations by simply calling `seek(SeekFrom::End(0))` and using its + /// return value (it is also the stream length). + /// + /// Note that length of a stream can change over time (for example, when + /// data is appended to a file). So calling this method multiple times does + /// not necessarily return the same length each time. + fn stream_len(&mut self) -> Result<u64> { + let old_pos = self.stream_position()?; + let len = self.seek(SeekFrom::End(0))?; + + // Avoid seeking a third time when we were already at the end of the + // stream. The branch is usually way cheaper than a seek operation. + if old_pos != len { + self.seek(SeekFrom::Start(old_pos))?; + } + + Ok(len) + } + + /// Returns the current seek position from the start of the stream. + /// + /// This is equivalent to `self.seek(SeekFrom::Current(0))`. + fn stream_position(&mut self) -> Result<u64> { + self.seek(SeekFrom::Current(0)) + } +} + +/// A `BufRead` is a type of `Read`er which has an internal buffer, allowing it +/// to perform extra ways of reading. +/// +/// For example, reading line-by-line is inefficient without using a buffer, so +/// if you want to read by line, you'll need `BufRead`, which includes a +/// [`read_line`] method as well as a [`lines`] iterator. +/// +/// [`BufReader`]: struct.BufReader.html +/// [`read_line`]: #method.read_line +/// [`lines`]: #method.lines +/// [`Read`]: trait.Read.html +pub trait BufRead: Read { + /// Returns the contents of the internal buffer, filling it with more data + /// from the inner reader if it is empty. + /// + /// This function is a lower-level call. It needs to be paired with the + /// [`consume`] method to function properly. When calling this + /// method, none of the contents will be "read" in the sense that later + /// calling `read` may return the same contents. As such, [`consume`] must + /// be called with the number of bytes that are consumed from this buffer to + /// ensure that the bytes are never returned twice. + /// + /// [`consume`]: Self::consume + /// + /// An empty buffer returned indicates that the stream has reached EOF. + /// + /// # Errors + /// + /// This function will return an I/O error if the underlying reader was + /// read, but returned an error. + fn fill_buf(&mut self) -> Result<&[u8]>; + + /// Tells this buffer that `amt` bytes have been consumed from the buffer, + /// so they should no longer be returned in calls to `read`. + /// + /// This function is a lower-level call. It needs to be paired with the + /// [`fill_buf`] method to function properly. This function does + /// not perform any I/O, it simply informs this object that some amount of + /// its buffer, returned from [`fill_buf`], has been consumed and should + /// no longer be returned. As such, this function may do odd things if + /// [`fill_buf`] isn't called before calling it. + /// + /// The `amt` must be `<=` the number of bytes in the buffer returned by + /// [`fill_buf`]. + /// + /// [`fill_buf`]: Self::fill_buf + fn consume(&mut self, amt: usize); + + /// Read all bytes into `buf` until the delimiter `byte` or EOF is reached. + /// + /// This function will read bytes from the underlying stream until the + /// delimiter or EOF is found. Once found, all bytes up to, and including, + /// the delimiter (if found) will be appended to `buf`. + /// + /// If successful, this function will return the total number of bytes read. + /// + /// # Errors + /// + /// This function will ignore all instances of [`ErrorKind::Interrupted`] and + /// will otherwise return any errors returned by [`fill_buf`]. + /// + /// If an I/O error is encountered then all bytes read so far will be + /// present in `buf` and its length will have been adjusted appropriately. + /// + /// [`fill_buf`]: Self::fill_buf + #[cfg(feature = "alloc")] + fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> { + read_until(self, byte, buf) + } + + /// Read all bytes until a newline (the 0xA byte) is reached, and append + /// them to the provided buffer. + /// + /// This function will read bytes from the underlying stream until the + /// newline delimiter (the 0xA byte) or EOF is found. Once found, all bytes + /// up to, and including, the delimiter (if found) will be appended to + /// `buf`. + /// + /// If successful, this function will return the total number of bytes read. + /// + /// If this function returns `Ok(0)`, the stream has reached EOF. + /// + /// # Errors + /// + /// This function has the same error semantics as [`read_until`] and will + /// also return an error if the read bytes are not valid UTF-8. If an I/O + /// error is encountered then `buf` may contain some bytes already read in + /// the event that all data read so far was valid UTF-8. + /// + /// [`read_until`]: Self::read_until + #[cfg(feature = "alloc")] + fn read_line(&mut self, buf: &mut String) -> Result<usize> { + // Note that we are not calling the `.read_until` method here, but + // rather our hardcoded implementation. For more details as to why, see + // the comments in `read_to_end`. + append_to_string(buf, |b| read_until(self, b'\n', b)) + } + + /// Returns an iterator over the contents of this reader split on the byte + /// `byte`. + /// + /// The iterator returned from this function will return instances of + /// [`io::Result`]`<`[`Vec<u8>`]`>`. Each vector returned will *not* have + /// the delimiter byte at the end. + /// + /// This function will yield errors whenever [`read_until`] would have + /// also yielded an error. + /// + /// [`io::Result`]: type.Result.html + /// [`Vec<u8>`]: ...alloc/vec/struct.Vec.html + /// [`read_until`]: #method.read_until + #[cfg(feature = "alloc")] + fn split(self, byte: u8) -> Split<Self> + where + Self: Sized, + { + Split { + buf: self, + delim: byte, + } + } + + /// Returns an iterator over the lines of this reader. + /// + /// The iterator returned from this function will yield instances of + /// [`io::Result`]`<`[`String`]`>`. Each string returned will *not* have a newline + /// byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end. + /// + /// [`io::Result`]: type.Result.html + /// [`String`]: ../string/struct.String.html + /// + /// # Errors + /// + /// Each line of the iterator has the same error semantics as [`BufRead::read_line`]. + /// + /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line + #[cfg(feature = "alloc")] + fn lines(self) -> Lines<Self> + where + Self: Sized, + { + Lines { buf: self } + } +} + +/// Enumeration of possible methods to seek within an I/O object. +/// +/// It is used by the [`Seek`] trait. +/// +/// [`Seek`]: trait.Seek.html +#[derive(Copy, PartialEq, Eq, Clone, Debug)] +pub enum SeekFrom { + /// Sets the offset to the provided number of bytes. + Start(u64), + + /// Sets the offset to the size of this object plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + End(i64), + + /// Sets the offset to the current position plus the specified number of + /// bytes. + /// + /// It is possible to seek beyond the end of an object, but it's an error to + /// seek before byte 0. + Current(i64), +} + +/// Adaptor to chain together two readers. +/// +/// This struct is generally created by calling [`chain`] on a reader. +/// Please see the documentation of [`chain`] for more details. +/// +/// [`chain`]: trait.Read.html#method.chain +pub struct Chain<T, U> { + first: T, + second: U, + done_first: bool, +} + +impl<T, U> Chain<T, U> { + /// Consumes the `Chain`, returning the wrapped readers. + pub fn into_inner(self) -> (T, U) { + (self.first, self.second) + } + + /// Gets references to the underlying readers in this `Chain`. + pub fn get_ref(&self) -> (&T, &U) { + (&self.first, &self.second) + } + + /// Gets mutable references to the underlying readers in this `Chain`. + /// + /// Care should be taken to avoid modifying the internal I/O state of the + /// underlying readers as doing so may corrupt the internal state of this + /// `Chain`. + pub fn get_mut(&mut self) -> (&mut T, &mut U) { + (&mut self.first, &mut self.second) + } +} + +impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Chain") + .field("t", &self.first) + .field("u", &self.second) + .finish() + } +} + +impl<T: Read, U: Read> Read for Chain<T, U> { + fn read(&mut self, buf: &mut [u8]) -> Result<usize> { + if !self.done_first { + match self.first.read(buf)? { + 0 if !buf.is_empty() => self.done_first = true, + n => return Ok(n), + } + } + self.second.read(buf) + } +} + +impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> { + fn fill_buf(&mut self) -> Result<&[u8]> { + if !self.done_first { + match self.first.fill_buf()? { + &[] => self.done_first = true, + buf => return Ok(buf), + } + } + self.second.fill_buf() + } + + fn consume(&mut self, amt: usize) { + if !self.done_first { + self.first.consume(amt) + } else { + self.second.consume(amt) + } + } +} + +/// Reader adaptor which limits the bytes read from an underlying reader. +/// +/// This struct is generally created by calling [`take`] on a reader. +/// Please see the documentation of [`take`] for more details. +/// +/// [`take`]: trait.Read.html#method.take +#[derive(Debug)] +pub struct Take<T> { + inner: T, + limit: u64, +} + +impl<T> Take<T> { + /// Returns the number of bytes that can be read before this instance will + /// return EOF. + /// + /// # Note + /// + /// This instance may reach `EOF` after reading fewer bytes than indicated by + /// this method if the underlying [`Read`] instance reaches EOF. + /// + /// [`Read`]:trait.Read.html + pub fn limit(&self) -> u64 { + self.limit + } + + /// Sets the number of bytes that can be read before this instance will + /// return EOF. This is the same as constructing a new `Take` instance, so + /// the amount of bytes read and the previous limit value don't matter when + /// calling this method. + pub fn set_limit(&mut self, limit: u64) { + self.limit = limit; + } + + /// Consumes the `Take`, returning the wrapped reader. + pub fn into_inner(self) -> T { + self.inner + } + + /// Gets a reference to the underlying reader. + pub fn get_ref(&self) -> &T { + &self.inner + } + + /// Gets a mutable reference to the underlying reader. + /// + /// Care should be taken to avoid modifying the internal I/O state of the + /// underlying reader as doing so may corrupt the internal limit of this + /// `Take`. + pub fn get_mut(&mut self) -> &mut T { + &mut self.inner + } +} + +impl<T: Read> Read for Take<T> { + fn read(&mut self, buf: &mut [u8]) -> Result<usize> { + // Don't call into inner reader at all at EOF because it may still block + if self.limit == 0 { + return Ok(0); + } + + let max = cmp::min(buf.len() as u64, self.limit) as usize; + let n = self.inner.read(&mut buf[..max])?; + self.limit -= n as u64; + Ok(n) + } + + #[cfg(feature = "alloc")] + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { + // Pass in a reservation_size closure that respects the current value + // of limit for each read. If we hit the read limit, this prevents the + // final zero-byte read from allocating again. + read_to_end_with_reservation(self, buf, |self_| cmp::min(self_.limit, 32) as usize) + } +} + +impl<T: BufRead> BufRead for Take<T> { + fn fill_buf(&mut self) -> Result<&[u8]> { + // Don't call into inner reader at all at EOF because it may still block + if self.limit == 0 { + return Ok(&[]); + } + + let buf = self.inner.fill_buf()?; + let cap = cmp::min(buf.len() as u64, self.limit) as usize; + Ok(&buf[..cap]) + } + + fn consume(&mut self, amt: usize) { + // Don't let callers reset the limit by passing an overlarge value + let amt = cmp::min(amt as u64, self.limit) as usize; + self.limit -= amt as u64; + self.inner.consume(amt); + } +} + +/// An iterator over `u8` values of a reader. +/// +/// This struct is generally created by calling [`bytes`] on a reader. +/// Please see the documentation of [`bytes`] for more details. +/// +/// [`bytes`]: trait.Read.html#method.bytes +#[derive(Debug)] +pub struct Bytes<R> { + inner: R, +} + +impl<R: Read> Iterator for Bytes<R> { + type Item = Result<u8>; + + fn next(&mut self) -> Option<Result<u8>> { + let mut byte = 0; + loop { + return match self.inner.read(slice::from_mut(&mut byte)) { + Ok(0) => None, + Ok(..) => Some(Ok(byte)), + Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => Some(Err(e)), + }; + } + } +} + +/// An iterator over the contents of an instance of `BufRead` split on a +/// particular byte. +/// +/// This struct is generally created by calling [`split`] on a `BufRead`. +/// Please see the documentation of [`split`] for more details. +/// +/// [`split`]: trait.BufRead.html#method.split +#[cfg(feature = "alloc")] +#[derive(Debug)] +pub struct Split<B> { + buf: B, + delim: u8, +} + +#[cfg(feature = "alloc")] +impl<B: BufRead> Iterator for Split<B> { + type Item = Result<Vec<u8>>; + + fn next(&mut self) -> Option<Result<Vec<u8>>> { + let mut buf = Vec::new(); + match self.buf.read_until(self.delim, &mut buf) { + Ok(0) => None, + Ok(_n) => { + if buf[buf.len() - 1] == self.delim { + buf.pop(); + } + Some(Ok(buf)) + } + Err(e) => Some(Err(e)), + } + } +} + +/// An iterator over the lines of an instance of `BufRead`. +/// +/// This struct is generally created by calling [`lines`] on a `BufRead`. +/// Please see the documentation of [`lines`] for more details. +/// +/// [`lines`]: trait.BufRead.html#method.lines +#[cfg(feature = "alloc")] +#[derive(Debug)] +pub struct Lines<B> { + buf: B, +} + +#[cfg(feature = "alloc")] +impl<B: BufRead> Iterator for Lines<B> { + type Item = Result<String>; + + fn next(&mut self) -> Option<Result<String>> { + let mut buf = String::new(); + match self.buf.read_line(&mut buf) { + Ok(0) => None, + Ok(_n) => { + if buf.ends_with('\n') { + buf.pop(); + if buf.ends_with('\r') { + buf.pop(); + } + } + Some(Ok(buf)) + } + Err(e) => Some(Err(e)), + } + } +} + +// This uses an adaptive system to extend the vector when it fills. We want to +// avoid paying to allocate and zero a huge chunk of memory if the reader only +// has 4 bytes while still making large reads if the reader does have a ton +// of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every +// time is 4,500 times (!) slower than a default reservation size of 32 if the +// reader has a very small amount of data to return. +// +// Because we're extending the buffer with uninitialized data for trusted +// readers, we need to make sure to truncate that if any of this panics. +#[cfg(feature = "alloc")] +fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> { + read_to_end_with_reservation(r, buf, |_| 32) +} + +#[cfg(feature = "alloc")] +fn read_to_end_with_reservation<R, F>( + r: &mut R, + buf: &mut Vec<u8>, + mut reservation_size: F, +) -> Result<usize> +where + R: Read + ?Sized, + F: FnMut(&R) -> usize, +{ + let start_len = buf.len(); + let mut g = Guard { + len: buf.len(), + buf, + }; + let ret; + loop { + if g.len == g.buf.len() { + unsafe { + // FIXME(danielhenrymantilla): #42788 + // + // - This creates a (mut) reference to a slice of + // _uninitialized_ integers, which is **undefined behavior** + // + // - Only the standard library gets to soundly "ignore" this, + // based on its privileged knowledge of unstable rustc + // internals; + g.buf.reserve(reservation_size(r)); + let capacity = g.buf.capacity(); + g.buf.set_len(capacity); + r.initializer().initialize(&mut g.buf[g.len..]); + } + } + + match r.read(&mut g.buf[g.len..]) { + Ok(0) => { + ret = Ok(g.len - start_len); + break; + } + Ok(n) => g.len += n, + Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) => { + ret = Err(e); + break; + } + } + } + + ret +} + +#[cfg(feature = "alloc")] +struct Guard<'a> { + buf: &'a mut Vec<u8>, + len: usize, +} + +#[cfg(feature = "alloc")] +impl Drop for Guard<'_> { + fn drop(&mut self) { + unsafe { + self.buf.set_len(self.len); + } + } +} + +// A few methods below (read_to_string, read_line) will append data into a +// `String` buffer, but we need to be pretty careful when doing this. The +// implementation will just call `.as_mut_vec()` and then delegate to a +// byte-oriented reading method, but we must ensure that when returning we never +// leave `buf` in a state such that it contains invalid UTF-8 in its bounds. +// +// To this end, we use an RAII guard (to protect against panics) which updates +// the length of the string when it is dropped. This guard initially truncates +// the string to the prior length and only after we've validated that the +// new contents are valid UTF-8 do we allow it to set a longer length. +// +// The unsafety in this function is twofold: +// +// 1. We're looking at the raw bytes of `buf`, so we take on the burden of UTF-8 +// checks. +// 2. We're passing a raw buffer to the function `f`, and it is expected that +// the function only *appends* bytes to the buffer. We'll get undefined +// behavior if existing bytes are overwritten to have non-UTF-8 data. +#[cfg(feature = "alloc")] +fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize> +where + F: FnOnce(&mut Vec<u8>) -> Result<usize>, +{ + unsafe { + let mut g = Guard { + len: buf.len(), + buf: buf.as_mut_vec(), + }; + let ret = f(g.buf); + if str::from_utf8(&g.buf[g.len..]).is_err() { + ret.and_then(|_| { + Err(Error::new( + ErrorKind::InvalidData, + "stream did not contain valid UTF-8".into(), + )) + }) + } else { + g.len = g.buf.len(); + ret + } + } +} + +#[cfg(feature = "alloc")] +fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) -> Result<usize> { + let mut read = 0; + loop { + let (done, used) = { + let available = match r.fill_buf() { + Ok(n) => n, + Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => return Err(e), + }; + // This is intentionally simple. We may improve upon it in the future with a + // proper `memchr` implementation if it proves to be necessary. + match available.iter().position(|&c| c == delim) { + Some(i) => { + buf.extend_from_slice(&available[..=i]); + (true, i + 1) + } + None => { + buf.extend_from_slice(available); + (false, available.len()) + } + } + }; + r.consume(used); + read += used; + if done || used == 0 { + return Ok(read); + } + } +} + +// Create a shim which translates a Write to a fmt::Write and saves +// off I/O errors. instead of discarding them +pub(crate) struct WriteFmtAdaptor<'a, T: ?Sized + 'a> { + inner: &'a mut T, + error: Result<()>, +} + +impl<'a, T: ?Sized + 'a> WriteFmtAdaptor<'a, T> { + pub(crate) fn new(inner: &'a mut T) -> Self { + Self { + inner, + error: Ok(()), + } + } +} + +impl<T: Write + ?Sized> fmt::Write for WriteFmtAdaptor<'_, T> { + fn write_str(&mut self, s: &str) -> fmt::Result { + match self.inner.write_all(s.as_bytes()) { + Ok(()) => Ok(()), + Err(e) => { + self.error = Err(e); + Err(fmt::Error) + } + } + } +} diff --git a/crates/lazy-collections/src/io/bufreader.rs b/crates/lazy-collections/src/io/bufreader.rs new file mode 100644 index 00000000..45251e29 --- /dev/null +++ b/crates/lazy-collections/src/io/bufreader.rs @@ -0,0 +1,945 @@ +// Buffered reader types, pulling HEAVILY from the std library and tokio +// Single reader supporting sync and async traits + +use core::pin::Pin; + +pub use buffer::BorrowedCursor; +pub use buffer::Buffer; + +use crate::io::{self, BufRead, DEFAULT_BUF_SIZE, ErrorKind, Read, Seek, SeekFrom}; + +/// The `BufReader` struct adds buffering to any reader. +/// +/// It can be excessively inefficient to work directly with a [`AsyncRead`] +/// instance. A `BufReader` performs large, infrequent reads on the underlying +/// [`AsyncRead`] and maintains an in-memory buffer of the results. +/// +/// `BufReader` can improve the speed of programs that make *small* and +/// *repeated* read calls to the same file or network socket. It does not +/// help when reading very large amounts at once, or reading just one or a few +/// times. It also provides no advantage when reading from a source that is +/// already in memory, like a `Vec<u8>`. +/// +/// When the `BufReader` is dropped, the contents of its buffer will be +/// discarded. Creating multiple instances of a `BufReader` on the same +/// stream can cause data loss. +#[pin_project::pin_project] +pub struct BufReader<R: ?Sized> { + // for async buffered read ops + pub(super) seek_state: SeekState, + pub(super) buf: Buffer, + #[pin] + pub(super) inner: R, +} + +#[derive(Debug, Clone, Copy)] +pub(super) enum SeekState { + /// `start_seek` has not been called. + Init, + /// `start_seek` has been called, but `poll_complete` has not yet been called. + Start(SeekFrom), + /// Waiting for completion of the first `poll_complete` in the `n.checked_sub(remainder).is_none()` branch. + PendingOverflowed(i64), + /// Waiting for completion of `poll_complete`. + Pending, +} + +impl<R: Read> BufReader<R> { + /// Creates a new `BufReader` with a default buffer capacity. The default is currently 8 KB, + /// but may change in the future. + pub fn new(inner: R) -> Self { + Self::with_capacity(DEFAULT_BUF_SIZE, inner) + } + + /// Creates a new `BufReader` with the specified buffer capacity. + pub fn with_capacity(capacity: usize, inner: R) -> Self { + Self { + inner, + buf: Buffer::with_capacity(capacity), + seek_state: SeekState::Init, + } + } +} + +impl<R: ?Sized> BufReader<R> { + /// Gets a reference to the underlying reader. + /// + /// It is inadvisable to directly read from the underlying reader. + pub fn get_ref(&self) -> &R { + &self.inner + } + + /// Gets a mutable reference to the underlying reader. + /// + /// It is inadvisable to directly read from the underlying reader. + pub fn get_mut(&mut self) -> &mut R { + &mut self.inner + } + + /// Gets a pinned mutable reference to the underlying reader. + /// + /// It is inadvisable to directly read from the underlying reader. + pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut R> { + self.project().inner + } + + /// Returns a reference to the internally buffered data. + /// + /// Unlike `fill_buf`, this will not attempt to fill the buffer if it is empty. + pub fn buffer(&self) -> &[u8] { + &self.buf.buffer()[self.buf.pos()..self.buf.capacity()] + } + + /// Consumes this `BufReader`, returning the underlying reader. + /// + /// Note that any leftover data in the internal buffer is lost. + pub fn into_inner(self) -> R + where + R: Sized, + { + self.inner + } + + /// Invalidates all data in the internal buffer. + #[inline] + fn discard_buffer_pinned(self: Pin<&mut Self>) { + let me = self.project(); + me.buf.discard_buffer(); + } + + /// Invalidates all data in the internal buffer. + #[inline] + fn discard_buffer(&mut self) { + self.buf.discard_buffer(); + } + + pub fn capacity(&self) -> usize { + self.buf.capacity() + } +} + +impl<R: Read + ?Sized> BufReader<R> { + pub fn peek(&mut self, n: usize) -> io::Result<&[u8]> { + assert!(n <= self.capacity()); + while n > self.buf.buffer().len() { + if self.buf.pos() > 0 { + self.buf.backshift(); + } + let new = self.buf.read_more(&mut self.inner)?; + if new == 0 { + // end of file, no more bytes to read + return Ok(&self.buf.buffer()[..]); + } + debug_assert_eq!(self.buf.pos(), 0); + } + Ok(&self.buf.buffer()[..n]) + } +} + +impl<R: Read + ?Sized> Read for BufReader<R> { + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + // If we don't have any buffered data and we're doing a massive read + // (larger than our internal buffer), bypass our internal buffer + // entirely. + if self.buf.pos() == self.buf.filled() && buf.len() >= self.capacity() { + self.discard_buffer(); + return self.inner.read(buf); + } + let mut rem = self.fill_buf()?; + let nread = rem.read(buf)?; + self.consume(nread); + Ok(nread) + } + + fn read_exact(&mut self, mut buf: &mut [u8]) -> io::Result<()> { + if self + .buf + .consume_with(buf.len(), |claimed| buf.copy_from_slice(claimed)) + { + return Ok(()); + } + while !buf.is_empty() { + match self.read(buf) { + Ok(0) => break, + Ok(n) => { + buf = &mut buf[n..]; + } + Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) => return Err(e), + } + } + if !buf.is_empty() { + Err(io::Error::new( + io::ErrorKind::UnexpectedEof, + "failed to fill whole buffer".into(), + )) + } else { + Ok(()) + } + } +} + +impl<R: Read + ?Sized> BufRead for BufReader<R> { + fn fill_buf(&mut self) -> io::Result<&[u8]> { + self.buf.fill_buf(&mut self.inner) + } + + fn consume(&mut self, amt: usize) { + self.buf.consume(amt) + } +} + +impl<R: ?Sized + Seek> BufReader<R> { + /// Seeks relative to the current position. If the new position lies within the buffer, + /// the buffer will not be flushed, allowing for more efficient seeks. + /// This method does not return the location of the underlying reader, so the caller + /// must track this information themselves if it is required. + pub fn seek_relative(&mut self, offset: i64) -> io::Result<()> { + let pos = self.buf.pos() as u64; + if offset < 0 { + if let Some(_) = pos.checked_sub((-offset) as u64) { + self.buf.unconsume((-offset) as usize); + return Ok(()); + } + } else if let Some(new_pos) = pos.checked_add(offset as u64) { + if new_pos <= self.buf.filled() as u64 { + self.buf.consume(offset as usize); + return Ok(()); + } + } + + self.seek(SeekFrom::Current(offset)).map(drop) + } +} + +impl<R: ?Sized + Seek> Seek for BufReader<R> { + fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { + let result: u64; + if let SeekFrom::Current(n) = pos { + let remainder = (self.buf.filled() - self.buf.pos()) as i64; + // it should be safe to assume that remainder fits within an i64 as the alternative + // means we managed to allocate 8 exbibytes and that's absurd. + // But it's not out of the realm of possibility for some weird underlying reader to + // support seeking by i64::MIN so we need to handle underflow when subtracting + // remainder. + if let Some(offset) = n.checked_sub(remainder) { + result = self.inner.seek(SeekFrom::Current(offset))?; + } else { + // seek backwards by our remainder, and then by the offset + self.inner.seek(SeekFrom::Current(-remainder))?; + self.discard_buffer(); + result = self.inner.seek(SeekFrom::Current(n))?; + } + } else { + // Seeking with Start/End doesn't care about our buffer length. + result = self.inner.seek(pos)?; + } + self.discard_buffer(); + Ok(result) + } + + fn stream_position(&mut self) -> io::Result<u64> { + let remainder = (self.buf.filled() - self.buf.pos()) as u64; + self.inner.stream_position().map(|pos| { + pos.checked_sub(remainder).expect( + "overflow when subtracting remaining buffer size from inner stream position", + ) + }) + } +} + +mod buffer { + //! An encapsulation of `BufReader`'s buffer management logic. + //! + //! This module factors out the basic functionality of `BufReader` in order to protect two core + //! invariants: + //! * `filled` bytes of `buf` are always initialized + //! * `pos` is always <= `filled` + //! Since this module encapsulates the buffer management logic, we can ensure that the range + //! `pos..filled` is always a valid index into the initialized region of the buffer. This means + //! that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so + //! without encountering any runtime bounds checks. + + use crate::io::{self, Read}; + use core::mem::MaybeUninit; + use core::{cmp, fmt}; + + pub struct Buffer { + // The buffer. + buf: Box<[MaybeUninit<u8>]>, + // The current seek offset into `buf`, must always be <= `filled`. + pos: usize, + // Each call to `fill_buf` sets `filled` to indicate how many bytes at the start of `buf` are + // initialized with bytes from a read. + filled: usize, + // This is the max number of bytes returned across all `fill_buf` calls. We track this so that we + // can accurately tell `read_buf` how many bytes of buf are initialized, to bypass as much of its + // defensive initialization as possible. Note that while this often the same as `filled`, it + // doesn't need to be. Calls to `fill_buf` are not required to actually fill the buffer, and + // omitting this is a huge perf regression for `Read` impls that do not. + initialized: usize, + } + + impl Buffer { + #[inline] + pub fn with_capacity(capacity: usize) -> Self { + let buf = Box::new_uninit_slice(capacity); + Self { + buf, + pos: 0, + filled: 0, + initialized: 0, + } + } + + #[inline] + pub fn buffer(&self) -> &[u8] { + // SAFETY: self.pos and self.filled are valid, and self.filled >= self.pos, and + // that region is initialized because those are all invariants of this type. + unsafe { + self.buf + .get_unchecked(self.pos..self.filled) + .assume_init_ref() + } + } + + #[inline] + pub fn capacity(&self) -> usize { + self.buf.len() + } + + #[inline] + pub fn filled(&self) -> usize { + self.filled + } + + #[inline] + pub fn pos(&self) -> usize { + self.pos + } + + // This is only used by a test which asserts that the initialization-tracking is correct. + #[cfg(test)] + pub fn initialized(&self) -> usize { + self.initialized + } + + #[inline] + pub fn discard_buffer(&mut self) { + self.pos = 0; + self.filled = 0; + } + + #[inline] + pub fn consume(&mut self, amt: usize) { + self.pos = cmp::min(self.pos + amt, self.filled); + } + + /// If there are `amt` bytes available in the buffer, pass a slice containing those bytes to + /// `visitor` and return true. If there are not enough bytes available, return false. + #[inline] + pub fn consume_with<V>(&mut self, amt: usize, mut visitor: V) -> bool + where + V: FnMut(&[u8]), + { + if let Some(claimed) = self.buffer().get(..amt) { + visitor(claimed); + // If the indexing into self.buffer() succeeds, amt must be a valid increment. + self.pos += amt; + true + } else { + false + } + } + + #[inline] + pub fn unconsume(&mut self, amt: usize) { + self.pos = self.pos.saturating_sub(amt); + } + + /// Read more bytes into the buffer without discarding any of its contents + pub fn read_more(&mut self, mut reader: impl Read) -> io::Result<usize> { + let mut buf = ReadBuf::new(&mut unsafe { self.buf.assume_init_mut() }[self.filled..]); + let old_init = self.initialized - self.filled; + unsafe { + buf.assume_init(old_init); + } + reader.read_buf(buf.unfilled())?; + self.filled += buf.len(); + self.initialized += buf.init_len() - old_init; + Ok(buf.len()) + } + + /// Remove bytes that have already been read from the buffer. + pub fn backshift(&mut self) { + self.buf.copy_within(self.pos..self.filled, 0); + self.filled -= self.pos; + self.pos = 0; + } + + #[inline] + pub fn fill_buf(&mut self, mut reader: impl Read) -> io::Result<&[u8]> { + // If we've reached the end of our internal buffer then we need to fetch + // some more data from the reader. + // Branch using `>=` instead of the more correct `==` + // to tell the compiler that the pos..cap slice is always valid. + if self.pos >= self.filled { + debug_assert!(self.pos == self.filled); + + let mut buf = ReadBuf::new(unsafe { self.buf.assume_init_mut() }); + // SAFETY: `self.filled` bytes will always have been initialized. + unsafe { + buf.assume_init(self.initialized); + } + + let result = reader.read_buf(buf.unfilled()); + + self.pos = 0; + self.filled = buf.len(); + self.initialized = buf.init_len(); + + result?; + } + Ok(self.buffer()) + } + } + + // A wrapper around a byte buffer that is incrementally filled and initialized. + /// + /// This type is a sort of "double cursor". It tracks three regions in the + /// buffer: a region at the beginning of the buffer that has been logically + /// filled with data, a region that has been initialized at some point but not + /// yet logically filled, and a region at the end that may be uninitialized. + /// The filled region is guaranteed to be a subset of the initialized region. + /// + /// In summary, the contents of the buffer can be visualized as: + /// + /// ```not_rust + /// [ capacity ] + /// [ filled | unfilled ] + /// [ initialized | uninitialized ] + /// ``` + /// + /// It is undefined behavior to de-initialize any bytes from the uninitialized + /// region, since it is merely unknown whether this region is uninitialized or + /// not, and if part of it turns out to be initialized, it must stay initialized. + pub struct ReadBuf<'a> { + buf: &'a mut [MaybeUninit<u8>], + filled: usize, + initialized: usize, + } + + impl<'a> ReadBuf<'a> { + /// Creates a new `ReadBuf` from a fully initialized buffer. + #[inline] + pub fn new(buf: &'a mut [u8]) -> ReadBuf<'a> { + let initialized = buf.len(); + let buf = unsafe { slice_to_uninit_mut(buf) }; + ReadBuf { + buf, + filled: 0, + initialized, + } + } + + /// Creates a new `ReadBuf` from a buffer that may be uninitialized. + /// + /// The internal cursor will mark the entire buffer as uninitialized. If + /// the buffer is known to be partially initialized, then use `assume_init` + /// to move the internal cursor. + #[inline] + pub fn uninit(buf: &'a mut [MaybeUninit<u8>]) -> ReadBuf<'a> { + ReadBuf { + buf, + filled: 0, + initialized: 0, + } + } + + #[inline] + pub fn len(&self) -> usize { + self.filled + } + + /// Returns the length of the initialized part of the buffer. + #[inline] + pub fn init_len(&self) -> usize { + self.initialized + } + + /// Returns the total capacity of the buffer. + #[inline] + pub fn capacity(&self) -> usize { + self.buf.len() + } + + /// Returns a shared reference to the filled portion of the buffer. + #[inline] + pub fn filled(&self) -> &[u8] { + let slice = &self.buf[..self.filled]; + // safety: filled describes how far into the buffer that the + // user has filled with bytes, so it's been initialized. + unsafe { slice_assume_init(slice) } + } + + /// Returns a mutable reference to the filled portion of the buffer. + #[inline] + pub fn filled_mut(&mut self) -> &mut [u8] { + let slice = &mut self.buf[..self.filled]; + // safety: filled describes how far into the buffer that the + // user has filled with bytes, so it's been initialized. + unsafe { slice_assume_init_mut(slice) } + } + + /// Returns a new `ReadBuf` comprised of the unfilled section up to `n`. + #[inline] + pub fn take(&mut self, n: usize) -> ReadBuf<'_> { + let max = std::cmp::min(self.remaining(), n); + // Safety: We don't set any of the `unfilled_mut` with `MaybeUninit::uninit`. + unsafe { ReadBuf::uninit(&mut self.unfilled_mut()[..max]) } + } + + /// Returns a shared reference to the initialized portion of the buffer. + /// + /// This includes the filled portion. + #[inline] + pub fn initialized(&self) -> &[u8] { + let slice = &self.buf[..self.initialized]; + // safety: initialized describes how far into the buffer that the + // user has at some point initialized with bytes. + unsafe { slice_assume_init(slice) } + } + + /// Returns a mutable reference to the initialized portion of the buffer. + /// + /// This includes the filled portion. + #[inline] + pub fn initialized_mut(&mut self) -> &mut [u8] { + let slice = &mut self.buf[..self.initialized]; + // safety: initialized describes how far into the buffer that the + // user has at some point initialized with bytes. + unsafe { slice_assume_init_mut(slice) } + } + + /// Returns a mutable reference to the entire buffer, without ensuring that it has been fully + /// initialized. + /// + /// The elements between 0 and `self.filled().len()` are filled, and those between 0 and + /// `self.initialized().len()` are initialized (and so can be converted to a `&mut [u8]`). + /// + /// The caller of this method must ensure that these invariants are upheld. For example, if the + /// caller initializes some of the uninitialized section of the buffer, it must call + /// [`assume_init`](Self::assume_init) with the number of bytes initialized. + /// + /// # Safety + /// + /// The caller must not de-initialize portions of the buffer that have already been initialized. + /// This includes any bytes in the region marked as uninitialized by `ReadBuf`. + #[inline] + pub unsafe fn inner_mut(&mut self) -> &mut [MaybeUninit<u8>] { + self.buf + } + + /// Returns a mutable reference to the unfilled part of the buffer without ensuring that it has been fully + /// initialized. + /// + /// # Safety + /// + /// The caller must not de-initialize portions of the buffer that have already been initialized. + /// This includes any bytes in the region marked as uninitialized by `ReadBuf`. + #[inline] + pub unsafe fn unfilled_mut(&mut self) -> &mut [MaybeUninit<u8>] { + &mut self.buf[self.filled..] + } + + /// Returns a mutable reference to the unfilled part of the buffer, ensuring it is fully initialized. + /// + /// Since `ReadBuf` tracks the region of the buffer that has been initialized, this is effectively "free" after + /// the first use. + #[inline] + pub fn initialize_unfilled(&mut self) -> &mut [u8] { + self.initialize_unfilled_to(self.remaining()) + } + + /// Returns a mutable reference to the first `n` bytes of the unfilled part of the buffer, ensuring it is + /// fully initialized. + /// + /// # Panics + /// + /// Panics if `self.remaining()` is less than `n`. + #[inline] + #[track_caller] + pub fn initialize_unfilled_to(&mut self, n: usize) -> &mut [u8] { + assert!(self.remaining() >= n, "n overflows remaining"); + + // This can't overflow, otherwise the assert above would have failed. + let end = self.filled + n; + + if self.initialized < end { + unsafe { + self.buf[self.initialized..end] + .as_mut_ptr() + .write_bytes(0, end - self.initialized); + } + self.initialized = end; + } + + let slice = &mut self.buf[self.filled..end]; + // safety: just above, we checked that the end of the buf has + // been initialized to some value. + unsafe { slice_assume_init_mut(slice) } + } + + /// Returns a cursor over the unfilled part of the buffer. + #[inline] + pub fn unfilled<'this>(&'this mut self) -> BorrowedCursor<'this> { + BorrowedCursor { + // SAFETY: we never assign into `BorrowedCursor::buf`, so treating its + // lifetime covariantly is safe. + buf: unsafe { + core::mem::transmute::<&'this mut ReadBuf<'a>, &'this mut ReadBuf<'this>>(self) + }, + } + } + + /// Returns the number of bytes at the end of the slice that have not yet been filled. + #[inline] + pub fn remaining(&self) -> usize { + self.capacity() - self.filled + } + + /// Clears the buffer, resetting the filled region to empty. + /// + /// The number of initialized bytes is not changed, and the contents of the buffer are not modified. + #[inline] + pub fn clear(&mut self) { + self.filled = 0; + } + + /// Advances the size of the filled region of the buffer. + /// + /// The number of initialized bytes is not changed. + /// + /// # Panics + /// + /// Panics if the filled region of the buffer would become larger than the initialized region. + #[inline] + #[track_caller] + pub fn advance(&mut self, n: usize) { + let new = self.filled.checked_add(n).expect("filled overflow"); + self.set_filled(new); + } + + /// Sets the size of the filled region of the buffer. + /// + /// The number of initialized bytes is not changed. + /// + /// Note that this can be used to *shrink* the filled region of the buffer in addition to growing it (for + /// example, by a `AsyncRead` implementation that compresses data in-place). + /// + /// # Panics + /// + /// Panics if the filled region of the buffer would become larger than the initialized region. + #[inline] + #[track_caller] + pub fn set_filled(&mut self, n: usize) { + assert!( + n <= self.initialized, + "filled must not become larger than initialized" + ); + self.filled = n; + } + + /// Asserts that the first `n` unfilled bytes of the buffer are initialized. + /// + /// `ReadBuf` assumes that bytes are never de-initialized, so this method does nothing when called with fewer + /// bytes than are already known to be initialized. + /// + /// # Safety + /// + /// The caller must ensure that `n` unfilled bytes of the buffer have already been initialized. + #[inline] + pub unsafe fn assume_init(&mut self, n: usize) { + let new = self.filled + n; + if new > self.initialized { + self.initialized = new; + } + } + + /// Appends data to the buffer, advancing the written position and possibly also the initialized position. + /// + /// # Panics + /// + /// Panics if `self.remaining()` is less than `buf.len()`. + #[inline] + #[track_caller] + pub fn put_slice(&mut self, buf: &[u8]) { + assert!( + self.remaining() >= buf.len(), + "buf.len() must fit in remaining(); buf.len() = {}, remaining() = {}", + buf.len(), + self.remaining() + ); + + let amt = buf.len(); + // Cannot overflow, asserted above + let end = self.filled + amt; + + // Safety: the length is asserted above + unsafe { + self.buf[self.filled..end] + .as_mut_ptr() + .cast::<u8>() + .copy_from_nonoverlapping(buf.as_ptr(), amt); + } + + if self.initialized < end { + self.initialized = end; + } + self.filled = end; + } + } + + impl fmt::Debug for ReadBuf<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ReadBuf") + .field("filled", &self.filled) + .field("initialized", &self.initialized) + .field("capacity", &self.capacity()) + .finish() + } + } + + /// # Safety + /// + /// The caller must ensure that `slice` is fully initialized + /// and never writes uninitialized bytes to the returned slice. + unsafe fn slice_to_uninit_mut(slice: &mut [u8]) -> &mut [MaybeUninit<u8>] { + // SAFETY: `MaybeUninit<u8>` has the same memory layout as u8, and the caller + // promises to not write uninitialized bytes to the returned slice. + unsafe { &mut *(slice as *mut [u8] as *mut [MaybeUninit<u8>]) } + } + + /// # Safety + /// + /// The caller must ensure that `slice` is fully initialized. + // TODO: This could use `MaybeUninit::slice_assume_init` when it is stable. + unsafe fn slice_assume_init(slice: &[MaybeUninit<u8>]) -> &[u8] { + // SAFETY: `MaybeUninit<u8>` has the same memory layout as u8, and the caller + // promises that `slice` is fully initialized. + unsafe { &*(slice as *const [MaybeUninit<u8>] as *const [u8]) } + } + + /// # Safety + /// + /// The caller must ensure that `slice` is fully initialized. + // TODO: This could use `MaybeUninit::slice_assume_init_mut` when it is stable. + unsafe fn slice_assume_init_mut(slice: &mut [MaybeUninit<u8>]) -> &mut [u8] { + // SAFETY: `MaybeUninit<u8>` has the same memory layout as `u8`, and the caller + // promises that `slice` is fully initialized. + unsafe { &mut *(slice as *mut [MaybeUninit<u8>] as *mut [u8]) } + } + + #[derive(Debug)] + pub struct BorrowedCursor<'a> { + /// The underlying buffer. + // Safety invariant: we treat the type of buf as covariant in the lifetime of `BorrowedBuf` when + // we create a `BorrowedCursor`. This is only safe if we never replace `buf` by assigning into + // it, so don't do that! + buf: &'a mut ReadBuf<'a>, + } + + impl<'a> BorrowedCursor<'a> { + /// Reborrows this cursor by cloning it with a smaller lifetime. + /// + /// Since a cursor maintains unique access to its underlying buffer, the borrowed cursor is + /// not accessible while the new cursor exists. + #[inline] + pub fn reborrow<'this>(&'this mut self) -> BorrowedCursor<'this> { + BorrowedCursor { + // SAFETY: we never assign into `BorrowedCursor::buf`, so treating its + // lifetime covariantly is safe. + buf: unsafe { + core::mem::transmute::<&'this mut ReadBuf<'a>, &'this mut ReadBuf<'this>>( + self.buf, + ) + }, + } + } + + /// Returns the available space in the cursor. + #[inline] + pub fn capacity(&self) -> usize { + self.buf.capacity() - self.buf.filled + } + + /// Returns the number of bytes written to the `BorrowedBuf` this cursor was created from. + /// + /// In particular, the count returned is shared by all reborrows of the cursor. + #[inline] + pub fn written(&self) -> usize { + self.buf.filled + } + + /// Returns a mutable reference to the initialized portion of the cursor. + #[inline] + pub fn init_mut(&mut self) -> &mut [u8] { + // SAFETY: We only slice the initialized part of the buffer, which is always valid + unsafe { + let buf = self + .buf + .buf + .get_unchecked_mut(self.buf.filled..self.buf.initialized); + buf.assume_init_mut() + } + } + + /// Returns a mutable reference to the whole cursor. + /// + /// # Safety + /// + /// The caller must not uninitialize any bytes in the initialized portion of the cursor. + #[inline] + pub unsafe fn as_mut(&mut self) -> &mut [MaybeUninit<u8>] { + // SAFETY: always in bounds + unsafe { self.buf.buf.get_unchecked_mut(self.buf.filled..) } + } + + /// Advances the cursor by asserting that `n` bytes have been filled. + /// + /// After advancing, the `n` bytes are no longer accessible via the cursor and can only be + /// accessed via the underlying buffer. I.e., the buffer's filled portion grows by `n` elements + /// and its unfilled portion (and the capacity of this cursor) shrinks by `n` elements. + /// + /// If less than `n` bytes initialized (by the cursor's point of view), `set_init` should be + /// called first. + /// + /// # Panics + /// + /// Panics if there are less than `n` bytes initialized. + #[inline] + pub fn advance(&mut self, n: usize) -> &mut Self { + // The subtraction cannot underflow by invariant of this type. + assert!(n <= self.buf.initialized - self.buf.filled); + + self.buf.filled += n; + self + } + + /// Advances the cursor by asserting that `n` bytes have been filled. + /// + /// After advancing, the `n` bytes are no longer accessible via the cursor and can only be + /// accessed via the underlying buffer. I.e., the buffer's filled portion grows by `n` elements + /// and its unfilled portion (and the capacity of this cursor) shrinks by `n` elements. + /// + /// # Safety + /// + /// The caller must ensure that the first `n` bytes of the cursor have been properly + /// initialised. + #[inline] + pub unsafe fn advance_unchecked(&mut self, n: usize) -> &mut Self { + self.buf.filled += n; + self.buf.initialized = cmp::max(self.buf.initialized, self.buf.filled); + self + } + + /// Initializes all bytes in the cursor. + #[inline] + pub fn ensure_init(&mut self) -> &mut Self { + // SAFETY: always in bounds and we never uninitialize these bytes. + let uninit = unsafe { self.buf.buf.get_unchecked_mut(self.buf.initialized..) }; + + // SAFETY: 0 is a valid value for MaybeUninit<u8> and the length matches the allocation + // since it is comes from a slice reference. + unsafe { + core::ptr::write_bytes(uninit.as_mut_ptr(), 0, uninit.len()); + } + self.buf.initialized = self.buf.capacity(); + + self + } + + /// Asserts that the first `n` unfilled bytes of the cursor are initialized. + /// + /// `BorrowedBuf` assumes that bytes are never de-initialized, so this method does nothing when + /// called with fewer bytes than are already known to be initialized. + /// + /// # Safety + /// + /// The caller must ensure that the first `n` bytes of the buffer have already been initialized. + #[inline] + pub unsafe fn set_init(&mut self, n: usize) -> &mut Self { + self.buf.initialized = cmp::max(self.buf.initialized, self.buf.filled + n); + self + } + + /// Appends data to the cursor, advancing position within its buffer. + /// + /// # Panics + /// + /// Panics if `self.capacity()` is less than `buf.len()`. + #[inline] + pub fn append(&mut self, buf: &[u8]) { + assert!(self.capacity() >= buf.len()); + + // SAFETY: we do not de-initialize any of the elements of the slice + unsafe { + self.as_mut()[..buf.len()].write_copy_of_slice(buf); + } + + // SAFETY: We just added the entire contents of buf to the filled section. + unsafe { + self.set_init(buf.len()); + } + self.buf.filled += buf.len(); + } + + /// Runs the given closure with a `BorrowedBuf` containing the unfilled part + /// of the cursor. + /// + /// This enables inspecting what was written to the cursor. + /// + /// # Panics + /// + /// Panics if the `BorrowedBuf` given to the closure is replaced by another + /// one. + pub fn with_unfilled_buf<T>(&mut self, f: impl FnOnce(&mut ReadBuf<'_>) -> T) -> T { + let mut buf = ReadBuf::from(self.reborrow()); + let prev_ptr = buf.buf as *const _; + let res = f(&mut buf); + + // Check that the caller didn't replace the `BorrowedBuf`. + // This is necessary for the safety of the code below: if the check wasn't + // there, one could mark some bytes as initialized even though there aren't. + assert!(core::ptr::addr_eq(prev_ptr, buf.buf)); + + let filled = buf.filled; + let init = buf.initialized; + + // Update `init` and `filled` fields with what was written to the buffer. + // `self.buf.filled` was the starting length of the `BorrowedBuf`. + // + // SAFETY: These amounts of bytes were initialized/filled in the `BorrowedBuf`, + // and therefore they are initialized/filled in the cursor too, because the + // buffer wasn't replaced. + self.buf.initialized = self.buf.filled + init; + self.buf.filled += filled; + + res + } + } + + impl<'data> From<BorrowedCursor<'data>> for ReadBuf<'data> { + #[inline] + fn from(mut buf: BorrowedCursor<'data>) -> ReadBuf<'data> { + let initialized = buf.init_mut().len(); + ReadBuf { + // SAFETY: no initialized byte is ever uninitialized as per + // `BorrowedBuf`'s invariant + buf: unsafe { buf.buf.buf.get_unchecked_mut(buf.buf.filled..) }, + filled: 0, + initialized, + } + } + } +} diff --git a/crates/lazy-collections/src/io/bufwriter.rs b/crates/lazy-collections/src/io/bufwriter.rs new file mode 100644 index 00000000..331b1cfd --- /dev/null +++ b/crates/lazy-collections/src/io/bufwriter.rs @@ -0,0 +1,353 @@ +// Buffered writer types, pulling HEAVILY from the std library and tokio +// Single writer supporting sync and async traits + +use crate::io::{self, ErrorKind, SeekFrom, Write}; + +/// Wraps a writer and buffers its output. +/// +/// It can be excessively inefficient to work directly with something that +/// implements [`AsyncWrite`]. A `BufWriter` keeps an in-memory buffer of data and +/// writes it to an underlying writer in large, infrequent batches. +/// +/// `BufWriter` can improve the speed of programs that make *small* and +/// *repeated* write calls to the same file or network socket. It does not +/// help when writing very large amounts at once, or writing just one or a few +/// times. It also provides no advantage when writing to a destination that is +/// in memory, like a `Vec<u8>`. +/// +/// When the `BufWriter` is dropped, the contents of its buffer will be +/// discarded. Creating multiple instances of a `BufWriter` on the same +/// stream can cause data loss. If you need to write out the contents of its +/// buffer, you must manually call flush before the writer is dropped. +/// +/// [`AsyncWrite`]: AsyncWrite +/// [`flush`]: super::AsyncWriteExt::flush +/// +#[pin_project::pin_project] +pub struct BufWriter<W: ?Sized> { + pub(super) buf: Vec<u8>, + pub(super) written: usize, + pub(super) seek_state: SeekState, + // #30888: If the inner writer panics in a call to write, we don't want to + // write the buffered data a second time in BufWriter's destructor. This + // flag tells the Drop impl if it should skip the flush. + panicked: bool, + #[pin] + pub(super) inner: W, +} + +#[derive(Debug, Clone, Copy)] +pub(super) enum SeekState { + /// `start_seek` has not been called. + Init, + /// `start_seek` has been called, but `poll_complete` has not yet been called. + Start(SeekFrom), + /// Waiting for completion of the first `poll_complete` in the `n.checked_sub(remainder).is_none()` branch. + PendingOverflowed(i64), + /// Waiting for completion of `poll_complete`. + Pending, +} + +impl<W: ?Sized + Write> BufWriter<W> { + /// Send data in our local buffer into the inner writer, looping as + /// necessary until either it's all been sent or an error occurs. + /// + /// Because all the data in the buffer has been reported to our owner as + /// "successfully written" (by returning nonzero success values from + /// `write`), any 0-length writes from `inner` must be reported as i/o + /// errors from this method. + pub(crate) fn flush_buf(&mut self) -> io::Result<()> { + /// Helper struct to ensure the buffer is updated after all the writes + /// are complete. It tracks the number of written bytes and drains them + /// all from the front of the buffer when dropped. + struct BufGuard<'a> { + buffer: &'a mut Vec<u8>, + written: usize, + } + + impl<'a> BufGuard<'a> { + fn new(buffer: &'a mut Vec<u8>) -> Self { + Self { buffer, written: 0 } + } + + /// The unwritten part of the buffer + fn remaining(&self) -> &[u8] { + &self.buffer[self.written..] + } + + /// Flag some bytes as removed from the front of the buffer + fn consume(&mut self, amt: usize) { + self.written += amt; + } + + /// true if all of the bytes have been written + fn done(&self) -> bool { + self.written >= self.buffer.len() + } + } + + impl Drop for BufGuard<'_> { + fn drop(&mut self) { + if self.written > 0 { + self.buffer.drain(..self.written); + } + } + } + + let mut guard = BufGuard::new(&mut self.buf); + while !guard.done() { + self.panicked = true; + let r = self.inner.write(guard.remaining()); + self.panicked = false; + + match r { + Ok(0) => { + return Err(io::Error::new( + ErrorKind::WriteZero, + "failed to write the buffered data".into(), + )); + } + Ok(n) => guard.consume(n), + Err(ref e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) => return Err(e), + } + } + Ok(()) + } + + /// Buffer some data without flushing it, regardless of the size of the + /// data. Writes as much as possible without exceeding capacity. Returns + /// the number of bytes written. + pub(super) fn write_to_buf(&mut self, buf: &[u8]) -> usize { + let available = self.spare_capacity(); + let amt_to_buffer = available.min(buf.len()); + + // SAFETY: `amt_to_buffer` is <= buffer's spare capacity by construction. + unsafe { + self.write_to_buffer_unchecked(&buf[..amt_to_buffer]); + } + + amt_to_buffer + } + + /// Gets a reference to the underlying writer. + /// + /// # Examples + /// + /// ```no_run + /// use std::io::BufWriter; + /// use std::net::TcpStream; + /// + /// let mut buffer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap()); + /// + /// // we can use reference just like buffer + /// let reference = buffer.get_ref(); + /// ``` + pub fn get_ref(&self) -> &W { + &self.inner + } + + /// Gets a mutable reference to the underlying writer. + /// + /// It is inadvisable to directly write to the underlying writer. + /// + /// # Examples + /// + /// ```no_run + /// use std::io::BufWriter; + /// use std::net::TcpStream; + /// + /// let mut buffer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap()); + /// + /// // we can use reference just like buffer + /// let reference = buffer.get_mut(); + /// ``` + pub fn get_mut(&mut self) -> &mut W { + &mut self.inner + } + + /// Returns a reference to the internally buffered data. + /// + /// # Examples + /// + /// ```no_run + /// use std::io::BufWriter; + /// use std::net::TcpStream; + /// + /// let buf_writer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap()); + /// + /// // See how many bytes are currently buffered + /// let bytes_buffered = buf_writer.buffer().len(); + /// ``` + pub fn buffer(&self) -> &[u8] { + &self.buf + } + + /// Returns a mutable reference to the internal buffer. + /// + /// This can be used to write data directly into the buffer without triggering writers + /// to the underlying writer. + /// + /// That the buffer is a `Vec` is an implementation detail. + /// Callers should not modify the capacity as there currently is no public API to do so + /// and thus any capacity changes would be unexpected by the user. + pub(in crate::io) fn buffer_mut(&mut self) -> &mut Vec<u8> { + &mut self.buf + } + + /// Returns the number of bytes the internal buffer can hold without flushing. + /// + /// # Examples + /// + /// ```no_run + /// use std::io::BufWriter; + /// use std::net::TcpStream; + /// + /// let buf_writer = BufWriter::new(TcpStream::connect("127.0.0.1:34254").unwrap()); + /// + /// // Check the capacity of the inner buffer + /// let capacity = buf_writer.capacity(); + /// // Calculate how many bytes can be written without flushing + /// let without_flush = capacity - buf_writer.buffer().len(); + /// ``` + pub fn capacity(&self) -> usize { + self.buf.capacity() + } + + // Ensure this function does not get inlined into `write`, so that it + // remains inlineable and its common path remains as short as possible. + // If this function ends up being called frequently relative to `write`, + // it's likely a sign that the client is using an improperly sized buffer + // or their write patterns are somewhat pathological. + #[cold] + #[inline(never)] + fn write_cold(&mut self, buf: &[u8]) -> io::Result<usize> { + if buf.len() > self.spare_capacity() { + self.flush_buf()?; + } + + // Why not len > capacity? To avoid a needless trip through the buffer when the input + // exactly fills it. We'd just need to flush it to the underlying writer anyway. + if buf.len() >= self.buf.capacity() { + self.panicked = true; + let r = self.get_mut().write(buf); + self.panicked = false; + r + } else { + // Write to the buffer. In this case, we write to the buffer even if it fills it + // exactly. Doing otherwise would mean flushing the buffer, then writing this + // input to the inner writer, which in many cases would be a worse strategy. + + // SAFETY: There was either enough spare capacity already, or there wasn't and we + // flushed the buffer to ensure that there is. In the latter case, we know that there + // is because flushing ensured that our entire buffer is spare capacity, and we entered + // this block because the input buffer length is less than that capacity. In either + // case, it's safe to write the input buffer to our buffer. + unsafe { + self.write_to_buffer_unchecked(buf); + } + + Ok(buf.len()) + } + } + + // Ensure this function does not get inlined into `write_all`, so that it + // remains inlineable and its common path remains as short as possible. + // If this function ends up being called frequently relative to `write_all`, + // it's likely a sign that the client is using an improperly sized buffer + // or their write patterns are somewhat pathological. + #[cold] + #[inline(never)] + fn write_all_cold(&mut self, buf: &[u8]) -> io::Result<()> { + // Normally, `write_all` just calls `write` in a loop. We can do better + // by calling `self.get_mut().write_all()` directly, which avoids + // round trips through the buffer in the event of a series of partial + // writes in some circumstances. + + if buf.len() > self.spare_capacity() { + self.flush_buf()?; + } + + // Why not len > capacity? To avoid a needless trip through the buffer when the input + // exactly fills it. We'd just need to flush it to the underlying writer anyway. + if buf.len() >= self.buf.capacity() { + self.panicked = true; + let r = self.get_mut().write_all(buf); + self.panicked = false; + r + } else { + // Write to the buffer. In this case, we write to the buffer even if it fills it + // exactly. Doing otherwise would mean flushing the buffer, then writing this + // input to the inner writer, which in many cases would be a worse strategy. + + // SAFETY: There was either enough spare capacity already, or there wasn't and we + // flushed the buffer to ensure that there is. In the latter case, we know that there + // is because flushing ensured that our entire buffer is spare capacity, and we entered + // this block because the input buffer length is less than that capacity. In either + // case, it's safe to write the input buffer to our buffer. + unsafe { + self.write_to_buffer_unchecked(buf); + } + + Ok(()) + } + } + + // SAFETY: Requires `buf.len() <= self.buf.capacity() - self.buf.len()`, + // i.e., that input buffer length is less than or equal to spare capacity. + #[inline] + unsafe fn write_to_buffer_unchecked(&mut self, buf: &[u8]) { + debug_assert!(buf.len() <= self.spare_capacity()); + let old_len = self.buf.len(); + let buf_len = buf.len(); + let src = buf.as_ptr(); + unsafe { + let dst = self.buf.as_mut_ptr().add(old_len); + core::ptr::copy_nonoverlapping(src, dst, buf_len); + self.buf.set_len(old_len + buf_len); + } + } + + #[inline] + fn spare_capacity(&self) -> usize { + self.buf.capacity() - self.buf.len() + } +} + +impl<W: ?Sized + Write> Write for BufWriter<W> { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + // Use < instead of <= to avoid a needless trip through the buffer in some cases. + // See `write_cold` for details. + if buf.len() < self.spare_capacity() { + // SAFETY: safe by above conditional. + unsafe { + self.write_to_buffer_unchecked(buf); + } + + Ok(buf.len()) + } else { + self.write_cold(buf) + } + } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + // Use < instead of <= to avoid a needless trip through the buffer in some cases. + // See `write_all_cold` for details. + if buf.len() < self.spare_capacity() { + // SAFETY: safe by above conditional. + unsafe { + self.write_to_buffer_unchecked(buf); + } + + Ok(()) + } else { + self.write_all_cold(buf) + } + } + + fn flush(&mut self) -> io::Result<()> { + self.flush_buf().and_then(|()| self.get_mut().flush()) + } +} diff --git a/crates/lazy-collections/src/io/cursor.rs b/crates/lazy-collections/src/io/cursor.rs new file mode 100644 index 00000000..cb49e7ef --- /dev/null +++ b/crates/lazy-collections/src/io/cursor.rs @@ -0,0 +1,647 @@ +use crate::io::prelude::*; +use crate::io::{self, Error, ErrorKind, Initializer, SeekFrom}; + +use core::cmp; + +#[cfg(feature = "alloc")] +use core::convert::TryInto; + +#[cfg(feature = "alloc")] +use crate::alloc::{boxed::Box, vec::Vec}; + +/// A `Cursor` wraps an in-memory buffer and provides it with a +/// [`Seek`] implementation. +/// +/// `Cursor`s are used with in-memory buffers, anything implementing +/// `AsRef<[u8]>`, to allow them to implement [`Read`] and/or [`Write`], +/// allowing these buffers to be used anywhere you might use a reader or writer +/// that does actual I/O. +/// +/// The standard library implements some I/O traits on various types which +/// are commonly used as a buffer, like `Cursor<`[`Vec`]`<u8>>` and +/// `Cursor<`[`&[u8]`][bytes]`>`. +/// +/// [`Seek`]: trait.Seek.html +/// [`Read`]: trait.Read.html +/// [`Write`]: trait.Write.html +/// [`Vec`]: ../../alloc/vec/struct.Vec.html +/// [bytes]: ../../core/primitive.slice.html +#[derive(Clone, Debug, Default)] +pub struct Cursor<T> { + inner: T, + pos: u64, +} + +impl<T> Cursor<T> { + /// Creates a new cursor wrapping the provided underlying in-memory buffer. + /// + /// Cursor initial position is `0` even if underlying buffer (e.g., `Vec`) + /// is not empty. So writing to cursor starts with overwriting `Vec` + /// content, not with appending to it. + pub fn new(inner: T) -> Cursor<T> { + Cursor { pos: 0, inner } + } + + /// Consumes this cursor, returning the underlying value. + pub fn into_inner(self) -> T { + self.inner + } + + /// Gets a reference to the underlying value in this cursor. + pub fn get_ref(&self) -> &T { + &self.inner + } + + /// Gets a mutable reference to the underlying value in this cursor. + /// + /// Care should be taken to avoid modifying the internal I/O state of the + /// underlying value as it may corrupt this cursor's position. + pub fn get_mut(&mut self) -> &mut T { + &mut self.inner + } + + /// Returns the current position of this cursor. + pub fn position(&self) -> u64 { + self.pos + } + + /// Sets the position of this cursor. + pub fn set_position(&mut self, pos: u64) { + self.pos = pos; + } +} + +impl<T> io::Seek for Cursor<T> +where + T: AsRef<[u8]>, +{ + fn seek(&mut self, style: SeekFrom) -> io::Result<u64> { + let (base_pos, offset) = match style { + SeekFrom::Start(n) => { + self.pos = n; + return Ok(n); + } + SeekFrom::End(n) => (self.inner.as_ref().len() as u64, n), + SeekFrom::Current(n) => (self.pos, n), + }; + let new_pos = if offset >= 0 { + base_pos.checked_add(offset as u64) + } else { + base_pos.checked_sub((offset.wrapping_neg()) as u64) + }; + match new_pos { + Some(n) => { + self.pos = n; + Ok(self.pos) + } + None => Err(Error::new( + ErrorKind::InvalidInput, + "invalid seek to a negative or overflowing position".into(), + )), + } + } + + fn stream_len(&mut self) -> io::Result<u64> { + Ok(self.inner.as_ref().len() as u64) + } + + fn stream_position(&mut self) -> io::Result<u64> { + Ok(self.pos) + } +} + +impl<T> Read for Cursor<T> +where + T: AsRef<[u8]>, +{ + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + let n = Read::read(&mut self.fill_buf()?, buf)?; + self.pos += n as u64; + Ok(n) + } + + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + let n = buf.len(); + Read::read_exact(&mut self.fill_buf()?, buf)?; + self.pos += n as u64; + Ok(()) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { Initializer::nop() } + } +} + +impl<T> BufRead for Cursor<T> +where + T: AsRef<[u8]>, +{ + fn fill_buf(&mut self) -> io::Result<&[u8]> { + let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64); + Ok(&self.inner.as_ref()[(amt as usize)..]) + } + fn consume(&mut self, amt: usize) { + self.pos += amt as u64; + } +} + +// Non-resizing write implementation +#[inline] +fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result<usize> { + let pos = cmp::min(*pos_mut, slice.len() as u64); + let amt = (&mut slice[(pos as usize)..]).write(buf)?; + *pos_mut += amt as u64; + Ok(amt) +} + +// Resizing write implementation +#[cfg(feature = "alloc")] +fn vec_write(pos_mut: &mut u64, vec: &mut Vec<u8>, buf: &[u8]) -> io::Result<usize> { + let pos: usize = (*pos_mut).try_into().map_err(|_| { + Error::new( + ErrorKind::InvalidInput, + "cursor position exceeds maximum possible vector length".into(), + ) + })?; + // Make sure the internal buffer is as least as big as where we + // currently are + let len = vec.len(); + if len < pos { + // use `resize` so that the zero filling is as efficient as possible + vec.resize(pos, 0); + } + // Figure out what bytes will be used to overwrite what's currently + // there (left), and what will be appended on the end (right) + { + let space = vec.len() - pos; + let (left, right) = buf.split_at(cmp::min(space, buf.len())); + vec[pos..pos + left.len()].copy_from_slice(left); + vec.extend_from_slice(right); + } + + // Bump us forward + *pos_mut = (pos + buf.len()) as u64; + Ok(buf.len()) +} + +impl Write for Cursor<&mut [u8]> { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + slice_write(&mut self.pos, self.inner, buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +#[cfg(feature = "alloc")] +impl Write for Cursor<&mut Vec<u8>> { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + vec_write(&mut self.pos, self.inner, buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +#[cfg(feature = "alloc")] +impl Write for Cursor<Vec<u8>> { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + vec_write(&mut self.pos, &mut self.inner, buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +#[cfg(feature = "alloc")] +impl Write for Cursor<Box<[u8]>> { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + slice_write(&mut self.pos, &mut self.inner, buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +#[cfg(all(test, not(loom)))] +mod tests { + #[cfg(feature = "alloc")] + use crate::alloc::{vec, vec::Vec}; + use crate::io::prelude::*; + use crate::io::{Cursor, SeekFrom}; + + #[test] + #[cfg(feature = "alloc")] + fn test_vec_writer() { + let mut writer = Vec::new(); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer, b); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_mem_writer() { + let mut writer = Cursor::new(Vec::new()); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(&writer.get_ref()[..], b); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_mem_mut_writer() { + let mut vec = Vec::new(); + let mut writer = Cursor::new(&mut vec); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(&writer.get_ref()[..], b); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_box_slice_writer() { + let mut writer = Cursor::new(vec![0u8; 9].into_boxed_slice()); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write(&[8, 9]).unwrap(), 1); + assert_eq!(writer.write(&[10]).unwrap(), 0); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(&**writer.get_ref(), b); + } + + #[test] + fn test_buf_writer() { + let mut buf = [0u8; 9]; + { + let mut writer = Cursor::new(&mut buf[..]); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write(&[8, 9]).unwrap(), 1); + assert_eq!(writer.write(&[10]).unwrap(), 0); + } + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(buf, b); + } + + #[test] + fn test_buf_writer_seek() { + let mut buf = [0u8; 8]; + { + let mut writer = Cursor::new(&mut buf[..]); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write(&[1]).unwrap(), 1); + assert_eq!(writer.position(), 1); + + assert_eq!(writer.seek(SeekFrom::Start(2)).unwrap(), 2); + assert_eq!(writer.position(), 2); + assert_eq!(writer.write(&[2]).unwrap(), 1); + assert_eq!(writer.position(), 3); + + assert_eq!(writer.seek(SeekFrom::Current(-2)).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!(writer.write(&[3]).unwrap(), 1); + assert_eq!(writer.position(), 2); + + assert_eq!(writer.seek(SeekFrom::End(-1)).unwrap(), 7); + assert_eq!(writer.position(), 7); + assert_eq!(writer.write(&[4]).unwrap(), 1); + assert_eq!(writer.position(), 8); + } + let b: &[_] = &[1, 3, 2, 0, 0, 0, 0, 4]; + assert_eq!(buf, b); + } + + #[test] + fn test_buf_writer_error() { + let mut buf = [0u8; 2]; + let mut writer = Cursor::new(&mut buf[..]); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.write(&[0, 0]).unwrap(), 1); + assert_eq!(writer.write(&[0, 0]).unwrap(), 0); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_mem_reader() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); + let mut buf = []; + assert_eq!(reader.read(&mut buf).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!(reader.read(&mut buf).unwrap(), 1); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf = [0; 4]; + assert_eq!(reader.read(&mut buf).unwrap(), 4); + assert_eq!(reader.position(), 5); + let b: &[_] = &[1, 2, 3, 4]; + assert_eq!(buf, b); + assert_eq!(reader.read(&mut buf).unwrap(), 3); + let b: &[_] = &[5, 6, 7]; + assert_eq!(&buf[..3], b); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_boxed_slice_reader() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice()); + let mut buf = []; + assert_eq!(reader.read(&mut buf).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!(reader.read(&mut buf).unwrap(), 1); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf = [0; 4]; + assert_eq!(reader.read(&mut buf).unwrap(), 4); + assert_eq!(reader.position(), 5); + let b: &[_] = &[1, 2, 3, 4]; + assert_eq!(buf, b); + assert_eq!(reader.read(&mut buf).unwrap(), 3); + let b: &[_] = &[5, 6, 7]; + assert_eq!(&buf[..3], b); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + + #[test] + #[cfg(feature = "alloc")] + fn read_to_end() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); + let mut v = Vec::new(); + reader.read_to_end(&mut v).unwrap(); + assert_eq!(v, [0, 1, 2, 3, 4, 5, 6, 7]); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_slice_reader() { + let in_buf = [0, 1, 2, 3, 4, 5, 6, 7]; + let reader = &mut &in_buf[..]; + let mut buf = []; + assert_eq!(reader.read(&mut buf).unwrap(), 0); + let mut buf = [0]; + assert_eq!(reader.read(&mut buf).unwrap(), 1); + assert_eq!(reader.len(), 7); + let b: &[_] = &[0]; + assert_eq!(&buf[..], b); + let mut buf = [0; 4]; + assert_eq!(reader.read(&mut buf).unwrap(), 4); + assert_eq!(reader.len(), 3); + let b: &[_] = &[1, 2, 3, 4]; + assert_eq!(&buf[..], b); + assert_eq!(reader.read(&mut buf).unwrap(), 3); + let b: &[_] = &[5, 6, 7]; + assert_eq!(&buf[..3], b); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_read_exact() { + let in_buf = [0, 1, 2, 3, 4, 5, 6, 7]; + let reader = &mut &in_buf[..]; + let mut buf = []; + reader + .read_exact(&mut buf) + .expect("read_exact must succeed"); + let mut buf = [8]; + reader + .read_exact(&mut buf) + .expect("read_exact must succeed"); + assert_eq!(buf[0], 0); + assert_eq!(reader.len(), 7); + let mut buf = [0, 0, 0, 0, 0, 0, 0]; + reader + .read_exact(&mut buf) + .expect("read_exact must succeed"); + assert_eq!(buf, [1, 2, 3, 4, 5, 6, 7]); + assert_eq!(reader.len(), 0); + let mut buf = [0]; + reader + .read_exact(&mut buf) + .expect_err("read_exact on empty buffer must fail"); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_buf_reader() { + let in_buf = [0, 1, 2, 3, 4, 5, 6, 7]; + let mut reader = Cursor::new(&in_buf[..]); + let mut buf = []; + assert_eq!(reader.read(&mut buf).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!(reader.read(&mut buf).unwrap(), 1); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf = [0; 4]; + assert_eq!(reader.read(&mut buf).unwrap(), 4); + assert_eq!(reader.position(), 5); + let b: &[_] = &[1, 2, 3, 4]; + assert_eq!(buf, b); + assert_eq!(reader.read(&mut buf).unwrap(), 3); + let b: &[_] = &[5, 6, 7]; + assert_eq!(&buf[..3], b); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + + #[test] + fn seek_past_end() { + let buf = [0xff]; + let mut r = Cursor::new(&buf[..]); + assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10); + assert_eq!(r.read(&mut [0]).unwrap(), 0); + + let mut r = Cursor::new(vec![10]); + assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10); + assert_eq!(r.read(&mut [0]).unwrap(), 0); + + let mut buf = [0]; + let mut r = Cursor::new(&mut buf[..]); + assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10); + assert_eq!(r.write(&[3]).unwrap(), 0); + + #[cfg(feature = "alloc")] + { + let mut r = Cursor::new(vec![10].into_boxed_slice()); + assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10); + assert_eq!(r.write(&[3]).unwrap(), 0); + } + } + + #[test] + fn seek_past_i64() { + let buf = [0xff]; + let mut r = Cursor::new(&buf[..]); + assert_eq!(r.seek(SeekFrom::Start(6)).unwrap(), 6); + assert_eq!( + r.seek(SeekFrom::Current(0x7ffffffffffffff0)).unwrap(), + 0x7ffffffffffffff6 + ); + assert_eq!(r.seek(SeekFrom::Current(0x10)).unwrap(), 0x8000000000000006); + assert_eq!(r.seek(SeekFrom::Current(0)).unwrap(), 0x8000000000000006); + r.seek(SeekFrom::Current(0x7ffffffffffffffd)) + .expect_err("`seek` with big offset must fail"); + assert_eq!(r.seek(SeekFrom::Current(-0x8000000000000000)).unwrap(), 6); + + let mut r = Cursor::new(vec![10]); + assert_eq!(r.seek(SeekFrom::Start(6)).unwrap(), 6); + assert_eq!( + r.seek(SeekFrom::Current(0x7ffffffffffffff0)).unwrap(), + 0x7ffffffffffffff6 + ); + assert_eq!(r.seek(SeekFrom::Current(0x10)).unwrap(), 0x8000000000000006); + assert_eq!(r.seek(SeekFrom::Current(0)).unwrap(), 0x8000000000000006); + r.seek(SeekFrom::Current(0x7ffffffffffffffd)) + .expect_err("`seek` with big offset must fail"); + assert_eq!(r.seek(SeekFrom::Current(-0x8000000000000000)).unwrap(), 6); + + let mut buf = [0]; + let mut r = Cursor::new(&mut buf[..]); + assert_eq!(r.seek(SeekFrom::Start(6)).unwrap(), 6); + assert_eq!( + r.seek(SeekFrom::Current(0x7ffffffffffffff0)).unwrap(), + 0x7ffffffffffffff6 + ); + assert_eq!(r.seek(SeekFrom::Current(0x10)).unwrap(), 0x8000000000000006); + assert_eq!(r.seek(SeekFrom::Current(0)).unwrap(), 0x8000000000000006); + r.seek(SeekFrom::Current(0x7ffffffffffffffd)) + .expect_err("`seek` with big offset must fail"); + assert_eq!(r.seek(SeekFrom::Current(-0x8000000000000000)).unwrap(), 6); + + #[cfg(feature = "alloc")] + { + let mut r = Cursor::new(vec![10].into_boxed_slice()); + assert_eq!(r.seek(SeekFrom::Start(6)).unwrap(), 6); + assert_eq!( + r.seek(SeekFrom::Current(0x7ffffffffffffff0)).unwrap(), + 0x7ffffffffffffff6 + ); + assert_eq!(r.seek(SeekFrom::Current(0x10)).unwrap(), 0x8000000000000006); + assert_eq!(r.seek(SeekFrom::Current(0)).unwrap(), 0x8000000000000006); + r.seek(SeekFrom::Current(0x7ffffffffffffffd)) + .expect_err("`seek` with big offset must fail"); + assert_eq!(r.seek(SeekFrom::Current(-0x8000000000000000)).unwrap(), 6); + } + } + + #[test] + fn seek_before_0() { + let buf = [0xff]; + let mut r = Cursor::new(&buf[..]); + r.seek(SeekFrom::End(-2)) + .expect_err("`seek` before 0 must fail"); + + let mut r = Cursor::new(vec![10]); + r.seek(SeekFrom::End(-2)) + .expect_err("`seek` before 0 must fail"); + + let mut buf = [0]; + let mut r = Cursor::new(&mut buf[..]); + r.seek(SeekFrom::End(-2)) + .expect_err("`seek` before 0 must fail"); + + #[cfg(feature = "alloc")] + { + let mut r = Cursor::new(vec![10].into_boxed_slice()); + r.seek(SeekFrom::End(-2)) + .expect_err("`seek` before 0 must fail"); + } + } + + #[test] + #[cfg(feature = "alloc")] + fn test_seekable_mem_writer() { + let mut writer = Cursor::new(Vec::<u8>::new()); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write(&[0]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); + assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); + assert_eq!(writer.position(), 8); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(&writer.get_ref()[..], b); + + assert_eq!(writer.seek(SeekFrom::Start(0)).unwrap(), 0); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write(&[3, 4]).unwrap(), 2); + let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7]; + assert_eq!(&writer.get_ref()[..], b); + + assert_eq!(writer.seek(SeekFrom::Current(1)).unwrap(), 3); + assert_eq!(writer.write(&[0, 1]).unwrap(), 2); + let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7]; + assert_eq!(&writer.get_ref()[..], b); + + assert_eq!(writer.seek(SeekFrom::End(-1)).unwrap(), 7); + assert_eq!(writer.write(&[1, 2]).unwrap(), 2); + let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; + assert_eq!(&writer.get_ref()[..], b); + + assert_eq!(writer.seek(SeekFrom::End(1)).unwrap(), 10); + assert_eq!(writer.write(&[1]).unwrap(), 1); + let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1]; + assert_eq!(&writer.get_ref()[..], b); + } + + #[test] + #[cfg(feature = "alloc")] + fn vec_seek_past_end() { + let mut r = Cursor::new(Vec::new()); + assert_eq!(r.seek(SeekFrom::Start(10)).unwrap(), 10); + assert_eq!(r.write(&[3]).unwrap(), 1); + } + + #[test] + #[cfg(feature = "alloc")] + fn vec_seek_before_0() { + let mut r = Cursor::new(Vec::new()); + r.seek(SeekFrom::End(-2)) + .expect_err("`seek` before 0 must fail"); + } + + #[test] + #[cfg(target_pointer_width = "32")] + #[cfg(feature = "alloc")] + fn vec_seek_and_write_past_usize_max() { + let mut c = Cursor::new(Vec::new()); + c.set_position(<usize>::max_value() as u64 + 1); + assert!(c.write_all(&[1, 2, 3]).is_err()); + } +} diff --git a/crates/lazy-collections/src/io/embedded.rs b/crates/lazy-collections/src/io/embedded.rs new file mode 100644 index 00000000..ccf4065f --- /dev/null +++ b/crates/lazy-collections/src/io/embedded.rs @@ -0,0 +1,107 @@ +use embedded_io::{self, ErrorType, ReadExactError, WriteFmtError}; + +use crate::io::{ErrorKind, Read, Seek, SeekFrom, Write}; + +#[derive(Clone)] +pub struct FromEmbed<T: ?Sized> { + inner: T, +} + +impl<T> FromEmbed<T> { + /// Create a new adapter. + pub fn new(inner: T) -> Self { + Self { inner } + } + + /// Consume the adapter, returning the inner object. + pub fn into_inner(self) -> T { + self.inner + } +} + +impl<T: ?Sized> FromEmbed<T> { + /// Borrow the inner object. + pub fn inner(&self) -> &T { + &self.inner + } + + /// Mutably borrow the inner object. + pub fn inner_mut(&mut self) -> &mut T { + &mut self.inner + } +} + +impl embedded_io::Error for crate::io::Error { + fn kind(&self) -> embedded_io::ErrorKind { + self.kind().into() + } +} + +impl<T: ?Sized> ErrorType for FromEmbed<T> { + type Error = crate::io::Error; +} + +impl<T: Read + ?Sized> embedded_io::Read for FromEmbed<T> { + fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> { + Read::read(self.inner_mut(), buf) + } + + fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ReadExactError<Self::Error>> { + match Read::read_exact(self.inner_mut(), buf) { + Ok(()) => Ok(()), + Err(err) => { + if err.kind() == ErrorKind::UnexpectedEof { + Err(ReadExactError::UnexpectedEof) + } else { + Err(ReadExactError::Other(err)) + } + } + } + } +} + +impl<T: Write + ?Sized> embedded_io::Write for FromEmbed<T> { + fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> { + Write::write(self.inner_mut(), buf) + } + + fn flush(&mut self) -> Result<(), Self::Error> { + Write::flush(self.inner_mut()) + } + + fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> { + Write::write_all(self.inner_mut(), buf) + } + + fn write_fmt( + &mut self, + fmt: core::fmt::Arguments<'_>, + ) -> Result<(), embedded_io::WriteFmtError<Self::Error>> { + Write::write_fmt(self.inner_mut(), fmt).map_err(|e| WriteFmtError::Other(e)) + } +} + +impl From<embedded_io::SeekFrom> for SeekFrom { + fn from(from: embedded_io::SeekFrom) -> Self { + match from { + embedded_io::SeekFrom::Start(offset) => SeekFrom::Start(offset), + embedded_io::SeekFrom::End(offset) => SeekFrom::End(offset), + embedded_io::SeekFrom::Current(offset) => SeekFrom::Current(offset), + } + } +} + +impl<T: Seek + ?Sized> embedded_io::Seek for FromEmbed<T> { + fn seek(&mut self, pos: embedded_io::SeekFrom) -> Result<u64, Self::Error> { + Seek::seek(self.inner_mut(), pos.into()) + } + + fn rewind(&mut self) -> Result<(), Self::Error> { + self.seek(embedded_io::SeekFrom::Start(0))?; + Ok(()) + } + + fn stream_position(&mut self) -> Result<u64, Self::Error> { + Seek::stream_position(self.inner_mut()) + } +} diff --git a/crates/lazy-collections/src/io/error.rs b/crates/lazy-collections/src/io/error.rs new file mode 100644 index 00000000..a3bd8305 --- /dev/null +++ b/crates/lazy-collections/src/io/error.rs @@ -0,0 +1,306 @@ +use core::fmt; + +use crate::StringMsg; +/// A specialized [`Result`] type for I/O operations. +/// +/// This type is broadly used across [`mycelium_util::io`] for any operation which may +/// produce an error. +/// +/// This typedef is generally used to avoid writing out [`io::Error`] directly and +/// is otherwise a direct mapping to [`Result`]. +/// +/// While usual Rust style is to import types directly, aliases of [`Result`] +/// often are not, to make it easier to distinguish between them. [`Result`] is +/// generally assumed to be [`core::result::Result`][`Result`], and so users of this alias +/// will generally use `io::Result` instead of shadowing the [prelude]'s import +/// of [`core::result::Result`][`Result`]. +/// +/// [`mycelium_util::io`]: crate::io +/// [`io::Error`]: Error +/// [`Result`]: core::result::Result +/// [prelude]: core::prelude +pub type Result<T> = core::result::Result<T, self::Error>; + +/// The error type for I/O operations of the [`Read`], [`Write`], [`Seek`], and +/// associated traits. +/// +/// Errors mostly originate from the underlying OS, but custom instances of +/// `Error` can be created with crafted error messages and a particular value of +/// [`ErrorKind`]. +/// +/// [`Read`]: crate::io::Read +/// [`Write`]: crate::io::Write +/// [`Seek`]: crate::io::Seek +#[derive(Debug)] +pub struct Error<E: core::error::Error + 'static = StringMsg> { + kind: ErrorKind, + source: Option<E>, +} + +/// A list specifying general categories of I/O error. +/// +/// This list is intended to grow over time and it is not recommended to +/// exhaustively match against it. +/// +/// It is used with the [`io::Error`] type. +/// +/// [`io::Error`]: Error +/// +/// # Handling errors and matching on `ErrorKind` +/// +/// In application code, use `match` for the `ErrorKind` values you are +/// expecting; use `_` to match "all other errors". +/// +/// In comprehensive and thorough tests that want to verify that a test doesn't +/// return any known incorrect error kind, you may want to cut-and-paste the +/// current full list of errors from here into your test code, and then match +/// `_` as the correct case. This seems counterintuitive, but it will make your +/// tests more robust. In particular, if you want to verify that your code does +/// produce an unrecognized error kind, the robust solution is to check for all +/// the recognized error kinds and fail in those cases. +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +#[non_exhaustive] +pub enum ErrorKind { + /// An entity was not found, often a file. + NotFound, + /// The operation lacked the necessary privileges to complete. + PermissionDenied, + /// The connection was refused by the remote server. + ConnectionRefused, + /// The connection was reset by the remote server. + ConnectionReset, + /// The connection was aborted (terminated) by the remote server. + ConnectionAborted, + /// The network operation failed because it was not connected yet. + NotConnected, + /// A socket address could not be bound because the address is already in + /// use elsewhere. + AddrInUse, + /// A nonexistent interface was requested or the requested address was not + /// local. + AddrNotAvailable, + /// The operation failed because a pipe was closed. + BrokenPipe, + /// An entity already exists, often a file. + AlreadyExists, + /// The operation needs to block to complete, but the blocking operation was + /// requested to not occur. + WouldBlock, + /// A parameter was incorrect. + InvalidInput, + /// Data not valid for the operation were encountered. + /// + /// Unlike [`InvalidInput`], this typically means that the operation + /// parameters were valid, however the error was caused by malformed + /// input data. + /// + /// For example, a function that reads a file into a string will error with + /// `InvalidData` if the file's contents are not valid UTF-8. + /// + /// [`InvalidInput`]: #variant.InvalidInput + InvalidData, + /// The I/O operation's timeout expired, causing it to be canceled. + TimedOut, + /// An error returned when an operation could not be completed because a + /// call to [`write`] returned [`Ok(0)`]. + /// + /// This typically means that an operation could only succeed if it wrote a + /// particular number of bytes but only a smaller number of bytes could be + /// written. + /// + /// [`write`]: ../../std/io/trait.Write.html#tymethod.write + /// [`Ok(0)`]: ../../std/io/type.Result.html + WriteZero, + /// This operation was interrupted. + /// + /// Interrupted operations can typically be retried. + Interrupted, + /// Any I/O error not part of this list. + Other, + + /// An error returned when an operation could not be completed because an + /// "end of file" was reached prematurely. + /// + /// This typically means that an operation could only succeed if it read a + /// particular number of bytes but only a smaller number of bytes could be + /// read. + UnexpectedEof, +} + +impl<E: core::error::Error + 'static> Error<E> { + /// Returns a new I/O error with the provided [`ErrorKind`] and `source` + /// error. + #[must_use] + #[inline] + pub fn new(kind: ErrorKind, source: E) -> Self { + Self { + kind, + source: Some(source), + } + } + + /// Returns the [`ErrorKind`] of this error. + #[must_use] + #[inline] + pub fn kind(&self) -> ErrorKind { + self.kind + } +} + +impl From<ErrorKind> for Error { + fn from(kind: ErrorKind) -> Self { + Error { kind, source: None } + } +} + +impl<E: core::error::Error + 'static> core::error::Error for Error<E> { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + self.source + .as_ref() + .map(|e| e as &(dyn core::error::Error + 'static)) + } +} + +impl<E: core::error::Error + 'static> fmt::Display for Error<E> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if let Some(ref source) = self.source { + write!(f, "{}: {}", self.kind.as_str(), source) + } else { + f.write_str(self.kind.as_str()) + } + } +} + +impl ErrorKind { + pub(crate) fn as_str(self) -> &'static str { + match self { + ErrorKind::NotFound => "entity not found", + ErrorKind::PermissionDenied => "permission denied", + ErrorKind::ConnectionRefused => "connection refused", + ErrorKind::ConnectionReset => "connection reset", + ErrorKind::ConnectionAborted => "connection aborted", + ErrorKind::NotConnected => "not connected", + ErrorKind::AddrInUse => "address in use", + ErrorKind::AddrNotAvailable => "address not available", + ErrorKind::BrokenPipe => "broken pipe", + ErrorKind::AlreadyExists => "entity already exists", + ErrorKind::WouldBlock => "operation would block", + ErrorKind::InvalidInput => "invalid input parameter", + ErrorKind::InvalidData => "invalid data", + ErrorKind::TimedOut => "timed out", + ErrorKind::WriteZero => "write zero", + ErrorKind::Interrupted => "operation interrupted", + ErrorKind::Other => "other error", + ErrorKind::UnexpectedEof => "unexpected end of file", + } + } +} + +#[cfg(feature = "std")] +impl From<std::io::ErrorKind> for ErrorKind { + fn from(value: std::io::ErrorKind) -> Self { + match value { + std::io::ErrorKind::ConnectionRefused => ErrorKind::ConnectionRefused, + std::io::ErrorKind::ConnectionReset => ErrorKind::ConnectionReset, + std::io::ErrorKind::ConnectionAborted => ErrorKind::ConnectionAborted, + std::io::ErrorKind::NotConnected => ErrorKind::NotConnected, + std::io::ErrorKind::AddrInUse => ErrorKind::AddrInUse, + std::io::ErrorKind::AddrNotAvailable => ErrorKind::AddrNotAvailable, + std::io::ErrorKind::BrokenPipe => ErrorKind::BrokenPipe, + std::io::ErrorKind::AlreadyExists => ErrorKind::AlreadyExists, + std::io::ErrorKind::WouldBlock => ErrorKind::WouldBlock, + std::io::ErrorKind::InvalidInput => ErrorKind::InvalidInput, + std::io::ErrorKind::InvalidData => ErrorKind::InvalidData, + std::io::ErrorKind::TimedOut => ErrorKind::TimedOut, + std::io::ErrorKind::WriteZero => ErrorKind::WriteZero, + std::io::ErrorKind::Interrupted => ErrorKind::Interrupted, + std::io::ErrorKind::Other => ErrorKind::Other, + std::io::ErrorKind::UnexpectedEof => ErrorKind::UnexpectedEof, + _ => ErrorKind::Other, + } + } +} + +impl From<embedded_io::ErrorKind> for ErrorKind { + fn from(value: embedded_io::ErrorKind) -> Self { + match value { + embedded_io::ErrorKind::ConnectionRefused => ErrorKind::ConnectionRefused, + embedded_io::ErrorKind::ConnectionReset => ErrorKind::ConnectionReset, + embedded_io::ErrorKind::ConnectionAborted => ErrorKind::ConnectionAborted, + embedded_io::ErrorKind::NotConnected => ErrorKind::NotConnected, + embedded_io::ErrorKind::AddrInUse => ErrorKind::AddrInUse, + embedded_io::ErrorKind::AddrNotAvailable => ErrorKind::AddrNotAvailable, + embedded_io::ErrorKind::BrokenPipe => ErrorKind::BrokenPipe, + embedded_io::ErrorKind::AlreadyExists => ErrorKind::AlreadyExists, + embedded_io::ErrorKind::InvalidInput => ErrorKind::InvalidInput, + embedded_io::ErrorKind::InvalidData => ErrorKind::InvalidData, + embedded_io::ErrorKind::TimedOut => ErrorKind::TimedOut, + embedded_io::ErrorKind::WriteZero => ErrorKind::WriteZero, + embedded_io::ErrorKind::Interrupted => ErrorKind::Interrupted, + embedded_io::ErrorKind::Other => ErrorKind::Other, + embedded_io::ErrorKind::NotFound => ErrorKind::NotFound, + embedded_io::ErrorKind::PermissionDenied => ErrorKind::PermissionDenied, + embedded_io::ErrorKind::Unsupported => ErrorKind::Other, + embedded_io::ErrorKind::OutOfMemory => ErrorKind::Other, + _ => ErrorKind::Other, + } + } +} + +impl From<ErrorKind> for embedded_io::ErrorKind { + fn from(value: ErrorKind) -> Self { + match value { + ErrorKind::ConnectionRefused => embedded_io::ErrorKind::ConnectionRefused, + ErrorKind::ConnectionReset => embedded_io::ErrorKind::ConnectionReset, + ErrorKind::ConnectionAborted => embedded_io::ErrorKind::ConnectionAborted, + ErrorKind::NotConnected => embedded_io::ErrorKind::NotConnected, + ErrorKind::AddrInUse => embedded_io::ErrorKind::AddrInUse, + ErrorKind::AddrNotAvailable => embedded_io::ErrorKind::AddrNotAvailable, + ErrorKind::BrokenPipe => embedded_io::ErrorKind::BrokenPipe, + ErrorKind::AlreadyExists => embedded_io::ErrorKind::AlreadyExists, + ErrorKind::InvalidInput => embedded_io::ErrorKind::InvalidInput, + ErrorKind::InvalidData => embedded_io::ErrorKind::InvalidData, + ErrorKind::TimedOut => embedded_io::ErrorKind::TimedOut, + ErrorKind::WriteZero => embedded_io::ErrorKind::WriteZero, + ErrorKind::Interrupted => embedded_io::ErrorKind::Interrupted, + ErrorKind::Other => embedded_io::ErrorKind::Other, + ErrorKind::NotFound => embedded_io::ErrorKind::NotFound, + ErrorKind::PermissionDenied => embedded_io::ErrorKind::PermissionDenied, + ErrorKind::WouldBlock => embedded_io::ErrorKind::TimedOut, + ErrorKind::UnexpectedEof => embedded_io::ErrorKind::BrokenPipe, + } + } +} + +#[cfg(feature = "std")] +impl From<ErrorKind> for std::io::ErrorKind { + fn from(value: ErrorKind) -> Self { + match value { + ErrorKind::AlreadyExists => std::io::ErrorKind::AlreadyExists, + ErrorKind::InvalidInput => std::io::ErrorKind::InvalidInput, + ErrorKind::InvalidData => std::io::ErrorKind::InvalidData, + ErrorKind::TimedOut => std::io::ErrorKind::TimedOut, + ErrorKind::WriteZero => std::io::ErrorKind::WriteZero, + ErrorKind::Interrupted => std::io::ErrorKind::Interrupted, + ErrorKind::Other => std::io::ErrorKind::Other, + ErrorKind::NotFound => std::io::ErrorKind::NotFound, + ErrorKind::PermissionDenied => std::io::ErrorKind::PermissionDenied, + ErrorKind::WouldBlock => std::io::ErrorKind::WouldBlock, + ErrorKind::UnexpectedEof => std::io::ErrorKind::UnexpectedEof, + ErrorKind::BrokenPipe => std::io::ErrorKind::BrokenPipe, + ErrorKind::ConnectionReset => std::io::ErrorKind::ConnectionReset, + ErrorKind::ConnectionAborted => std::io::ErrorKind::ConnectionAborted, + ErrorKind::NotConnected => std::io::ErrorKind::NotConnected, + ErrorKind::ConnectionRefused => std::io::ErrorKind::ConnectionRefused, + ErrorKind::AddrInUse => std::io::ErrorKind::AddrInUse, + ErrorKind::AddrNotAvailable => std::io::ErrorKind::AddrNotAvailable, + } + } +} + +#[cfg(feature = "std")] +impl From<Error> for std::io::Error { + fn from(value: Error) -> Self { + std::io::Error::new(value.kind().into(), value) + } +} diff --git a/crates/lazy-collections/src/io/impls.rs b/crates/lazy-collections/src/io/impls.rs new file mode 100644 index 00000000..74946e60 --- /dev/null +++ b/crates/lazy-collections/src/io/impls.rs @@ -0,0 +1,305 @@ +use crate::io::{self, BufRead, Error, ErrorKind, Initializer, Read, Seek, SeekFrom, Write}; +use core::{cmp, fmt, mem}; + +#[cfg(feature = "alloc")] +use crate::alloc::{boxed::Box, string::String, vec::Vec}; + +// ============================================================================= +// Forwarding implementations +impl<R: Read + ?Sized> Read for &mut R { + #[inline] + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + (**self).read(buf) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { (**self).initializer() } + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { + (**self).read_to_end(buf) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { + (**self).read_to_string(buf) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + (**self).read_exact(buf) + } +} + +impl<W: Write + ?Sized> Write for &mut W { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + (**self).write(buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + (**self).flush() + } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + (**self).write_all(buf) + } + + #[inline] + fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> { + (**self).write_fmt(fmt) + } +} + +impl<S: Seek + ?Sized> Seek for &mut S { + #[inline] + fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { + (**self).seek(pos) + } +} + +impl<B: BufRead + ?Sized> BufRead for &mut B { + #[inline] + fn fill_buf(&mut self) -> io::Result<&[u8]> { + (**self).fill_buf() + } + + #[inline] + fn consume(&mut self, amt: usize) { + (**self).consume(amt) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> { + (**self).read_until(byte, buf) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_line(&mut self, buf: &mut String) -> io::Result<usize> { + (**self).read_line(buf) + } +} + +#[cfg(feature = "alloc")] +impl<R: Read + ?Sized> Read for Box<R> { + #[inline] + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + (**self).read(buf) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { (**self).initializer() } + } + + #[inline] + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { + (**self).read_to_end(buf) + } + + #[inline] + fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { + (**self).read_to_string(buf) + } + + #[inline] + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + (**self).read_exact(buf) + } +} + +#[cfg(feature = "alloc")] +impl<W: Write + ?Sized> Write for Box<W> { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + (**self).write(buf) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + (**self).flush() + } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + (**self).write_all(buf) + } + + #[inline] + fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> { + (**self).write_fmt(fmt) + } +} + +#[cfg(feature = "alloc")] +impl<S: Seek + ?Sized> Seek for Box<S> { + #[inline] + fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { + (**self).seek(pos) + } +} + +#[cfg(feature = "alloc")] +impl<B: BufRead + ?Sized> BufRead for Box<B> { + #[inline] + fn fill_buf(&mut self) -> io::Result<&[u8]> { + (**self).fill_buf() + } + + #[inline] + fn consume(&mut self, amt: usize) { + (**self).consume(amt) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> { + (**self).read_until(byte, buf) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_line(&mut self, buf: &mut String) -> io::Result<usize> { + (**self).read_line(buf) + } +} + +// ============================================================================= +// In-memory buffer implementations + +/// Read is implemented for `&[u8]` by copying from the slice. +/// +/// Note that reading updates the slice to point to the yet unread part. +/// The slice will be empty when EOF is reached. +impl Read for &[u8] { + #[inline] + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + let amt = cmp::min(buf.len(), self.len()); + let (a, b) = self.split_at(amt); + + // First check if the amount of bytes we want to read is small: + // `copy_from_slice` will generally expand to a call to `memcpy`, and + // for a single byte the overhead is significant. + if amt == 1 { + buf[0] = a[0]; + } else { + buf[..amt].copy_from_slice(a); + } + + *self = b; + Ok(amt) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { Initializer::nop() } + } + + #[inline] + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + if buf.len() > self.len() { + return Err(Error::new( + ErrorKind::UnexpectedEof, + "failed to fill whole buffer".into(), + )); + } + let (a, b) = self.split_at(buf.len()); + + // First check if the amount of bytes we want to read is small: + // `copy_from_slice` will generally expand to a call to `memcpy`, and + // for a single byte the overhead is significant. + if buf.len() == 1 { + buf[0] = a[0]; + } else { + buf.copy_from_slice(a); + } + + *self = b; + Ok(()) + } + + #[inline] + #[cfg(feature = "alloc")] + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { + buf.extend_from_slice(self); + let len = self.len(); + *self = &self[len..]; + Ok(len) + } +} + +impl BufRead for &[u8] { + #[inline] + fn fill_buf(&mut self) -> io::Result<&[u8]> { + Ok(*self) + } + + #[inline] + fn consume(&mut self, amt: usize) { + *self = &self[amt..]; + } +} + +/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting +/// its data. +/// +/// Note that writing updates the slice to point to the yet unwritten part. +/// The slice will be empty when it has been completely overwritten. +impl Write for &mut [u8] { + #[inline] + fn write(&mut self, data: &[u8]) -> io::Result<usize> { + let amt = cmp::min(data.len(), self.len()); + let (a, b) = mem::take(self).split_at_mut(amt); + a.copy_from_slice(&data[..amt]); + *self = b; + Ok(amt) + } + + #[inline] + fn write_all(&mut self, data: &[u8]) -> io::Result<()> { + if self.write(data)? == data.len() { + Ok(()) + } else { + Err(Error::new( + ErrorKind::WriteZero, + "failed to write whole buffer".into(), + )) + } + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +/// Write is implemented for `Vec<u8>` by appending to the vector. +/// The vector will grow as needed. +#[cfg(feature = "alloc")] +impl Write for Vec<u8> { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + self.extend_from_slice(buf); + Ok(buf.len()) + } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + self.extend_from_slice(buf); + Ok(()) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} diff --git a/crates/lazy-collections/src/io/initializer.rs b/crates/lazy-collections/src/io/initializer.rs new file mode 100644 index 00000000..7c86216c --- /dev/null +++ b/crates/lazy-collections/src/io/initializer.rs @@ -0,0 +1,40 @@ +use core::ptr; + +/// A type used to conditionally initialize buffers passed to `Read` methods. +#[derive(Debug)] +pub struct Initializer(bool); + +impl Initializer { + /// Returns a new `Initializer` which will zero out buffers. + #[inline] + pub fn zeroing() -> Initializer { + Initializer(true) + } + + /// Returns a new `Initializer` which will not zero out buffers. + /// + /// # Safety + /// + /// This may only be called by `Read`ers which guarantee that they will not + /// read from buffers passed to `Read` methods, and that the return value of + /// the method accurately reflects the number of bytes that have been + /// written to the head of the buffer. + #[inline] + pub unsafe fn nop() -> Initializer { + Initializer(false) + } + + /// Indicates if a buffer should be initialized. + #[inline] + pub fn should_initialize(&self) -> bool { + self.0 + } + + /// Initializes a buffer if necessary. + #[inline] + pub fn initialize(&self, buf: &mut [u8]) { + if self.should_initialize() { + unsafe { ptr::write_bytes(buf.as_mut_ptr(), 0, buf.len()) } + } + } +} diff --git a/crates/lazy-collections/src/io/prelude.rs b/crates/lazy-collections/src/io/prelude.rs new file mode 100644 index 00000000..c2ad4cb3 --- /dev/null +++ b/crates/lazy-collections/src/io/prelude.rs @@ -0,0 +1,10 @@ +//! The Mycelium I/O Prelude +//! +//! The purpose of this module is to alleviate imports of many common I/O traits +//! by adding a glob import to the top of I/O heavy modules: +//! +//! ``` +//! # #![allow(unused_imports)] +//! use mycelium_util::io::prelude::*; +//! ``` +pub use super::{BufRead, Read, Seek, Write}; diff --git a/crates/lazy-collections/src/io/std_io.rs b/crates/lazy-collections/src/io/std_io.rs new file mode 100644 index 00000000..09744727 --- /dev/null +++ b/crates/lazy-collections/src/io/std_io.rs @@ -0,0 +1,107 @@ +use crate::io::{BufRead, Read, Seek, SeekFrom}; + +/// Adapter to `std::io` traits. +#[derive(Clone)] +pub struct ToStd<T: ?Sized> { + inner: T, +} + +impl<T> ToStd<T> { + /// Create a new adapter. + pub fn new(inner: T) -> Self { + Self { inner } + } + + /// Consume the adapter, returning the inner object. + pub fn into_inner(self) -> T { + self.inner + } +} + +impl<T: ?Sized> ToStd<T> { + /// Borrow the inner object. + pub fn inner(&self) -> &T { + &self.inner + } + + /// Mutably borrow the inner object. + pub fn inner_mut(&mut self) -> &mut T { + &mut self.inner + } +} + +impl<T: Read + ?Sized> std::io::Read for ToStd<T> { + fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { + Read::read(self.inner_mut(), buf).map_err(std::io::Error::from) + } + + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> std::io::Result<usize> { + Read::read_to_end(self.inner_mut(), buf).map_err(std::io::Error::from) + } + + fn read_to_string(&mut self, buf: &mut String) -> std::io::Result<usize> { + Read::read_to_string(self.inner_mut(), buf).map_err(std::io::Error::from) + } + + fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> { + Read::read_exact(self.inner_mut(), buf).map_err(std::io::Error::from) + } +} + +impl From<SeekFrom> for std::io::SeekFrom { + fn from(from: SeekFrom) -> Self { + match from { + SeekFrom::Start(offset) => std::io::SeekFrom::Start(offset), + SeekFrom::Current(offset) => std::io::SeekFrom::Current(offset), + SeekFrom::End(offset) => std::io::SeekFrom::End(offset), + } + } +} + +impl From<std::io::SeekFrom> for SeekFrom { + fn from(from: std::io::SeekFrom) -> Self { + match from { + std::io::SeekFrom::Start(offset) => SeekFrom::Start(offset), + std::io::SeekFrom::Current(offset) => SeekFrom::Current(offset), + std::io::SeekFrom::End(offset) => SeekFrom::End(offset), + } + } +} + +impl<T: Seek + ?Sized> std::io::Seek for ToStd<T> { + fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result<u64> { + Seek::seek(self.inner_mut(), pos.into()).map_err(std::io::Error::from) + } + + fn rewind(&mut self) -> std::io::Result<()> { + self.seek(std::io::SeekFrom::Start(0))?; + Ok(()) + } + + fn stream_position(&mut self) -> std::io::Result<u64> { + Seek::stream_position(self.inner_mut()).map_err(std::io::Error::from) + } + + fn seek_relative(&mut self, offset: i64) -> std::io::Result<()> { + self.seek(std::io::SeekFrom::Current(offset))?; + Ok(()) + } +} + +impl<T: BufRead + ?Sized> std::io::BufRead for ToStd<T> { + fn fill_buf(&mut self) -> std::io::Result<&[u8]> { + BufRead::fill_buf(self.inner_mut()).map_err(std::io::Error::from) + } + + fn consume(&mut self, amount: usize) { + BufRead::consume(self.inner_mut(), amount); + } + + fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> std::io::Result<usize> { + BufRead::read_until(self.inner_mut(), byte, buf).map_err(std::io::Error::from) + } + + fn read_line(&mut self, buf: &mut String) -> std::io::Result<usize> { + BufRead::read_line(self.inner_mut(), buf).map_err(std::io::Error::from) + } +} diff --git a/crates/lazy-collections/src/io/util.rs b/crates/lazy-collections/src/io/util.rs new file mode 100644 index 00000000..a7867c89 --- /dev/null +++ b/crates/lazy-collections/src/io/util.rs @@ -0,0 +1,215 @@ +use crate::io::{self, ErrorKind, Initializer, Read, Write}; +use core::{fmt, mem::MaybeUninit}; +/// Copies the entire contents of a reader into a writer. +/// +/// This function will continuously read data from `reader` and then +/// write it into `writer` in a streaming fashion until `reader` +/// returns EOF. +/// +/// On success, the total number of bytes that were copied from +/// `reader` to `writer` is returned. +/// +/// # Errors +/// +/// This function will return an error immediately if any call to `read` or +/// `write` returns an error. All instances of `ErrorKind::Interrupted` are +/// handled by this function and the underlying operation is retried. +pub fn copy<R, W>(reader: &mut R, writer: &mut W) -> io::Result<u64> +where + R: ?Sized + Read, + W: ?Sized + Write, +{ + let mut buf = MaybeUninit::<[u8; super::DEFAULT_BUF_SIZE]>::uninit(); + // FIXME(eliza): the stdlib has a scary comment that says we haven't decided + // if this is okay or not... + unsafe { + reader.initializer().initialize(&mut *buf.as_mut_ptr()); + } + + let mut written = 0; + loop { + let len = match reader.read(unsafe { &mut *buf.as_mut_ptr() }) { + Ok(0) => return Ok(written), + Ok(len) => len, + Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => return Err(e), + }; + writer.write_all(unsafe { &(&*buf.as_ptr())[..len] })?; + written += len as u64; + } +} + +/// A reader which is always at EOF. +/// +/// This struct is generally created by calling [`empty`]. Please see +/// the documentation of [`empty()`][`empty`] for more details. +/// +/// [`empty`]: fn.empty.html +pub struct Empty { + _priv: (), +} + +/// Constructs a new handle to an empty reader. +/// +/// All reads from the returned reader will return `Ok(0)`. +/// +pub fn empty() -> Empty { + Empty { _priv: () } +} + +impl Read for Empty { + #[inline] + fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { + Ok(0) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { Initializer::nop() } + } +} + +// impl BufRead for Empty { +// #[inline] +// fn fill_buf(&mut self) -> io::Result<&[u8]> { +// Ok(&[]) +// } +// #[inline] +// fn consume(&mut self, _n: usize) {} +// } + +impl fmt::Debug for Empty { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("Empty { .. }") + } +} + +/// A reader which yields one byte over and over and over and over and over and... +/// +/// This struct is generally created by calling [`repeat`][repeat]. Please +/// see the documentation of `repeat()` for more details. +/// +/// [repeat]: fn.repeat.html +pub struct Repeat { + byte: u8, +} + +/// Creates an instance of a reader that infinitely repeats one byte. +/// +/// All reads from this reader will succeed by filling the specified buffer with +/// the given byte. +pub fn repeat(byte: u8) -> Repeat { + Repeat { byte } +} + +impl Read for Repeat { + #[inline] + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + for slot in &mut *buf { + *slot = self.byte; + } + Ok(buf.len()) + } + + #[inline] + unsafe fn initializer(&self) -> Initializer { + unsafe { Initializer::nop() } + } +} + +impl fmt::Debug for Repeat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("Repeat { .. }") + } +} + +/// A writer which will move data into the void. +/// +/// This struct is generally created by calling [`sink`][sink]. Please +/// see the documentation of `sink()` for more details. +/// +/// [sink]: fn.sink.html +pub struct Sink { + _priv: (), +} + +/// Creates an instance of a writer which will successfully consume all data. +/// +/// All calls to `write` on the returned instance will return `Ok(buf.len())` +/// and the contents of the buffer will not be inspected. +pub fn sink() -> Sink { + Sink { _priv: () } +} + +impl Write for Sink { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + Ok(buf.len()) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl fmt::Debug for Sink { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("Sink { .. }") + } +} + +#[cfg(all(test, not(loom)))] +mod tests { + use crate::io::prelude::*; + use crate::io::{copy, empty, repeat, sink}; + + #[test] + fn copy_copies() { + let mut r = repeat(0).take(4); + let mut w = sink(); + assert_eq!(copy(&mut r, &mut w).unwrap(), 4); + + let mut r = repeat(0).take(1 << 17); + assert_eq!( + copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), + 1 << 17 + ); + } + + #[test] + fn sink_sinks() { + let mut s = sink(); + assert_eq!(s.write(&[]).unwrap(), 0); + assert_eq!(s.write(&[0]).unwrap(), 1); + assert_eq!(s.write(&[0; 1024]).unwrap(), 1024); + assert_eq!(s.by_ref().write(&[0; 1024]).unwrap(), 1024); + } + + #[test] + fn empty_reads() { + let mut e = empty(); + assert_eq!(e.read(&mut []).unwrap(), 0); + assert_eq!(e.read(&mut [0]).unwrap(), 0); + assert_eq!(e.read(&mut [0; 1024]).unwrap(), 0); + assert_eq!(e.by_ref().read(&mut [0; 1024]).unwrap(), 0); + } + + #[test] + fn repeat_repeats() { + let mut r = repeat(4); + let mut b = [0; 1024]; + assert_eq!(r.read(&mut b).unwrap(), 1024); + assert!(b.iter().all(|b| *b == 4)); + } + + #[test] + fn take_some_bytes() { + assert_eq!(repeat(4).take(100).bytes().count(), 100); + assert_eq!(repeat(4).take(100).bytes().next().unwrap().unwrap(), 4); + assert_eq!( + repeat(1).take(10).chain(repeat(2).take(10)).bytes().count(), + 20 + ); + } +} diff --git a/crates/lazy-collections/src/lib.rs b/crates/lazy-collections/src/lib.rs new file mode 100644 index 00000000..381d10d4 --- /dev/null +++ b/crates/lazy-collections/src/lib.rs @@ -0,0 +1,120 @@ +#![feature(maybe_uninit_slice)] +#![feature(maybe_uninit_write_slice)] +#![cfg_attr(target_os = "none", no_std)] + +#[cfg(all(not(feature = "std"), feature = "alloc"))] +extern crate alloc; + +#[cfg(all(feature = "std", feature = "alloc"))] +use std as alloc; + +/// Lazy initialization type for static values. +/// +/// Uses `std::sync::LazyLock` when the `std` feature is enabled, or `spin::Lazy` +/// for no_std environments. Exported so downstream crates can use it without +/// their own conditional compilation. +#[cfg(feature = "std")] +pub type Lazy<T> = std::sync::LazyLock<T>; + +#[cfg(not(feature = "std"))] +pub use spin::Lazy; + +pub mod deferred; +pub mod io; +//pub mod map; +pub mod storage; +pub mod vector; + +use core::ops::{Deref, DerefMut}; + +pub struct ScopeGuard<'a, T>(pub &'a mut T, pub fn(&mut T)); + +impl<T> Deref for ScopeGuard<'_, T> { + type Target = T; + + #[inline] + fn deref(&self) -> &Self::Target { + self.0 + } +} + +impl<T> DerefMut for ScopeGuard<'_, T> { + #[inline] + fn deref_mut(&mut self) -> &mut Self::Target { + self.0 + } +} + +impl<T> Drop for ScopeGuard<'_, T> { + #[inline] + fn drop(&mut self) { + (self.1)(self.0); + } +} + +#[derive(Debug)] +pub struct StringMsg(&'static str); + +impl From<&'static str> for StringMsg { + fn from(s: &'static str) -> Self { + StringMsg(s) + } +} + +impl core::fmt::Display for StringMsg { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}", self.0) + } +} + +impl core::error::Error for StringMsg {} + +use core::num::Wrapping; + +#[derive(Clone, Copy, PartialEq, Eq)] +/// Unique ID used to identify things in the open Volume/File/Directory lists +pub struct Handle(pub(crate) u32); + +impl core::fmt::Debug for Handle { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{:#08x}", self.0) + } +} + +/// A Handle Generator. +/// +/// This object will always return a different ID. +/// +/// Well, it will wrap after `2**32` IDs. But most systems won't open that many +/// files, and if they do, they are unlikely to hold one file open and then +/// open/close `2**32 - 1` others. +#[derive(Debug)] +pub struct HandleGenerator { + next_id: Wrapping<u32>, +} + +impl HandleGenerator { + /// Create a new generator of Handles. + pub const fn new(offset: u32) -> Self { + Self { + next_id: Wrapping(offset), + } + } + + /// Generate a new, unique [`Handle`]. + pub fn generate(&mut self) -> Handle { + let id = self.next_id; + self.next_id += 1; + Handle(id.0) + } +} + +static HANDLE_GENERATOR: Lazy<HandleGenerator> = Lazy::new(|| HandleGenerator::new(0)); + +pub fn new_handle() -> Handle { + // TODO: Fix this for multithreaded systems using a thread-local and a unique id or something + todo!() +} + +#[cfg(test)] +mod tests {} diff --git a/crates/lazy-collections/src/map.rs b/crates/lazy-collections/src/map.rs new file mode 100644 index 00000000..f6f893d5 --- /dev/null +++ b/crates/lazy-collections/src/map.rs @@ -0,0 +1,525 @@ +use core::{ + fmt::{Debug, Formatter}, + marker::PhantomData, + ops::{Deref, DerefMut, Index, IndexMut}, + slice::SliceIndex, +}; +use std::collections::VecDeque; + +use maitake_sync::blocking::{RwLock, RwLockReadGuard, RwLockWriteGuard}; +use serde::{Deserialize, Serialize}; + +use crate::{ + Handle, + io::{FromEmbed, Read, Write}, + new_handle, + storage::Storage, +}; + +#[cfg(not(feature = "alloc"))] +pub type VecDeque<T> = heapless::Deque<T, 2>; + +pub struct LMap<K, V, S> { + handle: [u8; 4], + loaded: RwLock<VecDeque<(K, V)>>, + lock: RwLock<()>, + len: usize, + buf_size: usize, + storage: S, +} + +impl<K, V, S> LMap<K, V, S> { + pub fn new_with(handle: Handle, buf_size: usize, storage: S) -> Self { + LMap { + handle: handle.0.to_be_bytes(), + loaded: RwLock::new(VecDeque::new()), + lock: RwLock::new(()), + len: 0, + buf_size, + storage, + } + } + + pub fn new(storage: S) -> Self { + LMap::new_with(new_handle(), 2, storage) + } +} + +impl<K, V, S> LMap<K, V, S> +where + K: Ord, + S: Storage + Read + Write, +{ + pub fn len(&self) -> usize { + self.len + } + + fn get_key(&self, index: &K) -> Vec<u8> + where + K: Serialize, + { + let mut key = postcard::to_allocvec(index).expect("Failed to serialize key"); + key.extend_from_slice(&self.handle); + key + } + + /// NOTE: Do not hold these references for an extended period of time. + /// This does NOT spin waiting for a write lock if it misses the cache, but + /// then it will not cache what it found. I consider this an acceptable failure + /// mode for the intended use case. + pub fn get_elem<'de, 's: 'de>(&'s self, key: &K) -> Option<Ref<'s, K, V>> + where + K: Serialize + Clone, + V: Deserialize<'de>, + S: 'de, + { + let loaded = self.loaded.read(); + let mut found = None; + for (i, (idx, _)) in loaded.iter().enumerate() { + if idx == key { + found = Some(i); + } + } + if let Some(i) = found { + let guard = self.lock.read(); + return loaded.get(i).map(|(k, v)| unsafe { Ref::new(guard, k, v) }); + } + drop(loaded); + + let key_bytes = self.get_key(key); + let reader = FromEmbed::new(self.storage.get::<S>(&key_bytes).ok()??); + let buffer = self.storage.buffer(&key_bytes); + let (elem, _buf) = postcard::from_eio::<V, _>((reader, buffer)).ok()?; + if let Some(mut loaded) = self.loaded.try_write() { + loaded.push_back((key.clone(), elem)); + if loaded.len() > self.buf_size { + loaded.pop_front(); + } + } + let read_guard = self.loaded.read(); + let back = read_guard.back(); + let guard = self.lock.read(); + back.map(|(k, v)| unsafe { Ref::new(guard, k, v) }) + } + + pub fn get_elem_mut<'de, 's: 'de>(&'s mut self, index: usize) -> Option<RefMut<'s, K, V>> + where + K: Deserialize<'de>, + V: Deserialize<'de>, + S: 'de, + { + let loaded = self.loaded.get_mut(); + let mut found = None; + for (i, (idx, _)) in loaded.iter().enumerate() { + if *idx == index { + found = Some(i); + } + } + if let Some(i) = found { + let guard = self.lock.write(); + loaded + .get_mut(i) + .map(|(_, e)| unsafe { RefMut::new(guard, e) }) + } else { + self.get_stored_mut(index) + } + } + + fn get_stored_mut<'de, 's: 'de>(&'s mut self, index: usize) -> Option<RefMut<'s, K, V>> + where + K: Deserialize<'de>, + V: Deserialize<'de>, + S: 'de, + { + let key = self.get_key(index); + let reader = FromEmbed::new(self.storage.get::<S>(&key).ok()??); + let buffer = self.storage.buffer(&key); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + let loaded = self.loaded.get_mut(); + loaded.push_back((index, elem)); + if loaded.len() > self.buf_size { + loaded.pop_front(); + } + let guard = self.lock.write(); + let back = loaded.back_mut(); + back.map(|(_, e)| unsafe { RefMut::new(guard, e) }) + } + + // pub fn get<I>(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output> + // where + // I: SliceIndex<[T]>, + // { + // unimplemented!() + // } + + // pub fn get_mut<I>(&mut self, index: I) -> Option<&mut <I as SliceIndex<[T]>>::Output> + // where + // I: SliceIndex<[T]>, + // { + // unimplemented!() + // } + + pub fn insert(&mut self, index: K, elem: V) { + let key = self.get_key(index); + let mut writer = FromEmbed::new(self.storage.writer(&key).expect("failed to get writer")); + postcard::to_eio(&elem, &mut writer).expect("Failed to serialize element"); + self.len += 1; + let loaded = self.loaded.get_mut(); + loaded.push_back((index, elem)); + self.storage.put::<_>(&key, writer.into_inner()).ok(); + } + + pub fn remove<'de, 's: 'de>(&'s mut self, index: &K) -> Option<V> + where + K: Deserialize<'de>, + V: Deserialize<'de>, + S: 'de, + { + if index >= self.len { + return None; + } + let mut found = None; + let mut loaded = self.loaded.write(); + for (i, (idx, _)) in loaded.iter().enumerate() { + if *idx == index { + found = Some(i); + } + } + let key = self.get_key(index); + if let Some(i) = found { + self.storage.del(&key).ok(); + loaded.remove(i).map(|(_, e)| e) + } else { + let reader = FromEmbed::new(self.storage.get::<S>(&key).ok()??); + let buffer = self.storage.buffer(&key); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + self.storage.del(&key).ok(); + Some(elem) + } + } +} + +pub struct Ref<'a, K, V> { + _guard: RwLockReadGuard<'a, ()>, + k: *const K, + v: *const V, +} + +unsafe impl<'a, K: Ord + Sync, V: Sync> Send for Ref<'a, K, V> {} +unsafe impl<'a, K: Ord + Sync, V: Sync> Sync for Ref<'a, K, V> {} + +impl<'a, K: Ord, V> Ref<'a, K, V> { + pub(crate) unsafe fn new(guard: RwLockReadGuard<'a, ()>, k: *const K, v: *const V) -> Self { + Self { + _guard: guard, + k, + v, + } + } + + pub fn key(&self) -> &K { + self.pair().0 + } + + pub fn value(&self) -> &V { + self.pair().1 + } + + pub fn pair(&self) -> (&K, &V) { + unsafe { (&*self.k, &*self.v) } + } + + pub fn map<F, T>(self, f: F) -> MappedRef<'a, K, V, T> + where + F: FnOnce(&V) -> &T, + { + MappedRef { + _guard: self._guard, + k: self.k, + v: f(unsafe { &*self.v }), + _marker: PhantomData, + } + } + + pub fn try_map<F, T>(self, f: F) -> Result<MappedRef<'a, K, V, T>, Self> + where + F: FnOnce(&V) -> Option<&T>, + { + if let Some(v) = f(unsafe { &*self.v }) { + Ok(MappedRef { + _guard: self._guard, + k: self.k, + v, + _marker: PhantomData, + }) + } else { + Err(self) + } + } +} + +impl<'a, K: Ord + Debug, V: Debug> Debug for Ref<'a, K, V> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Ref") + .field("k", &self.k) + .field("v", &self.v) + .finish() + } +} + +impl<'a, K: Ord, V> Deref for Ref<'a, K, V> { + type Target = V; + + fn deref(&self) -> &V { + self.value() + } +} + +pub struct RefMut<'a, K, V> { + guard: RwLockWriteGuard<'a, ()>, + k: *const K, + v: *mut V, +} + +unsafe impl<'a, K: Ord + Sync, V: Sync> Send for RefMut<'a, K, V> {} +unsafe impl<'a, K: Ord + Sync, V: Sync> Sync for RefMut<'a, K, V> {} + +impl<'a, K: Ord, V> RefMut<'a, K, V> { + pub(crate) unsafe fn new(guard: RwLockWriteGuard<'a, ()>, k: *const K, v: *mut V) -> Self { + Self { guard, k, v } + } + + pub fn key(&self) -> &K { + self.pair().0 + } + + pub fn value(&self) -> &V { + self.pair().1 + } + + pub fn value_mut(&mut self) -> &mut V { + self.pair_mut().1 + } + + pub fn pair(&self) -> (&K, &V) { + unsafe { (&*self.k, &*self.v) } + } + + pub fn pair_mut(&mut self) -> (&K, &mut V) { + unsafe { (&*self.k, &mut *self.v) } + } + + pub fn map<F, T>(self, f: F) -> MappedRefMut<'a, K, V, T> + where + F: FnOnce(&mut V) -> &mut T, + { + MappedRefMut { + _guard: self.guard, + k: self.k, + v: f(unsafe { &mut *self.v }), + _marker: PhantomData, + } + } + + pub fn try_map<F, T>(self, f: F) -> Result<MappedRefMut<'a, K, V, T>, Self> + where + F: FnOnce(&mut V) -> Option<&mut T>, + { + let v = match f(unsafe { &mut *(self.v as *mut _) }) { + Some(v) => v, + None => return Err(self), + }; + let guard = self.guard; + let k = self.k; + Ok(MappedRefMut { + _guard: guard, + k, + v, + _marker: PhantomData, + }) + } +} + +impl<'a, K: Ord + Debug, V: Debug> Debug for RefMut<'a, K, V> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("RefMut") + .field("k", &self.k) + .field("v", &self.v) + .finish() + } +} + +impl<'a, K: Ord, V> Deref for RefMut<'a, K, V> { + type Target = V; + + fn deref(&self) -> &V { + self.value() + } +} + +impl<'a, K: Ord, V> DerefMut for RefMut<'a, K, V> { + fn deref_mut(&mut self) -> &mut V { + self.value_mut() + } +} + +pub struct MappedRef<'a, K, V, T> { + _guard: RwLockReadGuard<'a, ()>, + k: *const K, + v: *const T, + _marker: PhantomData<V>, +} + +impl<'a, K: Ord, V, T> MappedRef<'a, K, V, T> { + pub fn key(&self) -> &K { + self.pair().0 + } + + pub fn value(&self) -> &T { + self.pair().1 + } + + pub fn pair(&self) -> (&K, &T) { + unsafe { (&*self.k, &*self.v) } + } + + pub fn map<F, T2>(self, f: F) -> MappedRef<'a, K, V, T2> + where + F: FnOnce(&T) -> &T2, + { + MappedRef { + _guard: self._guard, + k: self.k, + v: f(unsafe { &*self.v }), + _marker: PhantomData, + } + } + + pub fn try_map<F, T2>(self, f: F) -> Result<MappedRef<'a, K, V, T2>, Self> + where + F: FnOnce(&T) -> Option<&T2>, + { + let v = match f(unsafe { &*self.v }) { + Some(v) => v, + None => return Err(self), + }; + let guard = self._guard; + Ok(MappedRef { + _guard: guard, + k: self.k, + v, + _marker: PhantomData, + }) + } +} + +impl<'a, K: Ord + Debug, V, T: Debug> Debug for MappedRef<'a, K, V, T> { + fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { + f.debug_struct("MappedRef") + .field("k", &self.k) + .field("v", &self.v) + .finish() + } +} + +impl<'a, K: Ord, V, T> Deref for MappedRef<'a, K, V, T> { + type Target = T; + + fn deref(&self) -> &T { + self.value() + } +} + +impl<'a, K: Ord, V, T: core::fmt::Display> core::fmt::Display for MappedRef<'a, K, V, T> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Display::fmt(self.value(), f) + } +} + +impl<'a, K: Ord, V, T: AsRef<TDeref>, TDeref: ?Sized> AsRef<TDeref> for MappedRef<'a, K, V, T> { + fn as_ref(&self) -> &TDeref { + self.value().as_ref() + } +} + +pub struct MappedRefMut<'a, K, V, T> { + _guard: RwLockWriteGuard<'a, ()>, + k: *const K, + v: *mut T, + _marker: PhantomData<V>, +} + +impl<'a, K: Ord, V, T> MappedRefMut<'a, K, V, T> { + pub fn key(&self) -> &K { + self.pair().0 + } + + pub fn value(&self) -> &T { + self.pair().1 + } + + pub fn value_mut(&mut self) -> &mut T { + self.pair_mut().1 + } + + pub fn pair(&self) -> (&K, &T) { + unsafe { (&*self.k, &*self.v) } + } + + pub fn pair_mut(&mut self) -> (&K, &mut T) { + unsafe { (&*self.k, &mut *self.v) } + } + + pub fn map<F, T2>(self, f: F) -> MappedRefMut<'a, K, V, T2> + where + F: FnOnce(&mut T) -> &mut T2, + { + MappedRefMut { + _guard: self._guard, + k: self.k, + v: f(unsafe { &mut *self.v }), + _marker: PhantomData, + } + } + + pub fn try_map<F, T2>(self, f: F) -> Result<MappedRefMut<'a, K, V, T2>, Self> + where + F: FnOnce(&mut T) -> Option<&mut T2>, + { + let v = match f(unsafe { &mut *(self.v as *mut _) }) { + Some(v) => v, + None => return Err(self), + }; + let guard = self._guard; + let k = self.k; + Ok(MappedRefMut { + _guard: guard, + k, + v, + _marker: PhantomData, + }) + } +} + +impl<'a, K: Ord + Debug, V, T: Debug> Debug for MappedRefMut<'a, K, V, T> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("MappedRefMut") + .field("k", &self.k) + .field("v", &self.v) + .finish() + } +} + +impl<'a, K: Ord, V, T> Deref for MappedRefMut<'a, K, V, T> { + type Target = T; + + fn deref(&self) -> &T { + self.value() + } +} + +impl<'a, K: Ord, V, T> DerefMut for MappedRefMut<'a, K, V, T> { + fn deref_mut(&mut self) -> &mut T { + self.value_mut() + } +} diff --git a/crates/lazy-collections/src/storage.rs b/crates/lazy-collections/src/storage.rs new file mode 100644 index 00000000..029dd280 --- /dev/null +++ b/crates/lazy-collections/src/storage.rs @@ -0,0 +1,21 @@ +use crate::io; + +#[cfg(not(feature = "alloc"))] +pub type Vec<T> = heapless::Vec<T, 256>; + +/// Backing key-value storage trait. +/// This allows the collection type to be backed by filesystem, database, or other secondary storage. +/// Keys are intentionally just byte slices for flexibilty. +/// On no-alloc the returned vector caps out at 256 bytes and is stored on the stack. +/// Intended return path fordata is via the types that return `RW` +/// `RW`: should be a reader, preferably seekable. +pub trait Storage { + fn get<RW>(&self, key: &[u8]) -> io::Result<Option<RW>>; + fn get_data(&self, key: &[u8]) -> io::Result<Option<Vec<u8>>>; + fn put_data(&self, key: &[u8], value: &[u8]) -> io::Result<()>; + fn put<RW>(&self, key: &[u8], value: RW) -> io::Result<()>; + fn has(&self, key: &[u8]) -> io::Result<bool>; + fn del(&self, key: &[u8]) -> io::Result<()>; + fn buffer(&self, key: &[u8]) -> &mut [u8]; + fn writer(&self, key: &[u8]) -> io::Result<Box<dyn io::Write>>; +} diff --git a/crates/lazy-collections/src/vector.rs b/crates/lazy-collections/src/vector.rs new file mode 100644 index 00000000..95e7004b --- /dev/null +++ b/crates/lazy-collections/src/vector.rs @@ -0,0 +1,550 @@ +use core::{ + fmt::{Debug, Formatter}, + marker::PhantomData, + ops::{Deref, DerefMut, Index, IndexMut}, + slice::SliceIndex, +}; +use std::collections::VecDeque; + +use maitake_sync::blocking::{RwLock, RwLockReadGuard, RwLockWriteGuard}; +use serde::{Deserialize, Serialize}; + +use crate::{ + Handle, + io::{FromEmbed, Read, Write}, + new_handle, + storage::Storage, +}; + +#[cfg(not(feature = "alloc"))] +pub type VecDeque<T> = heapless::Deque<T, 2>; + +pub struct LVec<T, S> { + handle: [u8; 4], + loaded: RwLock<VecDeque<(usize, T)>>, + lock: RwLock<()>, + len: usize, + buf_size: usize, + storage: S, +} + +impl<T, S> LVec<T, S> { + pub fn new_with(handle: Handle, buf_size: usize, storage: S) -> Self { + LVec { + handle: handle.0.to_be_bytes(), + loaded: RwLock::new(VecDeque::new()), + lock: RwLock::new(()), + len: 0, + buf_size, + storage, + } + } + + pub fn new(storage: S) -> Self { + LVec::new_with(new_handle(), 2, storage) + } +} + +impl<T, S> LVec<T, S> +where + S: Storage + Read + Write, + T: Serialize, +{ + pub fn len(&self) -> usize { + self.len + } + + fn get_key(&self, index: usize) -> Vec<u8> { + let mut key = self.handle.to_vec(); + key.extend_from_slice(&index.to_be_bytes()); + key + } + + /// NOTE: Do not hold these references for an extended period of time. + /// This does NOT spin waiting for a write lock if it misses the cache, but + /// then it will not cache what it found. I consider this an acceptable failure + /// mode for the intended use case. + pub fn get_elem<'de, 's: 'de>(&'s self, index: usize) -> Option<Ref<'s, T>> + where + T: Deserialize<'de>, + S: 'de, + { + let loaded = self.loaded.read(); + let mut found = None; + for (i, (idx, _)) in loaded.iter().enumerate() { + if *idx == index { + found = Some(i); + } + } + if let Some(i) = found { + let guard = self.lock.read(); + return loaded.get(i).map(|(_, e)| unsafe { Ref::new(guard, e) }); + } + drop(loaded); + + let key = self.get_key(index); + let reader = FromEmbed::new(self.storage.get::<S>(&key).ok()??); + let buffer = self.storage.buffer(&key); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + if let Some(mut loaded) = self.loaded.try_write() { + loaded.push_back((index, elem)); + if loaded.len() > self.buf_size { + loaded.pop_front(); + } + } + let read_guard = self.loaded.read(); + let back = read_guard.back(); + let guard = self.lock.read(); + back.map(|(_, e)| unsafe { Ref::new(guard, e) }) + } + + pub fn get_elem_mut<'de, 's: 'de>(&'s mut self, index: usize) -> Option<RefMut<'s, T>> + where + T: Deserialize<'de>, + S: 'de, + { + let loaded = self.loaded.get_mut(); + let mut found = None; + for (i, (idx, _)) in loaded.iter().enumerate() { + if *idx == index { + found = Some(i); + } + } + if let Some(i) = found { + let guard = self.lock.write(); + loaded + .get_mut(i) + .map(|(_, e)| unsafe { RefMut::new(guard, e) }) + } else { + self.get_stored_mut(index) + } + } + + fn get_stored_mut<'de, 's: 'de>(&'s mut self, index: usize) -> Option<RefMut<'s, T>> + where + T: Deserialize<'de>, + S: 'de, + { + let key = self.get_key(index); + let reader = FromEmbed::new(self.storage.get::<S>(&key).ok()??); + let buffer = self.storage.buffer(&key); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + let loaded = self.loaded.get_mut(); + loaded.push_back((index, elem)); + if loaded.len() > self.buf_size { + loaded.pop_front(); + } + let guard = self.lock.write(); + let back = loaded.back_mut(); + back.map(|(_, e)| unsafe { RefMut::new(guard, e) }) + } + + // pub fn get<I>(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output> + // where + // I: SliceIndex<[T]>, + // { + // unimplemented!() + // } + + // pub fn get_mut<I>(&mut self, index: I) -> Option<&mut <I as SliceIndex<[T]>>::Output> + // where + // I: SliceIndex<[T]>, + // { + // unimplemented!() + // } + + pub fn push(&mut self, elem: T) { + let index = self.len; + let key = self.get_key(index); + let mut writer = FromEmbed::new(self.storage.writer(&key).expect("failed to get writer")); + postcard::to_eio(&elem, &mut writer).expect("Failed to serialize element"); + self.storage.put::<_>(&key, writer.into_inner()).ok(); + self.len += 1; + let loaded = self.loaded.get_mut(); + loaded.push_back((index, elem)); + } + + pub fn insert(&mut self, index: usize, elem: T) { + let key = self.get_key(index); + let mut writer = FromEmbed::new(self.storage.writer(&key).expect("failed to get writer")); + postcard::to_eio(&elem, &mut writer).expect("Failed to serialize element"); + self.len += 1; + let loaded = self.loaded.get_mut(); + loaded.push_back((index, elem)); + self.storage.put::<_>(&key, writer.into_inner()).ok(); + } + + pub fn remove<'de, 's: 'de>(&'s mut self, index: usize) -> Option<T> + where + T: Deserialize<'de>, + S: 'de, + { + if index >= self.len { + return None; + } + let mut found = None; + let mut loaded = self.loaded.write(); + for (i, (idx, _)) in loaded.iter().enumerate() { + if *idx == index { + found = Some(i); + } + } + let key = self.get_key(index); + if let Some(i) = found { + self.storage.del(&key).ok(); + self.len = self.len.saturating_sub(1); + loaded.remove(i).map(|(_, e)| e) + } else { + let reader = FromEmbed::new(self.storage.get::<S>(&key).ok()??); + let buffer = self.storage.buffer(&key); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + self.storage.del(&key).ok(); + self.len = self.len.saturating_sub(1); + Some(elem) + } + } + + pub fn pop<'de, 's: 'de>(&'s mut self) -> Option<T> + where + T: Deserialize<'de>, + S: 'de, + { + if self.len == 0 { + return None; + } + let index = self.len - 1; + self.remove(index) + } + + pub fn index_ref<'de, 's: 'de, 'o: 'de>(&'s self, index: usize) -> &'o T + where + T: Deserialize<'de>, + S: 'de, + { + // SAFETY + // + // Yes, I have read https://doc.rust-lang.org/nomicon/transmutes.html + // + // I promise this is necessary specifically to launder two lifetimes + // which I know to be compatible but which the compiler gets confused by. + // This explicitly specifies the output lifetime, it exceeds the deserialize lifetime + // but is shorter than the 's self lifetime. + unsafe { + let get_ref = self.get_elem(index).expect("index out of bounds"); + let get_ref = get_ref.value(); + + core::mem::transmute::<&T, &'o T>(get_ref) + } + } + + pub fn index_get_mut<'de, 'o: 'de, 's: 'o>(&'s mut self, index: usize) -> &'o mut T + where + T: Deserialize<'de>, + S: 'de, + { + // SAFETY + // + // Yes, I have read https://doc.rust-lang.org/nomicon/transmutes.html + // + // I promise this is necessary specifically to launder two lifetimes + // which I know to be compatible but which the compiler gets confused by. + // This explicitly specifies the output lifetime, it exceeds the deserialize lifetime + // but is shorter than the 's self lifetime. + unsafe { + let mut mut_ref = self.get_elem_mut(index).expect("index out of bounds"); + let mut_ref = mut_ref.value_mut(); + + core::mem::transmute::<&mut T, &'o mut T>(mut_ref) + } + } +} + +impl<T, S> IndexMut<usize> for LVec<T, S> +where + T: for<'de> Deserialize<'de> + Serialize, + S: Storage + Read + Write, +{ + fn index_mut(&mut self, index: usize) -> &mut Self::Output { + self.index_get_mut(index) + } +} + +impl<T, S> Index<usize> for LVec<T, S> +where + T: for<'de> Deserialize<'de> + Serialize, + S: Storage + Read + Write, +{ + type Output = T; + + fn index(&self, index: usize) -> &Self::Output { + self.index_ref(index) + } +} + +pub struct IntoIter<T, S: Storage> { + storage: S, + handle: [u8; 4], + cursor: usize, + rev_cursor: Option<usize>, + len: usize, + _marker: PhantomData<T>, +} + +impl<T, S: Storage> IntoIter<T, S> { + fn get_key(&self, index: usize) -> Vec<u8> { + let mut key = self.handle.to_vec(); + key.extend_from_slice(&index.to_be_bytes()); + key + } +} + +fn get_stored<'de, T, S>(key: &[u8], storage: &'de S, buffer: &'de mut [u8]) -> Option<T> +where + T: Deserialize<'de>, + S: Storage + Read, +{ + let reader = FromEmbed::new(storage.get::<S>(&key).ok()??); + let (elem, _buf) = postcard::from_eio::<T, _>((reader, buffer)).ok()?; + Some(elem) +} + +impl<T, S> IntoIterator for LVec<T, S> +where + T: for<'de> Deserialize<'de>, + S: Storage + Read, +{ + type Item = T; + + type IntoIter = IntoIter<T, S>; + + fn into_iter(self) -> Self::IntoIter { + let storage = self.storage; + let cursor = 0; + let len = self.len; + IntoIter { + handle: self.handle, + storage, + cursor, + rev_cursor: Some(len - 1), + len, + _marker: PhantomData, + } + } +} + +impl<T, S> Iterator for IntoIter<T, S> +where + T: for<'de> Deserialize<'de>, + S: Storage + Read, +{ + type Item = T; + + fn next(&mut self) -> Option<Self::Item> { + let key = self.get_key(self.cursor); + self.cursor += 1; + let elem = get_stored(&key, &self.storage, self.storage.buffer(&key)); + self.storage.del(&key).ok(); + elem + } + + fn size_hint(&self) -> (usize, Option<usize>) { + (self.len, Some(self.len)) + } +} + +impl<T, S> DoubleEndedIterator for IntoIter<T, S> +where + T: for<'de> Deserialize<'de>, + S: Storage + Read, +{ + fn next_back(&mut self) -> Option<Self::Item> { + if self.rev_cursor.is_none() { + None + } else { + let key = self.get_key(self.rev_cursor.unwrap()); + if self.rev_cursor.is_some_and(|c| c == 0) { + self.rev_cursor = None; + } else { + self.rev_cursor = self.rev_cursor.map(|i| i - 1); + } + let elem = get_stored(&key, &self.storage, self.storage.buffer(&key)); + self.storage.del(&key).ok(); + elem + } + } +} + +impl<T, S> Drop for IntoIter<T, S> +where + S: Storage, +{ + fn drop(&mut self) { + let rev_cursor = self.rev_cursor.unwrap_or_default(); + for idx in self.cursor..=rev_cursor { + let key = self.get_key(idx); + self.storage.del(&key).ok(); + } + } +} + +pub struct Iter<'a, T, S> { + storage: &'a S, + handle: [u8; 4], + cursor: usize, + rev_cursor: Option<usize>, + len: usize, + _marker: PhantomData<&'a T>, +} + +impl<'a, T, S> Iter<'a, T, S> { + pub fn new(storage: &'a S, len: usize, handle: [u8; 4]) -> Self { + let (cursor, rev_cursor) = (0, Some(len - 1)); + Self { + handle, + storage, + len, + cursor, + rev_cursor, + _marker: PhantomData, + } + } +} + +impl<T, S: Storage> Iter<'_, T, S> { + fn get_key(&self, index: usize) -> Vec<u8> { + let mut key = self.handle.to_vec(); + key.extend_from_slice(&index.to_be_bytes()); + key + } +} + +impl<'a, T, S> Iterator for Iter<'a, T, S> +where + T: Deserialize<'a>, + S: Storage + Read, +{ + type Item = T; + + fn next(&mut self) -> Option<Self::Item> { + if self.cursor >= self.len { + None + } else { + let key = self.get_key(self.cursor); + self.cursor += 1; + let elem = get_stored(&key, self.storage, self.storage.buffer(&key)); + elem + } + } + + fn size_hint(&self) -> (usize, Option<usize>) { + (self.len, Some(self.len)) + } +} + +impl<'a, T, S> DoubleEndedIterator for Iter<'a, T, S> +where + T: Deserialize<'a>, + S: Storage + Read, +{ + fn next_back(&mut self) -> Option<Self::Item> { + if self.rev_cursor.is_none() { + None + } else { + let key = self.get_key(self.rev_cursor.unwrap()); + if self.rev_cursor.is_some_and(|c| c == 0) { + self.rev_cursor = None; + } else { + self.rev_cursor = self.rev_cursor.map(|i| i - 1); + } + let elem = get_stored(&key, self.storage, self.storage.buffer(&key)); + elem + } + } +} + +pub struct Ref<'a, V> { + _guard: RwLockReadGuard<'a, ()>, + v: *const V, +} + +unsafe impl<'a, V: Sync> Send for Ref<'a, V> {} +unsafe impl<'a, V: Sync> Sync for Ref<'a, V> {} + +impl<'a, V> Ref<'a, V> { + pub(crate) unsafe fn new(guard: RwLockReadGuard<'a, ()>, v: *const V) -> Self { + Self { _guard: guard, v } + } + + pub fn value(&self) -> &V { + unsafe { &*self.v } + } +} + +impl<'a, V: Debug> Debug for Ref<'a, V> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Ref").field("v", &self.v).finish() + } +} + +impl<'a, V> Deref for Ref<'a, V> { + type Target = V; + + fn deref(&self) -> &V { + self.value() + } +} + +impl<'a, V> AsRef<V> for Ref<'a, V> { + fn as_ref(&self) -> &V { + self.value() + } +} + +pub struct RefMut<'a, V> { + #[allow(dead_code)] + guard: RwLockWriteGuard<'a, ()>, + v: *mut V, +} + +unsafe impl<'a, V: Sync> Send for RefMut<'a, V> {} +unsafe impl<'a, V: Sync> Sync for RefMut<'a, V> {} + +impl<'a, V> RefMut<'a, V> { + pub(crate) unsafe fn new(guard: RwLockWriteGuard<'a, ()>, v: *mut V) -> Self { + Self { guard, v } + } + + pub fn value(&self) -> &V { + unsafe { &*self.v } + } + + pub fn value_mut(&mut self) -> &mut V { + unsafe { &mut *self.v } + } +} + +impl<'a, V: Debug> Debug for RefMut<'a, V> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.debug_struct("RefMut").field("v", &self.v).finish() + } +} + +impl<'a, V> Deref for RefMut<'a, V> { + type Target = V; + + fn deref(&self) -> &V { + self.value() + } +} + +impl<'a, V> DerefMut for RefMut<'a, V> { + fn deref_mut(&mut self) -> &mut V { + self.value_mut() + } +} + +impl<'a, V> AsRef<V> for RefMut<'a, V> { + fn as_ref(&self) -> &V { + self.value() + } +} -- 2.51.2