diff --git a/.gitignore b/.gitignore index c5a483d..f41edda 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ node_modules/ # Local databases (SQLite projection + Hydrant fjall store). /data/ /hydrant.db/ +rustc-ice-*.txt \ No newline at end of file diff --git a/.sqlx/query-bc13cd77a5c3359c69ae8ba9a2565c8d23b22f962ee11a5664b6165112737619.json b/.sqlx/query-0c7826d67fe23ddbb7f28959059626d0c5b6f46de83b219711f53fd3f0445293.json similarity index 75% rename from .sqlx/query-bc13cd77a5c3359c69ae8ba9a2565c8d23b22f962ee11a5664b6165112737619.json rename to .sqlx/query-0c7826d67fe23ddbb7f28959059626d0c5b6f46de83b219711f53fd3f0445293.json index 4443a9d..6031700 100644 --- a/.sqlx/query-bc13cd77a5c3359c69ae8ba9a2565c8d23b22f962ee11a5664b6165112737619.json +++ b/.sqlx/query-0c7826d67fe23ddbb7f28959059626d0c5b6f46de83b219711f53fd3f0445293.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE t.did = ? AND (? IS NULL OR t.rkey < ?) ORDER BY t.rkey DESC LIMIT ?", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm JOIN model_parts mp ON mp.model_uri = tm.model_uri WHERE tm.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri WHERE t.uri = ?", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,10 +163,16 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { - "Right": 4 + "Right": 1 }, "nullable": [ false, @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "bc13cd77a5c3359c69ae8ba9a2565c8d23b22f962ee11a5664b6165112737619" + "hash": "0c7826d67fe23ddbb7f28959059626d0c5b6f46de83b219711f53fd3f0445293" } diff --git a/.sqlx/query-46d5a14738e304993be20ba41ad093a2700a06692bb35035f49d33e65c107b61.json b/.sqlx/query-4cefaf929713ed0fc4c580c56bfc02b836d301622afe5171a96f8fe1fdb86516.json similarity index 74% rename from .sqlx/query-46d5a14738e304993be20ba41ad093a2700a06692bb35035f49d33e65c107b61.json rename to .sqlx/query-4cefaf929713ed0fc4c580c56bfc02b836d301622afe5171a96f8fe1fdb86516.json index fabfdc7..dfb0882 100644 --- a/.sqlx/query-46d5a14738e304993be20ba41ad093a2700a06692bb35035f49d33e65c107b61.json +++ b/.sqlx/query-4cefaf929713ed0fc4c580c56bfc02b836d301622afe5171a96f8fe1fdb86516.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE (? IS NULL OR t.rkey < ?) ORDER BY t.rkey DESC LIMIT ?", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm JOIN model_parts mp ON mp.model_uri = tm.model_uri WHERE tm.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE t.did = ? AND (? IS NULL OR t.rkey < ?) ORDER BY t.rkey DESC LIMIT ?", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,10 +163,16 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { - "Right": 3 + "Right": 4 }, "nullable": [ false, @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "46d5a14738e304993be20ba41ad093a2700a06692bb35035f49d33e65c107b61" + "hash": "4cefaf929713ed0fc4c580c56bfc02b836d301622afe5171a96f8fe1fdb86516" } diff --git a/.sqlx/query-897a2d1f52e307ff3ca4e8524cae575ad5f581a37804536933afc0953e45575b.json b/.sqlx/query-67315b099c96cc7bbed2205cf5e361ca6caa42b786d7389c14cbcff0897b5f20.json similarity index 73% rename from .sqlx/query-897a2d1f52e307ff3ca4e8524cae575ad5f581a37804536933afc0953e45575b.json rename to .sqlx/query-67315b099c96cc7bbed2205cf5e361ca6caa42b786d7389c14cbcff0897b5f20.json index ef1763c..dbaadb9 100644 --- a/.sqlx/query-897a2d1f52e307ff3ca4e8524cae575ad5f581a37804536933afc0953e45575b.json +++ b/.sqlx/query-67315b099c96cc7bbed2205cf5e361ca6caa42b786d7389c14cbcff0897b5f20.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm2 WHERE tm2.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM thing_models tm JOIN things t ON t.uri = tm.thing_uri\n LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE tm.model_uri = ? ORDER BY tm.position LIMIT 1", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm2 WHERE tm2.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm2 JOIN model_parts mp ON mp.model_uri = tm2.model_uri WHERE tm2.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM thing_models tm JOIN things t ON t.uri = tm.thing_uri\n LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE tm.model_uri = ? ORDER BY tm.position LIMIT 1", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,6 +163,12 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "897a2d1f52e307ff3ca4e8524cae575ad5f581a37804536933afc0953e45575b" + "hash": "67315b099c96cc7bbed2205cf5e361ca6caa42b786d7389c14cbcff0897b5f20" } diff --git a/.sqlx/query-9a27a6bb73c942408a53d86fc92c2dac59b70517fc4effe6cc853d4d68d909ec.json b/.sqlx/query-7141c9ae0cf701b4e9a5b7791b7583737f2d4f66b8f45c4c83ee9e946ecbd2ec.json similarity index 74% rename from .sqlx/query-9a27a6bb73c942408a53d86fc92c2dac59b70517fc4effe6cc853d4d68d909ec.json rename to .sqlx/query-7141c9ae0cf701b4e9a5b7791b7583737f2d4f66b8f45c4c83ee9e946ecbd2ec.json index a45d733..73d7ea2 100644 --- a/.sqlx/query-9a27a6bb73c942408a53d86fc92c2dac59b70517fc4effe6cc853d4d68d909ec.json +++ b/.sqlx/query-7141c9ae0cf701b4e9a5b7791b7583737f2d4f66b8f45c4c83ee9e946ecbd2ec.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri WHERE t.uri = ?", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm JOIN model_parts mp ON mp.model_uri = tm.model_uri WHERE tm.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n ORDER BY t.created_at DESC LIMIT 500", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,10 +163,16 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { - "Right": 1 + "Right": 0 }, "nullable": [ false, @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "9a27a6bb73c942408a53d86fc92c2dac59b70517fc4effe6cc853d4d68d909ec" + "hash": "7141c9ae0cf701b4e9a5b7791b7583737f2d4f66b8f45c4c83ee9e946ecbd2ec" } diff --git a/.sqlx/query-da8abc59b27f9da8f0dd6ff3788e4d8038594b630a6cc040b32549fe4d13041b.json b/.sqlx/query-93af8d1c75dda925ac1e1090ed104a978eaab466446c34a6c3b18714c0c69349.json similarity index 74% rename from .sqlx/query-da8abc59b27f9da8f0dd6ff3788e4d8038594b630a6cc040b32549fe4d13041b.json rename to .sqlx/query-93af8d1c75dda925ac1e1090ed104a978eaab466446c34a6c3b18714c0c69349.json index 2f0b44c..3c8a081 100644 --- a/.sqlx/query-da8abc59b27f9da8f0dd6ff3788e4d8038594b630a6cc040b32549fe4d13041b.json +++ b/.sqlx/query-93af8d1c75dda925ac1e1090ed104a978eaab466446c34a6c3b18714c0c69349.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n ORDER BY t.created_at DESC LIMIT 500", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm JOIN model_parts mp ON mp.model_uri = tm.model_uri WHERE tm.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM things t LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE (? IS NULL OR t.rkey < ?) ORDER BY t.rkey DESC LIMIT ?", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,10 +163,16 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { - "Right": 0 + "Right": 3 }, "nullable": [ false, @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "da8abc59b27f9da8f0dd6ff3788e4d8038594b630a6cc040b32549fe4d13041b" + "hash": "93af8d1c75dda925ac1e1090ed104a978eaab466446c34a6c3b18714c0c69349" } diff --git a/.sqlx/query-ed5165a08bb4098477c33e047a9fdf73e9c1cd58ccbc3f5ccc87339b8c33152f.json b/.sqlx/query-b55eb8884b7a9b86da1124a104f7b6d2c144c147cc18d4b146682bdd7638addb.json similarity index 81% rename from .sqlx/query-ed5165a08bb4098477c33e047a9fdf73e9c1cd58ccbc3f5ccc87339b8c33152f.json rename to .sqlx/query-b55eb8884b7a9b86da1124a104f7b6d2c144c147cc18d4b146682bdd7638addb.json index a17d24f..df720aa 100644 --- a/.sqlx/query-ed5165a08bb4098477c33e047a9fdf73e9c1cd58ccbc3f5ccc87339b8c33152f.json +++ b/.sqlx/query-b55eb8884b7a9b86da1124a104f7b6d2c144c147cc18d4b146682bdd7638addb.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT p.did AS \"did!\", p.rkey AS \"rkey!\", p.uri AS \"uri!\", p.cid AS \"cid!\",\n p.name AS \"name!\", p.format, p.file_json,\n p.created_at AS \"created_at!\", p.indexed_at AS \"indexed_at!\", p.record_json\n FROM model_parts mp JOIN parts p ON p.uri = mp.part_uri\n WHERE mp.model_uri = ? ORDER BY mp.position", + "query": "SELECT p.did AS \"did!\", p.rkey AS \"rkey!\", p.uri AS \"uri!\", p.cid AS \"cid!\",\n p.name AS \"name!\", p.format, p.file_json AS \"file_json!\",\n p.created_at AS \"created_at!\", p.indexed_at AS \"indexed_at!\", p.record_json\n FROM model_parts mp JOIN parts p ON p.uri = mp.part_uri\n WHERE mp.model_uri = ? ORDER BY mp.position", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "file_json", + "name": "file_json!", "ordinal": 6, "type_info": "Text", "origin": { @@ -124,11 +124,11 @@ false, false, true, - true, + false, false, false, true ] }, - "hash": "ed5165a08bb4098477c33e047a9fdf73e9c1cd58ccbc3f5ccc87339b8c33152f" + "hash": "b55eb8884b7a9b86da1124a104f7b6d2c144c147cc18d4b146682bdd7638addb" } diff --git a/.sqlx/query-9aa94a2ba5dba05557b208df05a9f24a5f814ecd73319be09ffc89bc308f8c97.json b/.sqlx/query-fb69103d9b3d5ae25858bd937c0a9735c5a4fa4730800a04ba731097cfd21e40.json similarity index 72% rename from .sqlx/query-9aa94a2ba5dba05557b208df05a9f24a5f814ecd73319be09ffc89bc308f8c97.json rename to .sqlx/query-fb69103d9b3d5ae25858bd937c0a9735c5a4fa4730800a04ba731097cfd21e40.json index 15fbcc3..0f6cc16 100644 --- a/.sqlx/query-9aa94a2ba5dba05557b208df05a9f24a5f814ecd73319be09ffc89bc308f8c97.json +++ b/.sqlx/query-fb69103d9b3d5ae25858bd937c0a9735c5a4fa4730800a04ba731097cfd21e40.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license, t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\"\n FROM things_fts\n JOIN things t ON t.rowid = things_fts.rowid\n LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE things_fts MATCH ?\n ORDER BY bm25(things_fts, 10.0, 5.0, 3.0, 1.0)\n LIMIT ? OFFSET ?", + "query": "SELECT t.did AS \"did!\", t.rkey AS \"rkey!\", t.uri AS \"uri!\", t.cid AS \"cid!\",\n t.name AS \"name!\", t.summary, t.license AS \"license!\", t.tags_json, t.cover_json,\n t.derived_from_uri, t.created_at AS \"created_at!\", t.indexed_at AS \"indexed_at!\",\n t.record_json,\n COALESCE(cs.like_count, 0) AS \"like_count!: i64\",\n COALESCE(cs.save_count, 0) AS \"save_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm WHERE tm.thing_uri = t.uri) AS \"model_count!: i64\",\n (SELECT COUNT(*) FROM thing_models tm JOIN model_parts mp ON mp.model_uri = tm.model_uri WHERE tm.thing_uri = t.uri) AS \"part_count!: i64\"\n FROM things_fts\n JOIN things t ON t.rowid = things_fts.rowid\n LEFT JOIN content_stats cs ON cs.uri = t.uri\n WHERE things_fts MATCH ?\n ORDER BY bm25(things_fts, 10.0, 5.0, 3.0, 1.0)\n LIMIT ? OFFSET ?", "describe": { "columns": [ { @@ -70,7 +70,7 @@ } }, { - "name": "license", + "name": "license!", "ordinal": 6, "type_info": "Text", "origin": { @@ -163,6 +163,12 @@ "ordinal": 15, "type_info": "Integer", "origin": "Expression" + }, + { + "name": "part_count!: i64", + "ordinal": 16, + "type_info": "Integer", + "origin": "Expression" } ], "parameters": { @@ -175,7 +181,7 @@ false, false, true, - true, + false, true, true, true, @@ -184,8 +190,9 @@ true, false, false, + false, false ] }, - "hash": "9aa94a2ba5dba05557b208df05a9f24a5f814ecd73319be09ffc89bc308f8c97" + "hash": "fb69103d9b3d5ae25858bd937c0a9735c5a4fa4730800a04ba731097cfd21e40" } diff --git a/AGENTS.md b/AGENTS.md index bcd2e6b..a574179 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -79,7 +79,7 @@ Before review or handoff, run at least `just fix` and the narrowest relevant tes - `crates/polymodel-api` is **generated** (DO-NOT-EDIT, no tests). Regenerate with `just generate-api` (`nix run ../jacquard`, the lex-fetch + codegen pipeline). Always fix authored JSON, never generated code. - The generated `Cargo.toml` keeps human content (package, `[workspace.dependencies]`-backed deps, lints, curated `default`/`streaming`/`serde` features) above a `# --- generated ---` marker; codegen rewrites only the namespace features below it. - Jacquard deps are declared once in root `[workspace.dependencies]` and referenced via `workspace = true` in both the app and the generated crate, giving a single jacquard version across the workspace. -- ATProto has no float type: dimension fields (e.g. `bbox` x/y/z) are decimal strings parsed to floats in app code. Images use the `#image` (blobref) / `#imageView` (CDN URL) split in `space.polymodel.library.defs`. +- ATProto has no float type: dimension fields (e.g. `bbox` x/y/z) are decimal strings parsed to floats in app code. Images use the `#image` (blobref) / `#imageView` (CDN URL) split in `space.polymodel.library.defs`. Polymodel `*View` lexicon types are appview/UI contracts: shape them around fields the UI needs, including required hydrated identity/author/count/viewer fields, instead of treating views as lossy transport objects and adding app-local adapter workarounds. Preserve typed ATProto values (`Handle`, `AtUri`, `Datetime`, URI types, etc.) once constructed; do not `.as_str()`/stringify and re-parse them through convenience constructors just to move them between fixtures, helpers, or components. Borrow typed values only at display/serialization boundaries. Keep record-authored fields on records unless a view/feed UI intentionally needs them directly; external or aggregated hydrated metadata such as display tags belongs on view types. ## Agent behavior diff --git a/Cargo.toml b/Cargo.toml index c19f11a..c215157 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ server = [ # XRPC read endpoint handlers (jacquard-axum ExtractXrpc / IntoRouter). "dep:jacquard-axum", # Generated typed XRPC request/response/view types. - "dep:polymodel-api", + # Indexing infrastructure (Hydrant firehose + SQLite projection) "dep:hydrant", "dep:sqlx", @@ -52,7 +52,7 @@ jacquard-axum = { workspace = true, optional = true } jacquard-common = { workspace = true } jacquard-derive = { workspace = true } # Generated lexicon bindings (typed request/response/view types for XRPC routes). -polymodel-api = { path = "crates/polymodel-api", optional = true } +polymodel-api = { path = "crates/polymodel-api" } serde = { workspace = true } serde_json = "1.0" thiserror = { workspace = true } @@ -92,6 +92,7 @@ tracing-subscriber = { version = "0.3", optional = true, default-features = fals "env-filter", ] } + [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] console_error_panic_hook = "0.1" js-sys = "0.3" diff --git a/assets/styling/browse.css b/assets/styling/browse.css index 65bdd5e..711b0a0 100644 --- a/assets/styling/browse.css +++ b/assets/styling/browse.css @@ -121,6 +121,7 @@ padding: 1rem; } +.browse-results-grid, .foundation-grid, .state-grid { display: grid; @@ -168,6 +169,7 @@ justify-content: flex-start; } + .browse-results-grid, .foundation-grid, .state-grid { grid-template-columns: 1fr; diff --git a/assets/styling/cards.css b/assets/styling/cards.css index e9ec8d7..1f838ca 100644 --- a/assets/styling/cards.css +++ b/assets/styling/cards.css @@ -53,6 +53,117 @@ padding: 0.75rem; } +.thing-card { + display: grid; + grid-template-rows: auto 1fr; + min-width: 0; + overflow: hidden; +} + +.thing-card-media { + aspect-ratio: 4 / 3; + min-height: 10rem; +} + +.thing-card-media img { + display: block; + width: 100%; + height: 100%; + object-fit: cover; +} + +.thing-card-placeholder { + display: grid; + min-height: 100%; + align-content: start; +} + +.thing-card-placeholder::before, +.thing-card-placeholder::after { + content: ""; + position: absolute; + inset: 20% 17%; + border: 1px solid var(--color-primary); +} + +.thing-card-placeholder::after { + inset: 34% 28%; + border-color: var(--color-action); +} + +.thing-card-body { + align-content: start; + grid-template-rows: auto auto auto minmax(0, 1fr) auto; +} + +.thing-card-heading { + display: grid; + gap: 0.25rem; + min-width: 0; +} + +.thing-card-title { + font-size: clamp(1rem, 1.8vw, 1.18rem); +} + +.thing-card-creator { + color: var(--color-subtle); + font-size: 0.88rem; +} + +.thing-card-chips { + display: flex; + flex-wrap: wrap; + gap: 0.45rem; +} + +.thing-card-actions { + grid-row: 5; + align-self: end; + display: flex; + justify-content: space-between; + gap: 0.65rem; + margin-top: auto; +} + +.thing-card-stats { + display: flex; + flex-wrap: wrap; + gap: 0.35rem 0.7rem; + margin: 0; + color: var(--color-muted); + font-family: var(--font-mono); + font-size: 0.72rem; +} + +.thing-card-stats div { + display: contents; +} + +.thing-card-stats dt { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +.thing-card-stats dd { + margin: 0; +} + +.thing-card-action { + cursor: default; + color: var(--color-muted); + font-family: var(--font-mono); + font-size: 0.72rem; + letter-spacing: 0.04em; + text-transform: uppercase; +} + .button, .viewer-route-nav a { display: inline-flex; diff --git a/crates/polymodel-api/lexicons/space_polymodel_library_defs.json b/crates/polymodel-api/lexicons/space_polymodel_library_defs.json index 798d793..0365855 100644 --- a/crates/polymodel-api/lexicons/space_polymodel_library_defs.json +++ b/crates/polymodel-api/lexicons/space_polymodel_library_defs.json @@ -4,12 +4,19 @@ "defs": { "actor": { "type": "object", + "required": [ + "did", + "handle" + ], "properties": { "avatar": { "type": "string", "description": "Avatar image URL resolved by the app view (CDN).", "format": "uri" }, + "description": { + "type": "string" + }, "did": { "type": "string", "format": "did" @@ -17,8 +24,126 @@ "displayName": { "type": "string" }, + "followerCount": { + "type": "integer" + }, + "followingCount": { + "type": "integer" + }, "handle": { + "type": "string", + "format": "handle" + }, + "pronouns": { + "type": "string", + "description": "Hydrated profile pronouns for bylines and cards." + }, + "thingCount": { + "type": "integer", + "description": "Count of published Polymodel things by this actor." + }, + "viewer": { + "type": "ref", + "ref": "#actorViewerState" + } + } + }, + "actorViewDetailed": { + "type": "object", + "description": "Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits.", + "required": [ + "did", + "handle", + "record", + "indexedAt", + "viewer" + ], + "properties": { + "avatar": { + "type": "string", + "description": "Avatar image URL resolved by the app view (CDN).", + "format": "uri" + }, + "defaultLicense": { + "type": "string" + }, + "description": { + "type": "string" + }, + "did": { + "type": "string", + "format": "did" + }, + "displayName": { + "type": "string" + }, + "followerCount": { + "type": "integer" + }, + "followingCount": { + "type": "integer" + }, + "handle": { + "type": "string", + "format": "handle" + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "links": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + } + }, + "printers": { + "type": "array", + "items": { + "type": "string" + } + }, + "pronouns": { "type": "string" + }, + "record": { + "type": "unknown" + }, + "thingCount": { + "type": "integer", + "description": "Count of published Polymodel things by this actor." + }, + "viewer": { + "type": "ref", + "ref": "#actorViewerState" + } + } + }, + "actorViewerState": { + "type": "object", + "description": "Viewer-specific relationship state for an actor/profile.", + "properties": { + "blockedBy": { + "type": "boolean" + }, + "blocking": { + "type": "string", + "description": "Block record URI if the requester blocks this actor.", + "format": "at-uri" + }, + "followedBy": { + "type": "string", + "description": "Follow record URI if this actor follows the requester.", + "format": "at-uri" + }, + "following": { + "type": "string", + "description": "Follow record URI if the requester follows this actor.", + "format": "at-uri" + }, + "muted": { + "type": "boolean" } } }, @@ -212,7 +337,10 @@ "cid", "author", "record", - "indexedAt" + "indexedAt", + "name", + "partCount", + "viewer" ], "properties": { "author": { @@ -269,7 +397,10 @@ "cid", "author", "record", - "indexedAt" + "indexedAt", + "name", + "file", + "viewer" ], "properties": { "author": { @@ -320,7 +451,14 @@ "cid", "author", "record", - "indexedAt" + "indexedAt", + "name", + "license", + "likeCount", + "saveCount", + "modelCount", + "partCount", + "viewer" ], "properties": { "author": { @@ -364,6 +502,10 @@ "name": { "type": "string" }, + "partCount": { + "type": "integer", + "description": "Thing-level aggregate count of parts across included models, computed by the app view." + }, "previews": { "type": "array", "items": { @@ -382,6 +524,7 @@ }, "tags": { "type": "array", + "description": "Hydrated display tags, including appview-aggregated external tag assertions.", "items": { "type": "string" } @@ -399,7 +542,16 @@ "thingViewBasic": { "type": "object", "required": [ - "uri" + "uri", + "cid", + "author", + "name", + "likeCount", + "saveCount", + "modelCount", + "partCount", + "indexedAt", + "viewer" ], "properties": { "author": { @@ -429,6 +581,10 @@ "name": { "type": "string" }, + "partCount": { + "type": "integer", + "description": "Thing-level aggregate count of parts across included models, computed by the app view." + }, "previews": { "type": "array", "items": { @@ -439,9 +595,20 @@ "saveCount": { "type": "integer" }, + "tags": { + "type": "array", + "description": "Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions.", + "items": { + "type": "string" + } + }, "uri": { "type": "string", "format": "at-uri" + }, + "viewer": { + "type": "ref", + "ref": "#viewerState" } } }, diff --git a/crates/polymodel-api/src/app_bsky.rs b/crates/polymodel-api/src/app_bsky.rs index 2425be2..63c9c41 100644 --- a/crates/polymodel-api/src/app_bsky.rs +++ b/crates/polymodel-api/src/app_bsky.rs @@ -4,4 +4,4 @@ // Any manual changes will be overwritten on the next regeneration. //! Generated bindings for the `app.bsky` Lexicon namespace/module. -pub mod actor; +pub mod actor; \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor.rs b/crates/polymodel-api/src/app_bsky/actor.rs index e34c8bc..c2e2155 100644 --- a/crates/polymodel-api/src/app_bsky/actor.rs +++ b/crates/polymodel-api/src/app_bsky/actor.rs @@ -16,34 +16,32 @@ pub mod search_actors; pub mod search_actors_typeahead; pub mod status; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{AtUri, Cid, Datetime, Did, Handle, UriValue}; +use jacquard_common::types::string::{Did, Handle, AtUri, Cid, Datetime, UriValue}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::app_bsky::actor; -use crate::com_atproto::label::Label; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label::Label; +use crate::com_atproto::repo::strong_ref::StrongRef; +use crate::app_bsky::actor; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AdultContentPref { /// Defaults to `false`. #[serde(default = "_default_adult_content_pref_enabled")] @@ -55,10 +53,7 @@ pub struct AdultContentPref { /// If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct BskyAppProgressGuide { pub guide: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -68,10 +63,7 @@ pub struct BskyAppProgressGuide { /// A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct BskyAppStatePref { #[serde(skip_serializing_if = "Option::is_none")] pub active_progress_guide: Option>, @@ -85,11 +77,9 @@ pub struct BskyAppStatePref { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ContentLabelPref { pub label: S, ///Which labeler does this preference apply to? If undefined, applies globally. @@ -100,6 +90,7 @@ pub struct ContentLabelPref { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ContentLabelPrefVisibility { Ignore, @@ -152,7 +143,8 @@ impl Serialize for ContentLabelPrefVisibility { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ContentLabelPrefVisibility { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for ContentLabelPrefVisibility { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -190,10 +182,7 @@ where /// Read-only preference containing value(s) inferred from the user's declared birthdate. Absence of this preference object in the response indicates that the user has not made a declaration. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeclaredAgePref { ///Indicates if the user has declared that they are over 13 years of age. #[serde(skip_serializing_if = "Option::is_none")] @@ -208,11 +197,9 @@ pub struct DeclaredAgePref { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct FeedViewPref { ///The URI of the feed, or an identifier which describes the feed. pub feed: S, @@ -236,11 +223,9 @@ pub struct FeedViewPref { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct HiddenPostsPref { ///A list of URIs of posts the account owner has hidden. pub items: Vec>, @@ -248,11 +233,9 @@ pub struct HiddenPostsPref { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct InterestsPref { ///A list of tags which describe the account owner's interests gathered during onboarding. pub tags: Vec, @@ -263,10 +246,7 @@ pub struct InterestsPref { /// The subject's followers whom you also follow #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct KnownFollowers { pub count: i64, pub followers: Vec>, @@ -274,22 +254,18 @@ pub struct KnownFollowers { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct LabelerPrefItem { pub did: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct LabelersPref { pub labelers: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -299,10 +275,7 @@ pub struct LabelersPref { /// Preferences for live events. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct LiveEventPreferences { ///A list of feed IDs that the user has hidden from live events. #[serde(skip_serializing_if = "Option::is_none")] @@ -318,10 +291,7 @@ pub struct LiveEventPreferences { /// A word that the account owner has muted. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct MutedWord { ///Groups of users to apply the muted word to. If undefined, applies to all users. #[serde(skip_serializing_if = "Option::is_none")] @@ -412,12 +382,17 @@ where fn into_static(self) -> Self::Output { match self { MutedWordActorTarget::All => MutedWordActorTarget::All, - MutedWordActorTarget::ExcludeFollowing => MutedWordActorTarget::ExcludeFollowing, - MutedWordActorTarget::Other(v) => MutedWordActorTarget::Other(v.into_static()), + MutedWordActorTarget::ExcludeFollowing => { + MutedWordActorTarget::ExcludeFollowing + } + MutedWordActorTarget::Other(v) => { + MutedWordActorTarget::Other(v.into_static()) + } } } } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum MutedWordTarget { Content, @@ -489,11 +464,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct MutedWordsPref { ///A list of words the account owner has muted. pub items: Vec>, @@ -504,10 +477,7 @@ pub struct MutedWordsPref { /// A new user experiences (NUX) storage object #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Nux { /// Defaults to `false`. #[serde(default = "_default_nux_completed")] @@ -523,11 +493,9 @@ pub struct Nux { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PersonalDetailsPref { ///The birth date of account owner. #[serde(skip_serializing_if = "Option::is_none")] @@ -539,21 +507,21 @@ pub struct PersonalDetailsPref { /// Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PostInteractionSettingsPref { ///Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed. #[serde(skip_serializing_if = "Option::is_none")] pub postgate_embedding_rules: Option>>, ///Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply. #[serde(skip_serializing_if = "Option::is_none")] - pub threadgate_allow_rules: Option>>, + pub threadgate_allow_rules: Option< + Vec>, + >, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -600,10 +568,7 @@ pub enum PreferencesItem { pub type Preferences = Vec>; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileAssociated { #[serde(skip_serializing_if = "Option::is_none")] pub activity_subscription: Option>, @@ -623,19 +588,20 @@ pub struct ProfileAssociated { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileAssociatedActivitySubscription { pub allow_subscriptions: ProfileAssociatedActivitySubscriptionAllowSubscriptions, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum ProfileAssociatedActivitySubscriptionAllowSubscriptions { +pub enum ProfileAssociatedActivitySubscriptionAllowSubscriptions< + S: BosStr = DefaultStr, +> { Followers, Mutuals, None, @@ -662,19 +628,22 @@ impl ProfileAssociatedActivitySubscriptionAllowSubscriptions { } } -impl core::fmt::Display for ProfileAssociatedActivitySubscriptionAllowSubscriptions { +impl core::fmt::Display +for ProfileAssociatedActivitySubscriptionAllowSubscriptions { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } -impl AsRef for ProfileAssociatedActivitySubscriptionAllowSubscriptions { +impl AsRef +for ProfileAssociatedActivitySubscriptionAllowSubscriptions { fn as_ref(&self) -> &str { self.as_str() } } -impl Serialize for ProfileAssociatedActivitySubscriptionAllowSubscriptions { +impl Serialize +for ProfileAssociatedActivitySubscriptionAllowSubscriptions { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, @@ -684,8 +653,7 @@ impl Serialize for ProfileAssociatedActivitySubscriptionAllowSubscrip } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> - for ProfileAssociatedActivitySubscriptionAllowSubscriptions -{ +for ProfileAssociatedActivitySubscriptionAllowSubscriptions { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -695,14 +663,15 @@ impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> } } -impl Default for ProfileAssociatedActivitySubscriptionAllowSubscriptions { +impl Default +for ProfileAssociatedActivitySubscriptionAllowSubscriptions { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic - for ProfileAssociatedActivitySubscriptionAllowSubscriptions +for ProfileAssociatedActivitySubscriptionAllowSubscriptions where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, @@ -720,17 +689,17 @@ where ProfileAssociatedActivitySubscriptionAllowSubscriptions::None } ProfileAssociatedActivitySubscriptionAllowSubscriptions::Other(v) => { - ProfileAssociatedActivitySubscriptionAllowSubscriptions::Other(v.into_static()) + ProfileAssociatedActivitySubscriptionAllowSubscriptions::Other( + v.into_static(), + ) } } } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileAssociatedChat { #[serde(skip_serializing_if = "Option::is_none")] pub allow_group_invites: Option>, @@ -739,6 +708,7 @@ pub struct ProfileAssociatedChat { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ProfileAssociatedChatAllowGroupInvites { All, @@ -789,8 +759,7 @@ impl Serialize for ProfileAssociatedChatAllowGroupInvites { } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> - for ProfileAssociatedChatAllowGroupInvites -{ +for ProfileAssociatedChatAllowGroupInvites { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -830,6 +799,7 @@ where } } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ProfileAssociatedChatAllowIncoming { All, @@ -879,7 +849,8 @@ impl Serialize for ProfileAssociatedChatAllowIncoming { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ProfileAssociatedChatAllowIncoming { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for ProfileAssociatedChatAllowIncoming { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -903,8 +874,12 @@ where type Output = ProfileAssociatedChatAllowIncoming; fn into_static(self) -> Self::Output { match self { - ProfileAssociatedChatAllowIncoming::All => ProfileAssociatedChatAllowIncoming::All, - ProfileAssociatedChatAllowIncoming::None => ProfileAssociatedChatAllowIncoming::None, + ProfileAssociatedChatAllowIncoming::All => { + ProfileAssociatedChatAllowIncoming::All + } + ProfileAssociatedChatAllowIncoming::None => { + ProfileAssociatedChatAllowIncoming::None + } ProfileAssociatedChatAllowIncoming::Following => { ProfileAssociatedChatAllowIncoming::Following } @@ -915,11 +890,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileAssociatedGerm { pub message_me_url: UriValue, pub show_button_to: ProfileAssociatedGermShowButtonTo, @@ -927,6 +900,7 @@ pub struct ProfileAssociatedGerm { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ProfileAssociatedGermShowButtonTo { UsersIFollow, @@ -973,7 +947,8 @@ impl Serialize for ProfileAssociatedGermShowButtonTo { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ProfileAssociatedGermShowButtonTo { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for ProfileAssociatedGermShowButtonTo { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -1010,11 +985,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileView { #[serde(skip_serializing_if = "Option::is_none")] pub associated: Option>, @@ -1047,11 +1020,9 @@ pub struct ProfileView { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileViewBasic { #[serde(skip_serializing_if = "Option::is_none")] pub associated: Option>, @@ -1080,11 +1051,9 @@ pub struct ProfileViewBasic { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileViewDetailed { #[serde(skip_serializing_if = "Option::is_none")] pub associated: Option>, @@ -1131,11 +1100,9 @@ pub struct ProfileViewDetailed { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SavedFeed { pub id: S, pub pinned: bool, @@ -1145,6 +1112,7 @@ pub struct SavedFeed { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum SavedFeedType { Feed, @@ -1226,11 +1194,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SavedFeedsPref { pub pinned: Vec>, pub saved: Vec>, @@ -1240,22 +1206,18 @@ pub struct SavedFeedsPref { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SavedFeedsPrefV2 { pub items: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct StatusView { #[serde(skip_serializing_if = "Option::is_none")] pub cid: Option>, @@ -1357,11 +1319,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ThreadViewPref { ///Sorting mode for threads. #[serde(skip_serializing_if = "Option::is_none")] @@ -1464,10 +1424,7 @@ where /// Preferences for how verified accounts appear in the app. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct VerificationPrefs { ///Hide the blue check badges for verified accounts and trusted verifiers. Defaults to `false`. #[serde(skip_serializing_if = "Option::is_none")] @@ -1480,10 +1437,7 @@ pub struct VerificationPrefs { /// Represents the verification information about the user this object is attached to. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct VerificationState { ///The user's status as a trusted verifier. pub trusted_verifier_status: VerificationStateTrustedVerifierStatus, @@ -1547,8 +1501,7 @@ impl Serialize for VerificationStateTrustedVerifierStatus { } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> - for VerificationStateTrustedVerifierStatus -{ +for VerificationStateTrustedVerifierStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -1639,7 +1592,8 @@ impl Serialize for VerificationStateVerifiedStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for VerificationStateVerifiedStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for VerificationStateVerifiedStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -1663,9 +1617,15 @@ where type Output = VerificationStateVerifiedStatus; fn into_static(self) -> Self::Output { match self { - VerificationStateVerifiedStatus::Valid => VerificationStateVerifiedStatus::Valid, - VerificationStateVerifiedStatus::Invalid => VerificationStateVerifiedStatus::Invalid, - VerificationStateVerifiedStatus::None => VerificationStateVerifiedStatus::None, + VerificationStateVerifiedStatus::Valid => { + VerificationStateVerifiedStatus::Valid + } + VerificationStateVerifiedStatus::Invalid => { + VerificationStateVerifiedStatus::Invalid + } + VerificationStateVerifiedStatus::None => { + VerificationStateVerifiedStatus::None + } VerificationStateVerifiedStatus::Other(v) => { VerificationStateVerifiedStatus::Other(v.into_static()) } @@ -1676,10 +1636,7 @@ where /// An individual verification for an associated subject. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct VerificationView { ///Timestamp when the verification was created. pub created_at: Datetime, @@ -1702,10 +1659,7 @@ pub struct VerificationView { /// Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ViewerState { ///This property is present only in selected cases, as an optimization. #[serde(skip_serializing_if = "Option::is_none")] @@ -2492,7 +2446,7 @@ impl Default for AdultContentPref { pub mod adult_content_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2523,7 +2477,10 @@ pub mod adult_content_pref_state { } /// Builder for constructing an instance of this type. -pub struct AdultContentPrefBuilder { +pub struct AdultContentPrefBuilder< + St: adult_content_pref_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option,), _type: PhantomData S>, @@ -2531,7 +2488,10 @@ pub struct AdultContentPrefBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> AdultContentPrefBuilder { + pub fn new() -> AdultContentPrefBuilder< + adult_content_pref_state::Empty, + DefaultStr, + > { AdultContentPrefBuilder::new() } } @@ -2597,7 +2557,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AdultContentPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AdultContentPref { AdultContentPref { enabled: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -2606,10 +2569,10 @@ where } fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("app.bsky.actor.defs"), @@ -2846,9 +2809,11 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("items"), LexObjectProperty::Array(LexArray { - description: Some(CowStr::new_static( - "A list of URIs of posts the account owner has hidden.", - )), + description: Some( + CowStr::new_static( + "A list of URIs of posts the account owner has hidden.", + ), + ), items: LexArrayItem::String(LexString { format: Some(LexStringFormat::AtUri), ..Default::default() @@ -2893,13 +2858,17 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("knownFollowers"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "The subject's followers whom you also follow", - )), - required: Some(vec![ - SmolStr::new_static("count"), - SmolStr::new_static("followers"), - ]), + description: Some( + CowStr::new_static( + "The subject's followers whom you also follow", + ), + ), + required: Some( + vec![ + SmolStr::new_static("count"), + SmolStr::new_static("followers") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -2970,16 +2939,20 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("liveEventPreferences"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static("Preferences for live events.")), + description: Some( + CowStr::new_static("Preferences for live events."), + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("hiddenFeedIds"), LexObjectProperty::Array(LexArray { - description: Some(CowStr::new_static( - "A list of feed IDs that the user has hidden from live events.", - )), + description: Some( + CowStr::new_static( + "A list of feed IDs that the user has hidden from live events.", + ), + ), items: LexArrayItem::String(LexString { ..Default::default() }), @@ -3089,9 +3062,11 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("items"), LexObjectProperty::Array(LexArray { - description: Some(CowStr::new_static( - "A list of words the account owner has muted.", - )), + description: Some( + CowStr::new_static( + "A list of words the account owner has muted.", + ), + ), items: LexArrayItem::Ref(LexRef { r#ref: CowStr::new_static("app.bsky.actor.defs#mutedWord"), ..Default::default() @@ -3168,9 +3143,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("birthDate"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "The birth date of account owner.", - )), + description: Some( + CowStr::new_static("The birth date of account owner."), + ), format: Some(LexStringFormat::Datetime), ..Default::default() }), @@ -3256,7 +3231,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { CowStr::new_static("#labelersPref"), CowStr::new_static("#postInteractionSettingsPref"), CowStr::new_static("#verificationPrefs"), - CowStr::new_static("#liveEventPreferences"), + CowStr::new_static("#liveEventPreferences") ], ..Default::default() }), @@ -3272,7 +3247,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("activitySubscription"), LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static("#profileAssociatedActivitySubscription"), + r#ref: CowStr::new_static( + "#profileAssociatedActivitySubscription", + ), ..Default::default() }), ); @@ -3328,9 +3305,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("allowSubscriptions"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -3346,15 +3321,11 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("allowGroupInvites"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("allowIncoming"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -3364,10 +3335,12 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("profileAssociatedGerm"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("showButtonTo"), - SmolStr::new_static("messageMeUrl"), - ]), + required: Some( + vec![ + SmolStr::new_static("showButtonTo"), + SmolStr::new_static("messageMeUrl") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -3380,9 +3353,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("showButtonTo"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -3392,10 +3363,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("profileView"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("did"), - SmolStr::new_static("handle"), - ]), + required: Some( + vec![SmolStr::new_static("did"), SmolStr::new_static("handle")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -3475,9 +3445,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("pronouns"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("status"), @@ -3508,10 +3476,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("profileViewBasic"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("did"), - SmolStr::new_static("handle"), - ]), + required: Some( + vec![SmolStr::new_static("did"), SmolStr::new_static("handle")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -3576,9 +3543,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("pronouns"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("status"), @@ -3609,10 +3574,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("profileViewDetailed"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("did"), - SmolStr::new_static("handle"), - ]), + required: Some( + vec![SmolStr::new_static("did"), SmolStr::new_static("handle")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -3733,9 +3697,7 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("pronouns"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("status"), @@ -3773,20 +3735,18 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("savedFeed"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("id"), - SmolStr::new_static("type"), - SmolStr::new_static("value"), - SmolStr::new_static("pinned"), - ]), + required: Some( + vec![ + SmolStr::new_static("id"), SmolStr::new_static("type"), + SmolStr::new_static("value"), SmolStr::new_static("pinned") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("id"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("pinned"), @@ -3796,15 +3756,11 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("type"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("value"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -3814,10 +3770,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("savedFeedsPref"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("pinned"), - SmolStr::new_static("saved"), - ]), + required: Some( + vec![SmolStr::new_static("pinned"), SmolStr::new_static("saved")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -3976,7 +3931,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("sort"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static("Sorting mode for threads.")), + description: Some( + CowStr::new_static("Sorting mode for threads."), + ), ..Default::default() }), ); @@ -3988,9 +3945,11 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("verificationPrefs"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Preferences for how verified accounts appear in the app.", - )), + description: Some( + CowStr::new_static( + "Preferences for how verified accounts appear in the app.", + ), + ), required: Some(vec![]), properties: { #[allow(unused_mut)] @@ -4069,24 +4028,29 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("verificationView"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "An individual verification for an associated subject.", - )), - required: Some(vec![ - SmolStr::new_static("issuer"), - SmolStr::new_static("uri"), - SmolStr::new_static("isValid"), - SmolStr::new_static("createdAt"), - ]), + description: Some( + CowStr::new_static( + "An individual verification for an associated subject.", + ), + ), + required: Some( + vec![ + SmolStr::new_static("issuer"), SmolStr::new_static("uri"), + SmolStr::new_static("isValid"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("createdAt"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "Timestamp when the verification was created.", - )), + description: Some( + CowStr::new_static( + "Timestamp when the verification was created.", + ), + ), format: Some(LexStringFormat::Datetime), ..Default::default() }), @@ -4100,9 +4064,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("issuer"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "The user who issued this verification.", - )), + description: Some( + CowStr::new_static("The user who issued this verification."), + ), format: Some(LexStringFormat::Did), ..Default::default() }), @@ -4110,16 +4074,18 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("issuerDisplayName"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "The display name of the issuer.", - )), + description: Some( + CowStr::new_static("The display name of the issuer."), + ), ..Default::default() }), ); map.insert( SmolStr::new_static("issuerHandle"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static("The handle of the issuer.")), + description: Some( + CowStr::new_static("The handle of the issuer."), + ), format: Some(LexStringFormat::Handle), ..Default::default() }), @@ -4127,9 +4093,9 @@ fn lexicon_doc_app_bsky_actor_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("uri"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "The AT-URI of the verification record.", - )), + description: Some( + CowStr::new_static("The AT-URI of the verification record."), + ), format: Some(LexStringFormat::AtUri), ..Default::default() }), @@ -4234,7 +4200,7 @@ fn _default_feed_view_pref_hide_replies_by_unfollowed() -> Option { pub mod hidden_posts_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4265,7 +4231,10 @@ pub mod hidden_posts_pref_state { } /// Builder for constructing an instance of this type. -pub struct HiddenPostsPrefBuilder { +pub struct HiddenPostsPrefBuilder< + St: hidden_posts_pref_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>,), _type: PhantomData S>, @@ -4339,7 +4308,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> HiddenPostsPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> HiddenPostsPref { HiddenPostsPref { items: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -4349,7 +4321,7 @@ where pub mod interests_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4380,7 +4352,10 @@ pub mod interests_pref_state { } /// Builder for constructing an instance of this type. -pub struct InterestsPrefBuilder { +pub struct InterestsPrefBuilder< + St: interests_pref_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -4454,7 +4429,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> InterestsPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> InterestsPref { InterestsPref { tags: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -4464,7 +4442,7 @@ where pub mod known_followers_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4507,7 +4485,10 @@ pub mod known_followers_state { } /// Builder for constructing an instance of this type. -pub struct KnownFollowersBuilder { +pub struct KnownFollowersBuilder< + St: known_followers_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option>>), _type: PhantomData S>, @@ -4602,7 +4583,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> KnownFollowers { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> KnownFollowers { KnownFollowers { count: self._fields.0.unwrap(), followers: self._fields.1.unwrap(), @@ -4613,7 +4597,7 @@ where pub mod labeler_pref_item_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4644,7 +4628,10 @@ pub mod labeler_pref_item_state { } /// Builder for constructing an instance of this type. -pub struct LabelerPrefItemBuilder { +pub struct LabelerPrefItemBuilder< + St: labeler_pref_item_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -4718,7 +4705,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> LabelerPrefItem { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> LabelerPrefItem { LabelerPrefItem { did: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -4728,7 +4718,7 @@ where pub mod labelers_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4833,7 +4823,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> LabelersPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> LabelersPref { LabelersPref { labelers: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -4857,7 +4850,7 @@ impl Default for LiveEventPreferences { pub mod muted_word_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -4950,7 +4943,10 @@ impl MutedWordBuilder { impl MutedWordBuilder { /// Set the `actorTarget` field (optional) - pub fn actor_target(mut self, value: impl Into>>) -> Self { + pub fn actor_target( + mut self, + value: impl Into>>, + ) -> Self { self._fields.0 = value.into(); self } @@ -5043,7 +5039,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> MutedWord { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> MutedWord { MutedWord { actor_target: self._fields.0, expires_at: self._fields.1, @@ -5057,7 +5056,7 @@ where pub mod muted_words_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -5088,7 +5087,10 @@ pub mod muted_words_pref_state { } /// Builder for constructing an instance of this type. -pub struct MutedWordsPrefBuilder { +pub struct MutedWordsPrefBuilder< + St: muted_words_pref_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>,), _type: PhantomData S>, @@ -5162,7 +5164,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> MutedWordsPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> MutedWordsPref { MutedWordsPref { items: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -5176,7 +5181,7 @@ fn _default_nux_completed() -> bool { pub mod nux_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -5352,7 +5357,7 @@ where pub mod profile_associated_germ_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -5400,23 +5405,26 @@ pub struct ProfileAssociatedGermBuilder< S: BosStr = DefaultStr, > { _state: PhantomData St>, - _fields: ( - Option>, - Option>, - ), + _fields: (Option>, Option>), _type: PhantomData S>, } impl ProfileAssociatedGerm { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ProfileAssociatedGermBuilder { + pub fn new() -> ProfileAssociatedGermBuilder< + profile_associated_germ_state::Empty, + DefaultStr, + > { ProfileAssociatedGermBuilder::new() } } impl ProfileAssociatedGerm { /// Create a new builder for this type - pub fn builder() -> ProfileAssociatedGermBuilder { + pub fn builder() -> ProfileAssociatedGermBuilder< + profile_associated_germ_state::Empty, + S, + > { ProfileAssociatedGermBuilder::builder() } } @@ -5452,7 +5460,10 @@ where pub fn message_me_url( mut self, value: impl Into>, - ) -> ProfileAssociatedGermBuilder, S> { + ) -> ProfileAssociatedGermBuilder< + profile_associated_germ_state::SetMessageMeUrl, + S, + > { self._fields.0 = Option::Some(value.into()); ProfileAssociatedGermBuilder { _state: PhantomData, @@ -5471,7 +5482,10 @@ where pub fn show_button_to( mut self, value: impl Into>, - ) -> ProfileAssociatedGermBuilder, S> { + ) -> ProfileAssociatedGermBuilder< + profile_associated_germ_state::SetShowButtonTo, + S, + > { self._fields.1 = Option::Some(value.into()); ProfileAssociatedGermBuilder { _state: PhantomData, @@ -5510,7 +5524,7 @@ where pub mod profile_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -5594,7 +5608,20 @@ impl ProfileViewBuilder { ProfileViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -5607,7 +5634,20 @@ impl ProfileViewBuilder { ProfileViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -5616,12 +5656,18 @@ impl ProfileViewBuilder { impl ProfileViewBuilder { /// Set the `associated` field (optional) - pub fn associated(mut self, value: impl Into>>) -> Self { + pub fn associated( + mut self, + value: impl Into>>, + ) -> Self { self._fields.0 = value.into(); self } /// Set the `associated` field to an Option value (optional) - pub fn maybe_associated(mut self, value: Option>) -> Self { + pub fn maybe_associated( + mut self, + value: Option>, + ) -> Self { self._fields.0 = value; self } @@ -5784,12 +5830,18 @@ impl ProfileViewBuilder { impl ProfileViewBuilder { /// Set the `verification` field (optional) - pub fn verification(mut self, value: impl Into>>) -> Self { + pub fn verification( + mut self, + value: impl Into>>, + ) -> Self { self._fields.12 = value.into(); self } /// Set the `verification` field to an Option value (optional) - pub fn maybe_verification(mut self, value: Option>) -> Self { + pub fn maybe_verification( + mut self, + value: Option>, + ) -> Self { self._fields.12 = value; self } @@ -5835,7 +5887,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ProfileView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ProfileView { ProfileView { associated: self._fields.0, avatar: self._fields.1, @@ -5858,7 +5913,7 @@ where pub mod profile_view_basic_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -5901,7 +5956,10 @@ pub mod profile_view_basic_state { } /// Builder for constructing an instance of this type. -pub struct ProfileViewBasicBuilder { +pub struct ProfileViewBasicBuilder< + St: profile_view_basic_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: ( Option>, @@ -5922,7 +5980,10 @@ pub struct ProfileViewBasicBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ProfileViewBasicBuilder { + pub fn new() -> ProfileViewBasicBuilder< + profile_view_basic_state::Empty, + DefaultStr, + > { ProfileViewBasicBuilder::new() } } @@ -5940,7 +6001,18 @@ impl ProfileViewBasicBuilder { ProfileViewBasicBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -5953,7 +6025,18 @@ impl ProfileViewBasicBuilder { ProfileViewBasicBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -5962,12 +6045,18 @@ impl ProfileViewBasicBuilder { impl ProfileViewBasicBuilder { /// Set the `associated` field (optional) - pub fn associated(mut self, value: impl Into>>) -> Self { + pub fn associated( + mut self, + value: impl Into>>, + ) -> Self { self._fields.0 = value.into(); self } /// Set the `associated` field to an Option value (optional) - pub fn maybe_associated(mut self, value: Option>) -> Self { + pub fn maybe_associated( + mut self, + value: Option>, + ) -> Self { self._fields.0 = value; self } @@ -6104,12 +6193,18 @@ impl ProfileViewBasicBuilder ProfileViewBasicBuilder { /// Set the `verification` field (optional) - pub fn verification(mut self, value: impl Into>>) -> Self { + pub fn verification( + mut self, + value: impl Into>>, + ) -> Self { self._fields.10 = value.into(); self } /// Set the `verification` field to an Option value (optional) - pub fn maybe_verification(mut self, value: Option>) -> Self { + pub fn maybe_verification( + mut self, + value: Option>, + ) -> Self { self._fields.10 = value; self } @@ -6153,7 +6248,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ProfileViewBasic { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ProfileViewBasic { ProfileViewBasic { associated: self._fields.0, avatar: self._fields.1, @@ -6174,7 +6272,7 @@ where pub mod profile_view_detailed_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -6250,14 +6348,20 @@ pub struct ProfileViewDetailedBuilder< impl ProfileViewDetailed { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ProfileViewDetailedBuilder { + pub fn new() -> ProfileViewDetailedBuilder< + profile_view_detailed_state::Empty, + DefaultStr, + > { ProfileViewDetailedBuilder::new() } } impl ProfileViewDetailed { /// Create a new builder for this type - pub fn builder() -> ProfileViewDetailedBuilder { + pub fn builder() -> ProfileViewDetailedBuilder< + profile_view_detailed_state::Empty, + S, + > { ProfileViewDetailedBuilder::builder() } } @@ -6268,8 +6372,27 @@ impl ProfileViewDetailedBuilder ProfileViewDetailedBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -6282,28 +6405,59 @@ impl ProfileViewDetailedBuilder ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `associated` field (optional) - pub fn associated(mut self, value: impl Into>>) -> Self { + pub fn associated( + mut self, + value: impl Into>>, + ) -> Self { self._fields.0 = value.into(); self } /// Set the `associated` field to an Option value (optional) - pub fn maybe_associated(mut self, value: Option>) -> Self { + pub fn maybe_associated( + mut self, + value: Option>, + ) -> Self { self._fields.0 = value; self } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `avatar` field (optional) pub fn avatar(mut self, value: impl Into>>) -> Self { self._fields.1 = value.into(); @@ -6316,7 +6470,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `banner` field (optional) pub fn banner(mut self, value: impl Into>>) -> Self { self._fields.2 = value.into(); @@ -6329,7 +6486,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `createdAt` field (optional) pub fn created_at(mut self, value: impl Into>) -> Self { self._fields.3 = value.into(); @@ -6342,7 +6502,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `debug` field (optional) pub fn debug(mut self, value: impl Into>>) -> Self { self._fields.4 = value.into(); @@ -6355,7 +6518,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `description` field (optional) pub fn description(mut self, value: impl Into>) -> Self { self._fields.5 = value.into(); @@ -6387,7 +6553,10 @@ where } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `displayName` field (optional) pub fn display_name(mut self, value: impl Into>) -> Self { self._fields.7 = value.into(); @@ -6400,7 +6569,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `followersCount` field (optional) pub fn followers_count(mut self, value: impl Into>) -> Self { self._fields.8 = value.into(); @@ -6413,7 +6585,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `followsCount` field (optional) pub fn follows_count(mut self, value: impl Into>) -> Self { self._fields.9 = value.into(); @@ -6445,7 +6620,10 @@ where } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `indexedAt` field (optional) pub fn indexed_at(mut self, value: impl Into>) -> Self { self._fields.11 = value.into(); @@ -6458,7 +6636,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `joinedViaStarterPack` field (optional) pub fn joined_via_starter_pack(mut self, value: impl Into>>) -> Self { self._fields.12 = value.into(); @@ -6471,7 +6652,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `labels` field (optional) pub fn labels(mut self, value: impl Into>>>) -> Self { self._fields.13 = value.into(); @@ -6484,7 +6668,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `pinnedPost` field (optional) pub fn pinned_post(mut self, value: impl Into>>) -> Self { self._fields.14 = value.into(); @@ -6497,7 +6684,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `postsCount` field (optional) pub fn posts_count(mut self, value: impl Into>) -> Self { self._fields.15 = value.into(); @@ -6510,7 +6700,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `pronouns` field (optional) pub fn pronouns(mut self, value: impl Into>) -> Self { self._fields.16 = value.into(); @@ -6523,7 +6716,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `status` field (optional) pub fn status(mut self, value: impl Into>>) -> Self { self._fields.17 = value.into(); @@ -6536,20 +6732,32 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `verification` field (optional) - pub fn verification(mut self, value: impl Into>>) -> Self { + pub fn verification( + mut self, + value: impl Into>>, + ) -> Self { self._fields.18 = value.into(); self } /// Set the `verification` field to an Option value (optional) - pub fn maybe_verification(mut self, value: Option>) -> Self { + pub fn maybe_verification( + mut self, + value: Option>, + ) -> Self { self._fields.18 = value; self } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `viewer` field (optional) pub fn viewer(mut self, value: impl Into>>) -> Self { self._fields.19 = value.into(); @@ -6562,7 +6770,10 @@ impl ProfileViewDetailedBuild } } -impl ProfileViewDetailedBuilder { +impl< + St: profile_view_detailed_state::State, + S: BosStr, +> ProfileViewDetailedBuilder { /// Set the `website` field (optional) pub fn website(mut self, value: impl Into>>) -> Self { self._fields.20 = value.into(); @@ -6609,7 +6820,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ProfileViewDetailed { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ProfileViewDetailed { ProfileViewDetailed { associated: self._fields.0, avatar: self._fields.1, @@ -6639,7 +6853,7 @@ where pub mod saved_feed_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -6760,7 +6974,10 @@ where St::Id: saved_feed_state::IsUnset, { /// Set the `id` field (required) - pub fn id(mut self, value: impl Into) -> SavedFeedBuilder, S> { + pub fn id( + mut self, + value: impl Into, + ) -> SavedFeedBuilder, S> { self._fields.0 = Option::Some(value.into()); SavedFeedBuilder { _state: PhantomData, @@ -6846,7 +7063,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SavedFeed { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SavedFeed { SavedFeed { id: self._fields.0.unwrap(), pinned: self._fields.1.unwrap(), @@ -6859,7 +7079,7 @@ where pub mod saved_feeds_pref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -6902,7 +7122,10 @@ pub mod saved_feeds_pref_state { } /// Builder for constructing an instance of this type. -pub struct SavedFeedsPrefBuilder { +pub struct SavedFeedsPrefBuilder< + St: saved_feeds_pref_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>, Option>>, Option), _type: PhantomData S>, @@ -7011,7 +7234,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SavedFeedsPref { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SavedFeedsPref { SavedFeedsPref { pinned: self._fields.0.unwrap(), saved: self._fields.1.unwrap(), @@ -7023,7 +7249,7 @@ where pub mod saved_feeds_pref_v2_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -7054,7 +7280,10 @@ pub mod saved_feeds_pref_v2_state { } /// Builder for constructing an instance of this type. -pub struct SavedFeedsPrefV2Builder { +pub struct SavedFeedsPrefV2Builder< + St: saved_feeds_pref_v2_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>,), _type: PhantomData S>, @@ -7062,7 +7291,10 @@ pub struct SavedFeedsPrefV2Builder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> SavedFeedsPrefV2Builder { + pub fn new() -> SavedFeedsPrefV2Builder< + saved_feeds_pref_v2_state::Empty, + DefaultStr, + > { SavedFeedsPrefV2Builder::new() } } @@ -7128,7 +7360,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SavedFeedsPrefV2 { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SavedFeedsPrefV2 { SavedFeedsPrefV2 { items: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -7138,7 +7373,7 @@ where pub mod status_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -7384,7 +7619,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> StatusView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> StatusView { StatusView { cid: self._fields.0, embed: self._fields.1, @@ -7415,7 +7653,7 @@ impl Default for VerificationPrefs { pub mod verification_state_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -7472,7 +7710,10 @@ pub mod verification_state_state { } /// Builder for constructing an instance of this type. -pub struct VerificationStateBuilder { +pub struct VerificationStateBuilder< + St: verification_state_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: ( Option>, @@ -7484,7 +7725,10 @@ pub struct VerificationStateBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> VerificationStateBuilder { + pub fn new() -> VerificationStateBuilder< + verification_state_state::Empty, + DefaultStr, + > { VerificationStateBuilder::new() } } @@ -7527,7 +7771,10 @@ where pub fn trusted_verifier_status( mut self, value: impl Into>, - ) -> VerificationStateBuilder, S> { + ) -> VerificationStateBuilder< + verification_state_state::SetTrustedVerifierStatus, + S, + > { self._fields.0 = Option::Some(value.into()); VerificationStateBuilder { _state: PhantomData, @@ -7592,7 +7839,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> VerificationState { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> VerificationState { VerificationState { trusted_verifier_status: self._fields.0.unwrap(), verifications: self._fields.1.unwrap(), @@ -7604,7 +7854,7 @@ where pub mod verification_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -7677,7 +7927,10 @@ pub mod verification_view_state { } /// Builder for constructing an instance of this type. -pub struct VerificationViewBuilder { +pub struct VerificationViewBuilder< + St: verification_view_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: ( Option, @@ -7849,7 +8102,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> VerificationView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> VerificationView { VerificationView { created_at: self._fields.0.unwrap(), is_valid: self._fields.1.unwrap(), @@ -7860,4 +8116,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/get_preferences.rs b/crates/polymodel-api/src/app_bsky/actor/get_preferences.rs index 7ecd7da..b313c96 100644 --- a/crates/polymodel-api/src/app_bsky/actor/get_preferences.rs +++ b/crates/polymodel-api/src/app_bsky/actor/get_preferences.rs @@ -8,24 +8,21 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::Preferences; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::Preferences; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetPreferences; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetPreferencesOutput { pub preferences: Preferences, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -58,4 +55,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetPreferencesRequest { const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = GetPreferences; type Response = GetPreferencesResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/get_profile.rs b/crates/polymodel-api/src/app_bsky/actor/get_profile.rs index da4aa3b..9a632af 100644 --- a/crates/polymodel-api/src/app_bsky/actor/get_profile.rs +++ b/crates/polymodel-api/src/app_bsky/actor/get_profile.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::ProfileViewDetailed; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileViewDetailed; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfile { pub actor: AtIdentifier, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfileOutput { #[serde(flatten)] pub value: ProfileViewDetailed, @@ -69,7 +64,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetProfileRequest { pub mod get_profile_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -172,4 +167,4 @@ where actor: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/get_profiles.rs b/crates/polymodel-api/src/app_bsky/actor/get_profiles.rs index dfcf53d..f9f17b6 100644 --- a/crates/polymodel-api/src/app_bsky/actor/get_profiles.rs +++ b/crates/polymodel-api/src/app_bsky/actor/get_profiles.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::ProfileViewDetailed; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileViewDetailed; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfiles { pub actors: Vec>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfilesOutput { pub profiles: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -68,7 +63,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetProfilesRequest { pub mod get_profiles_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -171,4 +166,4 @@ where actors: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/get_suggestions.rs b/crates/polymodel-api/src/app_bsky/actor/get_suggestions.rs index a1d7311..69630e1 100644 --- a/crates/polymodel-api/src/app_bsky/actor/get_suggestions.rs +++ b/crates/polymodel-api/src/app_bsky/actor/get_suggestions.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::ProfileView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSuggestions { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -31,11 +28,9 @@ pub struct GetSuggestions { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSuggestionsOutput { pub actors: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -84,7 +79,7 @@ fn _default_limit() -> Option { pub mod get_suggestions_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -102,7 +97,10 @@ pub mod get_suggestions_state { } /// Builder for constructing an instance of this type. -pub struct GetSuggestionsBuilder { +pub struct GetSuggestionsBuilder< + St: get_suggestions_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option), _type: PhantomData S>, @@ -181,4 +179,4 @@ where limit: self._fields.1, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/profile.rs b/crates/polymodel-api/src/app_bsky/actor/profile.rs index 44e4ebd..ae41fad 100644 --- a/crates/polymodel-api/src/app_bsky/actor/profile.rs +++ b/crates/polymodel-api/src/app_bsky/actor/profile.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -25,11 +25,11 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::label::SelfLabels; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label::SelfLabels; +use crate::com_atproto::repo::strong_ref::StrongRef; /// A declaration of a Bluesky account profile. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -140,20 +140,25 @@ impl LexiconSchema for Profile { { let mime = value.blob().mime_type.as_str(); let accepted: &[&str] = &["image/png", "image/jpeg"]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("avatar"), - accepted: vec!["image/png".to_string(), "image/jpeg".to_string()], + accepted: vec![ + "image/png".to_string(), "image/jpeg".to_string() + ], actual: mime.to_string(), }); } @@ -175,20 +180,25 @@ impl LexiconSchema for Profile { { let mime = value.blob().mime_type.as_str(); let accepted: &[&str] = &["image/png", "image/jpeg"]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("banner"), - accepted: vec!["image/png".to_string(), "image/jpeg".to_string()], + accepted: vec![ + "image/png".to_string(), "image/jpeg".to_string() + ], actual: mime.to_string(), }); } @@ -266,7 +276,7 @@ impl LexiconSchema for Profile { pub mod profile_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -404,7 +414,10 @@ impl ProfileBuilder { impl ProfileBuilder { /// Set the `joinedViaStarterPack` field (optional) - pub fn joined_via_starter_pack(mut self, value: impl Into>>) -> Self { + pub fn joined_via_starter_pack( + mut self, + value: impl Into>>, + ) -> Self { self._fields.5 = value.into(); self } @@ -506,10 +519,10 @@ where } fn lexicon_doc_app_bsky_actor_profile() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("app.bsky.actor.profile"), @@ -617,4 +630,4 @@ fn lexicon_doc_app_bsky_actor_profile() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/put_preferences.rs b/crates/polymodel-api/src/app_bsky/actor/put_preferences.rs index ef940dd..66da43e 100644 --- a/crates/polymodel-api/src/app_bsky/actor/put_preferences.rs +++ b/crates/polymodel-api/src/app_bsky/actor/put_preferences.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::Preferences; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::Preferences; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PutPreferences { pub preferences: Preferences, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -41,8 +38,9 @@ impl jacquard_common::xrpc::XrpcResp for PutPreferencesResponse { impl jacquard_common::xrpc::XrpcRequest for PutPreferences { const NSID: &'static str = "app.bsky.actor.putPreferences"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = PutPreferencesResponse; } @@ -52,15 +50,16 @@ Path: `/xrpc/app.bsky.actor.putPreferences`. The request payload type is `PutPre pub struct PutPreferencesRequest; impl jacquard_common::xrpc::XrpcEndpoint for PutPreferencesRequest { const PATH: &'static str = "/xrpc/app.bsky.actor.putPreferences"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = PutPreferences; type Response = PutPreferencesResponse; } pub mod put_preferences_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -91,7 +90,10 @@ pub mod put_preferences_state { } /// Builder for constructing an instance of this type. -pub struct PutPreferencesBuilder { +pub struct PutPreferencesBuilder< + St: put_preferences_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -165,10 +167,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> PutPreferences { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> PutPreferences { PutPreferences { preferences: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/search_actors.rs b/crates/polymodel-api/src/app_bsky/actor/search_actors.rs index 6cab27b..99e3021 100644 --- a/crates/polymodel-api/src/app_bsky/actor/search_actors.rs +++ b/crates/polymodel-api/src/app_bsky/actor/search_actors.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::ProfileView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchActors { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -35,11 +32,9 @@ pub struct SearchActors { pub term: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchActorsOutput { pub actors: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -82,7 +77,7 @@ fn _default_limit() -> Option { pub mod search_actors_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -207,4 +202,4 @@ where term: self._fields.3, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/search_actors_typeahead.rs b/crates/polymodel-api/src/app_bsky/actor/search_actors_typeahead.rs index 4f37aef..45acee0 100644 --- a/crates/polymodel-api/src/app_bsky/actor/search_actors_typeahead.rs +++ b/crates/polymodel-api/src/app_bsky/actor/search_actors_typeahead.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::app_bsky::actor::ProfileViewBasic; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileViewBasic; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchActorsTypeahead { /// Defaults to `10`. Min: 1. Max: 100. #[serde(default = "_default_limit")] @@ -33,11 +30,9 @@ pub struct SearchActorsTypeahead { pub term: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchActorsTypeaheadOutput { pub actors: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -78,7 +73,7 @@ fn _default_limit() -> Option { pub mod search_actors_typeahead_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -107,14 +102,20 @@ pub struct SearchActorsTypeaheadBuilder< impl SearchActorsTypeahead { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> SearchActorsTypeaheadBuilder { + pub fn new() -> SearchActorsTypeaheadBuilder< + search_actors_typeahead_state::Empty, + DefaultStr, + > { SearchActorsTypeaheadBuilder::new() } } impl SearchActorsTypeahead { /// Create a new builder for this type - pub fn builder() -> SearchActorsTypeaheadBuilder { + pub fn builder() -> SearchActorsTypeaheadBuilder< + search_actors_typeahead_state::Empty, + S, + > { SearchActorsTypeaheadBuilder::builder() } } @@ -141,7 +142,10 @@ impl SearchActorsTypeaheadBuilder SearchActorsTypeaheadBuilder { +impl< + St: search_actors_typeahead_state::State, + S: BosStr, +> SearchActorsTypeaheadBuilder { /// Set the `limit` field (optional) pub fn limit(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); @@ -154,7 +158,10 @@ impl SearchActorsTypeaheadB } } -impl SearchActorsTypeaheadBuilder { +impl< + St: search_actors_typeahead_state::State, + S: BosStr, +> SearchActorsTypeaheadBuilder { /// Set the `q` field (optional) pub fn q(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); @@ -167,7 +174,10 @@ impl SearchActorsTypeaheadB } } -impl SearchActorsTypeaheadBuilder { +impl< + St: search_actors_typeahead_state::State, + S: BosStr, +> SearchActorsTypeaheadBuilder { /// Set the `term` field (optional) pub fn term(mut self, value: impl Into>) -> Self { self._fields.2 = value.into(); @@ -192,4 +202,4 @@ where term: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/app_bsky/actor/status.rs b/crates/polymodel-api/src/app_bsky/actor/status.rs index 5ca1c44..7c9adaa 100644 --- a/crates/polymodel-api/src/app_bsky/actor/status.rs +++ b/crates/polymodel-api/src/app_bsky/actor/status.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -26,7 +26,7 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /// Advertises an account as currently offering live content. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] @@ -205,7 +205,7 @@ impl LexiconSchema for Status { pub mod status_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -250,12 +250,7 @@ pub mod status_state { /// Builder for constructing an instance of this type. pub struct StatusBuilder { _state: PhantomData St>, - _fields: ( - Option, - Option, - Option>, - Option>, - ), + _fields: (Option, Option, Option>, Option>), _type: PhantomData S>, } @@ -388,10 +383,10 @@ where } fn lexicon_doc_app_bsky_actor_status() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("app.bsky.actor.status"), @@ -399,22 +394,22 @@ fn lexicon_doc_app_bsky_actor_status() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("live"), - LexUserType::Token(LexToken { - ..Default::default() - }), + LexUserType::Token(LexToken { ..Default::default() }), ); map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "A declaration of a Bluesky account status.", - )), + description: Some( + CowStr::new_static("A declaration of a Bluesky account status."), + ), key: Some(CowStr::new_static("literal:self")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("status"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("status"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -435,9 +430,11 @@ fn lexicon_doc_app_bsky_actor_status() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("embed"), LexObjectProperty::Union(LexRefUnion { - description: Some(CowStr::new_static( - "An optional embed associated with the status.", - )), + description: Some( + CowStr::new_static( + "An optional embed associated with the status.", + ), + ), refs: vec![CowStr::new_static("app.bsky.embed.external")], ..Default::default() }), @@ -445,9 +442,9 @@ fn lexicon_doc_app_bsky_actor_status() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("status"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "The status for the account.", - )), + description: Some( + CowStr::new_static("The status for the account."), + ), ..Default::default() }), ); @@ -462,4 +459,4 @@ fn lexicon_doc_app_bsky_actor_status() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/builder_types.rs b/crates/polymodel-api/src/builder_types.rs index dea82dc..cd45c2e 100644 --- a/crates/polymodel-api/src/builder_types.rs +++ b/crates/polymodel-api/src/builder_types.rs @@ -42,4 +42,4 @@ mod private { pub trait Sealed {} impl Sealed for super::Set {} impl Sealed for super::Unset {} -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto.rs b/crates/polymodel-api/src/com_atproto.rs index 4e134e1..d44b105 100644 --- a/crates/polymodel-api/src/com_atproto.rs +++ b/crates/polymodel-api/src/com_atproto.rs @@ -12,4 +12,4 @@ pub mod moderation; pub mod repo; pub mod server; pub mod sync; -pub mod temp; +pub mod temp; \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin.rs b/crates/polymodel-api/src/com_atproto/admin.rs index 05f5b96..0d74484 100644 --- a/crates/polymodel-api/src/com_atproto/admin.rs +++ b/crates/polymodel-api/src/com_atproto/admin.rs @@ -22,33 +22,31 @@ pub mod update_account_password; pub mod update_account_signing_key; pub mod update_subject_status; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{AtUri, Cid, Datetime, Did, Handle}; +use jacquard_common::types::string::{Did, Handle, AtUri, Cid, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::admin; -use crate::com_atproto::server::InviteCode; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::InviteCode; +use crate::com_atproto::admin; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AccountView { #[serde(skip_serializing_if = "Option::is_none")] pub deactivated_at: Option, @@ -75,11 +73,9 @@ pub struct AccountView { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RepoBlobRef { pub cid: Cid, pub did: Did, @@ -89,22 +85,18 @@ pub struct RepoBlobRef { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RepoRef { pub did: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct StatusAttr { pub applied: bool, #[serde(skip_serializing_if = "Option::is_none")] @@ -113,11 +105,9 @@ pub struct StatusAttr { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ThreatSignature { pub property: S, pub value: S, @@ -202,7 +192,7 @@ impl LexiconSchema for ThreatSignature { pub mod account_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -298,7 +288,18 @@ impl AccountViewBuilder { AccountViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -311,7 +312,18 @@ impl AccountViewBuilder { AccountViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -524,7 +536,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AccountView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AccountView { AccountView { deactivated_at: self._fields.0, did: self._fields.1.unwrap(), @@ -544,10 +559,10 @@ where } fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.admin.defs"), @@ -556,11 +571,12 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("accountView"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("did"), - SmolStr::new_static("handle"), - SmolStr::new_static("indexedAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("did"), SmolStr::new_static("handle"), + SmolStr::new_static("indexedAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -580,9 +596,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("email"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("emailConfirmedAt"), @@ -607,14 +621,14 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("inviteNote"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("invitedBy"), LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static("com.atproto.server.defs#inviteCode"), + r#ref: CowStr::new_static( + "com.atproto.server.defs#inviteCode", + ), ..Default::default() }), ); @@ -622,7 +636,9 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { SmolStr::new_static("invites"), LexObjectProperty::Array(LexArray { items: LexArrayItem::Ref(LexRef { - r#ref: CowStr::new_static("com.atproto.server.defs#inviteCode"), + r#ref: CowStr::new_static( + "com.atproto.server.defs#inviteCode", + ), ..Default::default() }), ..Default::default() @@ -661,7 +677,9 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("repoBlobRef"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("did"), SmolStr::new_static("cid")]), + required: Some( + vec![SmolStr::new_static("did"), SmolStr::new_static("cid")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -725,9 +743,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("ref"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -737,24 +753,21 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("threatSignature"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("property"), - SmolStr::new_static("value"), - ]), + required: Some( + vec![ + SmolStr::new_static("property"), SmolStr::new_static("value") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("property"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("value"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -769,7 +782,7 @@ fn lexicon_doc_com_atproto_admin_defs() -> LexiconDoc<'static> { pub mod repo_blob_ref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -921,7 +934,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> RepoBlobRef { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> RepoBlobRef { RepoBlobRef { cid: self._fields.0.unwrap(), did: self._fields.1.unwrap(), @@ -933,7 +949,7 @@ where pub mod repo_ref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1048,7 +1064,7 @@ where pub mod status_attr_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1167,11 +1183,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> StatusAttr { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> StatusAttr { StatusAttr { applied: self._fields.0.unwrap(), r#ref: self._fields.1, extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/delete_account.rs b/crates/polymodel-api/src/com_atproto/admin/delete_account.rs index da61eaa..cb8ecc6 100644 --- a/crates/polymodel-api/src/com_atproto/admin/delete_account.rs +++ b/crates/polymodel-api/src/com_atproto/admin/delete_account.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeleteAccount { pub did: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -41,8 +38,9 @@ impl jacquard_common::xrpc::XrpcResp for DeleteAccountResponse { impl jacquard_common::xrpc::XrpcRequest for DeleteAccount { const NSID: &'static str = "com.atproto.admin.deleteAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DeleteAccountResponse; } @@ -52,15 +50,16 @@ Path: `/xrpc/com.atproto.admin.deleteAccount`. The request payload type is `Dele pub struct DeleteAccountRequest; impl jacquard_common::xrpc::XrpcEndpoint for DeleteAccountRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.deleteAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DeleteAccount; type Response = DeleteAccountResponse; } pub mod delete_account_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -91,7 +90,10 @@ pub mod delete_account_state { } /// Builder for constructing an instance of this type. -pub struct DeleteAccountBuilder { +pub struct DeleteAccountBuilder< + St: delete_account_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -165,10 +167,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> DeleteAccount { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> DeleteAccount { DeleteAccount { did: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/disable_account_invites.rs b/crates/polymodel-api/src/com_atproto/admin/disable_account_invites.rs index 10388a0..100981b 100644 --- a/crates/polymodel-api/src/com_atproto/admin/disable_account_invites.rs +++ b/crates/polymodel-api/src/com_atproto/admin/disable_account_invites.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DisableAccountInvites { pub account: Did, ///Optional reason for disabled invites. @@ -44,8 +41,9 @@ impl jacquard_common::xrpc::XrpcResp for DisableAccountInvitesResponse { impl jacquard_common::xrpc::XrpcRequest for DisableAccountInvites { const NSID: &'static str = "com.atproto.admin.disableAccountInvites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DisableAccountInvitesResponse; } @@ -55,15 +53,16 @@ Path: `/xrpc/com.atproto.admin.disableAccountInvites`. The request payload type pub struct DisableAccountInvitesRequest; impl jacquard_common::xrpc::XrpcEndpoint for DisableAccountInvitesRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.disableAccountInvites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DisableAccountInvites; type Response = DisableAccountInvitesResponse; } pub mod disable_account_invites_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -105,14 +104,20 @@ pub struct DisableAccountInvitesBuilder< impl DisableAccountInvites { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> DisableAccountInvitesBuilder { + pub fn new() -> DisableAccountInvitesBuilder< + disable_account_invites_state::Empty, + DefaultStr, + > { DisableAccountInvitesBuilder::new() } } impl DisableAccountInvites { /// Create a new builder for this type - pub fn builder() -> DisableAccountInvitesBuilder { + pub fn builder() -> DisableAccountInvitesBuilder< + disable_account_invites_state::Empty, + S, + > { DisableAccountInvitesBuilder::builder() } } @@ -158,7 +163,10 @@ where } } -impl DisableAccountInvitesBuilder { +impl< + St: disable_account_invites_state::State, + S: BosStr, +> DisableAccountInvitesBuilder { /// Set the `note` field (optional) pub fn note(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); @@ -195,4 +203,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/disable_invite_codes.rs b/crates/polymodel-api/src/com_atproto/admin/disable_invite_codes.rs index febe719..4161128 100644 --- a/crates/polymodel-api/src/com_atproto/admin/disable_invite_codes.rs +++ b/crates/polymodel-api/src/com_atproto/admin/disable_invite_codes.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DisableInviteCodes { #[serde(skip_serializing_if = "Option::is_none")] pub accounts: Option>, @@ -43,8 +40,9 @@ impl jacquard_common::xrpc::XrpcResp for DisableInviteCodesResponse { impl jacquard_common::xrpc::XrpcRequest for DisableInviteCodes { const NSID: &'static str = "com.atproto.admin.disableInviteCodes"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DisableInviteCodesResponse; } @@ -54,8 +52,9 @@ Path: `/xrpc/com.atproto.admin.disableInviteCodes`. The request payload type is pub struct DisableInviteCodesRequest; impl jacquard_common::xrpc::XrpcEndpoint for DisableInviteCodesRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.disableInviteCodes"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DisableInviteCodes; type Response = DisableInviteCodesResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/enable_account_invites.rs b/crates/polymodel-api/src/com_atproto/admin/enable_account_invites.rs index 73154b2..38857c0 100644 --- a/crates/polymodel-api/src/com_atproto/admin/enable_account_invites.rs +++ b/crates/polymodel-api/src/com_atproto/admin/enable_account_invites.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct EnableAccountInvites { pub account: Did, ///Optional reason for enabled invites. @@ -44,8 +41,9 @@ impl jacquard_common::xrpc::XrpcResp for EnableAccountInvitesResponse { impl jacquard_common::xrpc::XrpcRequest for EnableAccountInvites { const NSID: &'static str = "com.atproto.admin.enableAccountInvites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = EnableAccountInvitesResponse; } @@ -55,15 +53,16 @@ Path: `/xrpc/com.atproto.admin.enableAccountInvites`. The request payload type i pub struct EnableAccountInvitesRequest; impl jacquard_common::xrpc::XrpcEndpoint for EnableAccountInvitesRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.enableAccountInvites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = EnableAccountInvites; type Response = EnableAccountInvitesResponse; } pub mod enable_account_invites_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -105,14 +104,20 @@ pub struct EnableAccountInvitesBuilder< impl EnableAccountInvites { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> EnableAccountInvitesBuilder { + pub fn new() -> EnableAccountInvitesBuilder< + enable_account_invites_state::Empty, + DefaultStr, + > { EnableAccountInvitesBuilder::new() } } impl EnableAccountInvites { /// Create a new builder for this type - pub fn builder() -> EnableAccountInvitesBuilder { + pub fn builder() -> EnableAccountInvitesBuilder< + enable_account_invites_state::Empty, + S, + > { EnableAccountInvitesBuilder::builder() } } @@ -158,7 +163,10 @@ where } } -impl EnableAccountInvitesBuilder { +impl< + St: enable_account_invites_state::State, + S: BosStr, +> EnableAccountInvitesBuilder { /// Set the `note` field (optional) pub fn note(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); @@ -195,4 +203,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/get_account_info.rs b/crates/polymodel-api/src/com_atproto/admin/get_account_info.rs index 114f37b..5b5dbb3 100644 --- a/crates/polymodel-api/src/com_atproto/admin/get_account_info.rs +++ b/crates/polymodel-api/src/com_atproto/admin/get_account_info.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::admin::AccountView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::admin::AccountView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAccountInfo { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAccountInfoOutput { #[serde(flatten)] pub value: AccountView, @@ -69,7 +64,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetAccountInfoRequest { pub mod get_account_info_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -100,7 +95,10 @@ pub mod get_account_info_state { } /// Builder for constructing an instance of this type. -pub struct GetAccountInfoBuilder { +pub struct GetAccountInfoBuilder< + St: get_account_info_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -172,4 +170,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/get_account_infos.rs b/crates/polymodel-api/src/com_atproto/admin/get_account_infos.rs index f0129ec..af75c73 100644 --- a/crates/polymodel-api/src/com_atproto/admin/get_account_infos.rs +++ b/crates/polymodel-api/src/com_atproto/admin/get_account_infos.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::admin::AccountView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::admin::AccountView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAccountInfos { pub dids: Vec>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAccountInfosOutput { pub infos: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -68,7 +63,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetAccountInfosRequest { pub mod get_account_infos_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -99,7 +94,10 @@ pub mod get_account_infos_state { } /// Builder for constructing an instance of this type. -pub struct GetAccountInfosBuilder { +pub struct GetAccountInfosBuilder< + St: get_account_infos_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>,), _type: PhantomData S>, @@ -171,4 +169,4 @@ where dids: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/get_invite_codes.rs b/crates/polymodel-api/src/com_atproto/admin/get_invite_codes.rs index 77deb86..8b926c8 100644 --- a/crates/polymodel-api/src/com_atproto/admin/get_invite_codes.rs +++ b/crates/polymodel-api/src/com_atproto/admin/get_invite_codes.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::server::InviteCode; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::InviteCode; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetInviteCodes { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -35,11 +32,9 @@ pub struct GetInviteCodes { pub sort: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetInviteCodesOutput { pub codes: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -86,7 +81,7 @@ fn _default_sort() -> Option { pub mod get_invite_codes_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -104,7 +99,10 @@ pub mod get_invite_codes_state { } /// Builder for constructing an instance of this type. -pub struct GetInviteCodesBuilder { +pub struct GetInviteCodesBuilder< + St: get_invite_codes_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option, Option), _type: PhantomData S>, @@ -197,4 +195,4 @@ where sort: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/get_subject_status.rs b/crates/polymodel-api/src/com_atproto/admin/get_subject_status.rs index b96b2ca..0f9210c 100644 --- a/crates/polymodel-api/src/com_atproto/admin/get_subject_status.rs +++ b/crates/polymodel-api/src/com_atproto/admin/get_subject_status.rs @@ -8,24 +8,21 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::admin::RepoBlobRef; -use crate::com_atproto::admin::RepoRef; -use crate::com_atproto::admin::StatusAttr; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{AtUri, Cid, Did}; +use jacquard_common::types::string::{Did, AtUri, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::admin::RepoBlobRef; +use crate::com_atproto::admin::RepoRef; +use crate::com_atproto::admin::StatusAttr; +use crate::com_atproto::repo::strong_ref::StrongRef; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSubjectStatus { #[serde(skip_serializing_if = "Option::is_none")] pub blob: Option>, @@ -35,11 +32,9 @@ pub struct GetSubjectStatus { pub uri: Option>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSubjectStatusOutput { #[serde(skip_serializing_if = "Option::is_none")] pub deactivated: Option>, @@ -50,6 +45,7 @@ pub struct GetSubjectStatusOutput { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -92,7 +88,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetSubjectStatusRequest { pub mod get_subject_status_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -110,7 +106,10 @@ pub mod get_subject_status_state { } /// Builder for constructing an instance of this type. -pub struct GetSubjectStatusBuilder { +pub struct GetSubjectStatusBuilder< + St: get_subject_status_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>, Option>, Option>), _type: PhantomData S>, @@ -118,7 +117,10 @@ pub struct GetSubjectStatusBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> GetSubjectStatusBuilder { + pub fn new() -> GetSubjectStatusBuilder< + get_subject_status_state::Empty, + DefaultStr, + > { GetSubjectStatusBuilder::new() } } @@ -203,4 +205,4 @@ where uri: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/search_accounts.rs b/crates/polymodel-api/src/com_atproto/admin/search_accounts.rs index 041f01e..408134d 100644 --- a/crates/polymodel-api/src/com_atproto/admin/search_accounts.rs +++ b/crates/polymodel-api/src/com_atproto/admin/search_accounts.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::admin::AccountView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::admin::AccountView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchAccounts { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -33,11 +30,9 @@ pub struct SearchAccounts { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchAccountsOutput { pub accounts: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -80,7 +75,7 @@ fn _default_limit() -> Option { pub mod search_accounts_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -98,7 +93,10 @@ pub mod search_accounts_state { } /// Builder for constructing an instance of this type. -pub struct SearchAccountsBuilder { +pub struct SearchAccountsBuilder< + St: search_accounts_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option, Option), _type: PhantomData S>, @@ -191,4 +189,4 @@ where limit: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/send_email.rs b/crates/polymodel-api/src/com_atproto/admin/send_email.rs index 15bc94c..a6b509e 100644 --- a/crates/polymodel-api/src/com_atproto/admin/send_email.rs +++ b/crates/polymodel-api/src/com_atproto/admin/send_email.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SendEmail { ///Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers #[serde(skip_serializing_if = "Option::is_none")] @@ -35,11 +32,9 @@ pub struct SendEmail { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SendEmailOutput { pub sent: bool, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -59,8 +54,9 @@ impl jacquard_common::xrpc::XrpcResp for SendEmailResponse { impl jacquard_common::xrpc::XrpcRequest for SendEmail { const NSID: &'static str = "com.atproto.admin.sendEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = SendEmailResponse; } @@ -70,15 +66,16 @@ Path: `/xrpc/com.atproto.admin.sendEmail`. The request payload type is `SendEmai pub struct SendEmailRequest; impl jacquard_common::xrpc::XrpcEndpoint for SendEmailRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.sendEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = SendEmail; type Response = SendEmailResponse; } pub mod send_email_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -137,13 +134,7 @@ pub mod send_email_state { /// Builder for constructing an instance of this type. pub struct SendEmailBuilder { _state: PhantomData St>, - _fields: ( - Option, - Option, - Option>, - Option>, - Option, - ), + _fields: (Option, Option, Option>, Option>, Option), _type: PhantomData S>, } @@ -285,7 +276,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SendEmail { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SendEmail { SendEmail { comment: self._fields.0, content: self._fields.1.unwrap(), @@ -295,4 +289,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/update_account_email.rs b/crates/polymodel-api/src/com_atproto/admin/update_account_email.rs index 4c4f9b9..fbaa588 100644 --- a/crates/polymodel-api/src/com_atproto/admin/update_account_email.rs +++ b/crates/polymodel-api/src/com_atproto/admin/update_account_email.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateAccountEmail { ///The handle or DID of the repo. pub account: AtIdentifier, @@ -43,8 +40,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateAccountEmailResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateAccountEmail { const NSID: &'static str = "com.atproto.admin.updateAccountEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateAccountEmailResponse; } @@ -54,15 +52,16 @@ Path: `/xrpc/com.atproto.admin.updateAccountEmail`. The request payload type is pub struct UpdateAccountEmailRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountEmailRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateAccountEmail; type Response = UpdateAccountEmailResponse; } pub mod update_account_email_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -105,8 +104,10 @@ pub mod update_account_email_state { } /// Builder for constructing an instance of this type. -pub struct UpdateAccountEmailBuilder -{ +pub struct UpdateAccountEmailBuilder< + St: update_account_email_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>, Option), _type: PhantomData S>, @@ -114,7 +115,10 @@ pub struct UpdateAccountEmailBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> UpdateAccountEmailBuilder { + pub fn new() -> UpdateAccountEmailBuilder< + update_account_email_state::Empty, + DefaultStr, + > { UpdateAccountEmailBuilder::new() } } @@ -201,11 +205,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> UpdateAccountEmail { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> UpdateAccountEmail { UpdateAccountEmail { account: self._fields.0.unwrap(), email: self._fields.1.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/update_account_handle.rs b/crates/polymodel-api/src/com_atproto/admin/update_account_handle.rs index 73bd42b..4d296ad 100644 --- a/crates/polymodel-api/src/com_atproto/admin/update_account_handle.rs +++ b/crates/polymodel-api/src/com_atproto/admin/update_account_handle.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateAccountHandle { pub did: Did, pub handle: Handle, @@ -42,8 +39,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateAccountHandleResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateAccountHandle { const NSID: &'static str = "com.atproto.admin.updateAccountHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateAccountHandleResponse; } @@ -53,15 +51,16 @@ Path: `/xrpc/com.atproto.admin.updateAccountHandle`. The request payload type is pub struct UpdateAccountHandleRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountHandleRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateAccountHandle; type Response = UpdateAccountHandleResponse; } pub mod update_account_handle_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -115,14 +114,20 @@ pub struct UpdateAccountHandleBuilder< impl UpdateAccountHandle { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> UpdateAccountHandleBuilder { + pub fn new() -> UpdateAccountHandleBuilder< + update_account_handle_state::Empty, + DefaultStr, + > { UpdateAccountHandleBuilder::new() } } impl UpdateAccountHandle { /// Create a new builder for this type - pub fn builder() -> UpdateAccountHandleBuilder { + pub fn builder() -> UpdateAccountHandleBuilder< + update_account_handle_state::Empty, + S, + > { UpdateAccountHandleBuilder::builder() } } @@ -202,11 +207,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> UpdateAccountHandle { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> UpdateAccountHandle { UpdateAccountHandle { did: self._fields.0.unwrap(), handle: self._fields.1.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/update_account_password.rs b/crates/polymodel-api/src/com_atproto/admin/update_account_password.rs index 529319c..9112003 100644 --- a/crates/polymodel-api/src/com_atproto/admin/update_account_password.rs +++ b/crates/polymodel-api/src/com_atproto/admin/update_account_password.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateAccountPassword { pub did: Did, pub password: S, @@ -42,8 +39,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateAccountPasswordResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateAccountPassword { const NSID: &'static str = "com.atproto.admin.updateAccountPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateAccountPasswordResponse; } @@ -53,15 +51,16 @@ Path: `/xrpc/com.atproto.admin.updateAccountPassword`. The request payload type pub struct UpdateAccountPasswordRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountPasswordRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateAccountPassword; type Response = UpdateAccountPasswordResponse; } pub mod update_account_password_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -115,14 +114,20 @@ pub struct UpdateAccountPasswordBuilder< impl UpdateAccountPassword { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> UpdateAccountPasswordBuilder { + pub fn new() -> UpdateAccountPasswordBuilder< + update_account_password_state::Empty, + DefaultStr, + > { UpdateAccountPasswordBuilder::new() } } impl UpdateAccountPassword { /// Create a new builder for this type - pub fn builder() -> UpdateAccountPasswordBuilder { + pub fn builder() -> UpdateAccountPasswordBuilder< + update_account_password_state::Empty, + S, + > { UpdateAccountPasswordBuilder::builder() } } @@ -177,7 +182,10 @@ where pub fn password( mut self, value: impl Into, - ) -> UpdateAccountPasswordBuilder, S> { + ) -> UpdateAccountPasswordBuilder< + update_account_password_state::SetPassword, + S, + > { self._fields.1 = Option::Some(value.into()); UpdateAccountPasswordBuilder { _state: PhantomData, @@ -212,4 +220,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/update_account_signing_key.rs b/crates/polymodel-api/src/com_atproto/admin/update_account_signing_key.rs index 3829095..d7d41e3 100644 --- a/crates/polymodel-api/src/com_atproto/admin/update_account_signing_key.rs +++ b/crates/polymodel-api/src/com_atproto/admin/update_account_signing_key.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateAccountSigningKey { pub did: Did, ///Did-key formatted public key @@ -43,8 +40,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateAccountSigningKeyResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateAccountSigningKey { const NSID: &'static str = "com.atproto.admin.updateAccountSigningKey"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateAccountSigningKeyResponse; } @@ -54,15 +52,16 @@ Path: `/xrpc/com.atproto.admin.updateAccountSigningKey`. The request payload typ pub struct UpdateAccountSigningKeyRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountSigningKeyRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountSigningKey"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateAccountSigningKey; type Response = UpdateAccountSigningKeyResponse; } pub mod update_account_signing_key_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -116,20 +115,28 @@ pub struct UpdateAccountSigningKeyBuilder< impl UpdateAccountSigningKey { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() - -> UpdateAccountSigningKeyBuilder { + pub fn new() -> UpdateAccountSigningKeyBuilder< + update_account_signing_key_state::Empty, + DefaultStr, + > { UpdateAccountSigningKeyBuilder::new() } } impl UpdateAccountSigningKey { /// Create a new builder for this type - pub fn builder() -> UpdateAccountSigningKeyBuilder { + pub fn builder() -> UpdateAccountSigningKeyBuilder< + update_account_signing_key_state::Empty, + S, + > { UpdateAccountSigningKeyBuilder::builder() } } -impl UpdateAccountSigningKeyBuilder { +impl UpdateAccountSigningKeyBuilder< + update_account_signing_key_state::Empty, + DefaultStr, +> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { UpdateAccountSigningKeyBuilder { @@ -140,7 +147,9 @@ impl UpdateAccountSigningKeyBuilder UpdateAccountSigningKeyBuilder { +impl< + S: BosStr, +> UpdateAccountSigningKeyBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { UpdateAccountSigningKeyBuilder { @@ -160,7 +169,10 @@ where pub fn did( mut self, value: impl Into>, - ) -> UpdateAccountSigningKeyBuilder, S> { + ) -> UpdateAccountSigningKeyBuilder< + update_account_signing_key_state::SetDid, + S, + > { self._fields.0 = Option::Some(value.into()); UpdateAccountSigningKeyBuilder { _state: PhantomData, @@ -179,8 +191,10 @@ where pub fn signing_key( mut self, value: impl Into>, - ) -> UpdateAccountSigningKeyBuilder, S> - { + ) -> UpdateAccountSigningKeyBuilder< + update_account_signing_key_state::SetSigningKey, + S, + > { self._fields.1 = Option::Some(value.into()); UpdateAccountSigningKeyBuilder { _state: PhantomData, @@ -215,4 +229,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/admin/update_subject_status.rs b/crates/polymodel-api/src/com_atproto/admin/update_subject_status.rs index 183aaee..9998fc7 100644 --- a/crates/polymodel-api/src/com_atproto/admin/update_subject_status.rs +++ b/crates/polymodel-api/src/com_atproto/admin/update_subject_status.rs @@ -8,23 +8,20 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::admin::RepoBlobRef; -use crate::com_atproto::admin::RepoRef; -use crate::com_atproto::admin::StatusAttr; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::admin::RepoBlobRef; +use crate::com_atproto::admin::RepoRef; +use crate::com_atproto::admin::StatusAttr; +use crate::com_atproto::repo::strong_ref::StrongRef; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateSubjectStatus { #[serde(skip_serializing_if = "Option::is_none")] pub deactivated: Option>, @@ -35,6 +32,7 @@ pub struct UpdateSubjectStatus { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -47,11 +45,9 @@ pub enum UpdateSubjectStatusSubject { RepoBlobRef(Box>), } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateSubjectStatusOutput { pub subject: UpdateSubjectStatusOutputSubject, #[serde(skip_serializing_if = "Option::is_none")] @@ -60,6 +56,7 @@ pub struct UpdateSubjectStatusOutput { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -85,8 +82,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateSubjectStatusResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateSubjectStatus { const NSID: &'static str = "com.atproto.admin.updateSubjectStatus"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateSubjectStatusResponse; } @@ -96,15 +94,16 @@ Path: `/xrpc/com.atproto.admin.updateSubjectStatus`. The request payload type is pub struct UpdateSubjectStatusRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateSubjectStatusRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.updateSubjectStatus"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateSubjectStatus; type Response = UpdateSubjectStatusResponse; } pub mod update_subject_status_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -150,14 +149,20 @@ pub struct UpdateSubjectStatusBuilder< impl UpdateSubjectStatus { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> UpdateSubjectStatusBuilder { + pub fn new() -> UpdateSubjectStatusBuilder< + update_subject_status_state::Empty, + DefaultStr, + > { UpdateSubjectStatusBuilder::new() } } impl UpdateSubjectStatus { /// Create a new builder for this type - pub fn builder() -> UpdateSubjectStatusBuilder { + pub fn builder() -> UpdateSubjectStatusBuilder< + update_subject_status_state::Empty, + S, + > { UpdateSubjectStatusBuilder::builder() } } @@ -184,7 +189,10 @@ impl UpdateSubjectStatusBuilder UpdateSubjectStatusBuilder { +impl< + St: update_subject_status_state::State, + S: BosStr, +> UpdateSubjectStatusBuilder { /// Set the `deactivated` field (optional) pub fn deactivated(mut self, value: impl Into>>) -> Self { self._fields.0 = value.into(); @@ -216,7 +224,10 @@ where } } -impl UpdateSubjectStatusBuilder { +impl< + St: update_subject_status_state::State, + S: BosStr, +> UpdateSubjectStatusBuilder { /// Set the `takedown` field (optional) pub fn takedown(mut self, value: impl Into>>) -> Self { self._fields.2 = value.into(); @@ -244,7 +255,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> UpdateSubjectStatus { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> UpdateSubjectStatus { UpdateSubjectStatus { deactivated: self._fields.0, subject: self._fields.1.unwrap(), @@ -252,4 +266,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity.rs b/crates/polymodel-api/src/com_atproto/identity.rs index ac5a09c..0e5de0d 100644 --- a/crates/polymodel-api/src/com_atproto/identity.rs +++ b/crates/polymodel-api/src/com_atproto/identity.rs @@ -16,6 +16,7 @@ pub mod sign_plc_operation; pub mod submit_plc_operation; pub mod update_handle; + #[allow(unused_imports)] use alloc::collections::BTreeMap; @@ -34,13 +35,10 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct IdentityInfo { pub did: Did, ///The complete DID document for the identity. @@ -68,7 +66,7 @@ impl LexiconSchema for IdentityInfo { pub mod identity_info_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -241,7 +239,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> IdentityInfo { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> IdentityInfo { IdentityInfo { did: self._fields.0.unwrap(), did_doc: self._fields.1.unwrap(), @@ -252,10 +253,10 @@ where } fn lexicon_doc_com_atproto_identity_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.identity.defs"), @@ -307,4 +308,4 @@ fn lexicon_doc_com_atproto_identity_defs() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/get_recommended_did_credentials.rs b/crates/polymodel-api/src/com_atproto/identity/get_recommended_did_credentials.rs index d58d049..94f7b9d 100644 --- a/crates/polymodel-api/src/com_atproto/identity/get_recommended_did_credentials.rs +++ b/crates/polymodel-api/src/com_atproto/identity/get_recommended_did_credentials.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRecommendedDidCredentialsOutput { #[serde(skip_serializing_if = "Option::is_none")] pub also_known_as: Option>, @@ -67,4 +64,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetRecommendedDidCredentialsRequest const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = GetRecommendedDidCredentials; type Response = GetRecommendedDidCredentialsResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/refresh_identity.rs b/crates/polymodel-api/src/com_atproto/identity/refresh_identity.rs index aebf39b..0b9d68e 100644 --- a/crates/polymodel-api/src/com_atproto/identity/refresh_identity.rs +++ b/crates/polymodel-api/src/com_atproto/identity/refresh_identity.rs @@ -8,32 +8,27 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::identity::IdentityInfo; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::identity::IdentityInfo; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RefreshIdentity { pub identifier: AtIdentifier, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RefreshIdentityOutput { #[serde(flatten)] pub value: IdentityInfo, @@ -41,9 +36,18 @@ pub struct RefreshIdentityOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum RefreshIdentityError { /// The resolution process confirmed that the handle does not resolve to any DID. @@ -57,10 +61,7 @@ pub enum RefreshIdentityError { DidDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for RefreshIdentityError { @@ -111,8 +112,9 @@ impl jacquard_common::xrpc::XrpcResp for RefreshIdentityResponse { impl jacquard_common::xrpc::XrpcRequest for RefreshIdentity { const NSID: &'static str = "com.atproto.identity.refreshIdentity"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RefreshIdentityResponse; } @@ -122,15 +124,16 @@ Path: `/xrpc/com.atproto.identity.refreshIdentity`. The request payload type is pub struct RefreshIdentityRequest; impl jacquard_common::xrpc::XrpcEndpoint for RefreshIdentityRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.refreshIdentity"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RefreshIdentity; type Response = RefreshIdentityResponse; } pub mod refresh_identity_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -161,7 +164,10 @@ pub mod refresh_identity_state { } /// Builder for constructing an instance of this type. -pub struct RefreshIdentityBuilder { +pub struct RefreshIdentityBuilder< + St: refresh_identity_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -235,10 +241,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> RefreshIdentity { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> RefreshIdentity { RefreshIdentity { identifier: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/request_plc_operation_signature.rs b/crates/polymodel-api/src/com_atproto/identity/request_plc_operation_signature.rs index cc2c19f..2ee6f36 100644 --- a/crates/polymodel-api/src/com_atproto/identity/request_plc_operation_signature.rs +++ b/crates/polymodel-api/src/com_atproto/identity/request_plc_operation_signature.rs @@ -10,11 +10,11 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /** Request marker for the `com.atproto.identity.requestPlcOperationSignature` procedure. This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/ @@ -34,8 +34,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestPlcOperationSignatureResponse { impl jacquard_common::xrpc::XrpcRequest for RequestPlcOperationSignature { const NSID: &'static str = "com.atproto.identity.requestPlcOperationSignature"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestPlcOperationSignatureResponse; } @@ -45,8 +46,9 @@ Path: `/xrpc/com.atproto.identity.requestPlcOperationSignature`. The request pay pub struct RequestPlcOperationSignatureRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestPlcOperationSignatureRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.requestPlcOperationSignature"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestPlcOperationSignature; type Response = RequestPlcOperationSignatureResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/resolve_did.rs b/crates/polymodel-api/src/com_atproto/identity/resolve_did.rs index 8d330ae..7a8e2c8 100644 --- a/crates/polymodel-api/src/com_atproto/identity/resolve_did.rs +++ b/crates/polymodel-api/src/com_atproto/identity/resolve_did.rs @@ -10,27 +10,22 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveDid { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveDidOutput { ///The complete DID document for the identity. pub did_doc: Data, @@ -38,9 +33,18 @@ pub struct ResolveDidOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ResolveDidError { /// The DID resolution process confirmed that there is no current DID. @@ -51,10 +55,7 @@ pub enum ResolveDidError { DidDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ResolveDidError { @@ -115,7 +116,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for ResolveDidRequest { pub mod resolve_did_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -218,4 +219,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/resolve_handle.rs b/crates/polymodel-api/src/com_atproto/identity/resolve_handle.rs index fd82f97..7a20858 100644 --- a/crates/polymodel-api/src/com_atproto/identity/resolve_handle.rs +++ b/crates/polymodel-api/src/com_atproto/identity/resolve_handle.rs @@ -10,36 +10,40 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveHandle { pub handle: Handle, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveHandleOutput { pub did: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ResolveHandleError { /// The resolution process confirmed that the handle does not resolve to any DID. @@ -47,10 +51,7 @@ pub enum ResolveHandleError { HandleNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ResolveHandleError { @@ -104,7 +105,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for ResolveHandleRequest { pub mod resolve_handle_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -135,7 +136,10 @@ pub mod resolve_handle_state { } /// Builder for constructing an instance of this type. -pub struct ResolveHandleBuilder { +pub struct ResolveHandleBuilder< + St: resolve_handle_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -207,4 +211,4 @@ where handle: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/resolve_identity.rs b/crates/polymodel-api/src/com_atproto/identity/resolve_identity.rs index 1ed203e..d1c97b9 100644 --- a/crates/polymodel-api/src/com_atproto/identity/resolve_identity.rs +++ b/crates/polymodel-api/src/com_atproto/identity/resolve_identity.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::identity::IdentityInfo; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::identity::IdentityInfo; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveIdentity { pub identifier: AtIdentifier, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveIdentityOutput { #[serde(flatten)] pub value: IdentityInfo, @@ -39,9 +34,18 @@ pub struct ResolveIdentityOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ResolveIdentityError { /// The resolution process confirmed that the handle does not resolve to any DID. @@ -55,10 +59,7 @@ pub enum ResolveIdentityError { DidDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ResolveIdentityError { @@ -126,7 +127,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for ResolveIdentityRequest { pub mod resolve_identity_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -157,7 +158,10 @@ pub mod resolve_identity_state { } /// Builder for constructing an instance of this type. -pub struct ResolveIdentityBuilder { +pub struct ResolveIdentityBuilder< + St: resolve_identity_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -229,4 +233,4 @@ where identifier: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/sign_plc_operation.rs b/crates/polymodel-api/src/com_atproto/identity/sign_plc_operation.rs index 9497192..07368e2 100644 --- a/crates/polymodel-api/src/com_atproto/identity/sign_plc_operation.rs +++ b/crates/polymodel-api/src/com_atproto/identity/sign_plc_operation.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SignPlcOperation { #[serde(skip_serializing_if = "Option::is_none")] pub also_known_as: Option>, @@ -37,11 +34,9 @@ pub struct SignPlcOperation { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SignPlcOperationOutput { ///A signed DID PLC operation. pub operation: Data, @@ -62,8 +57,9 @@ impl jacquard_common::xrpc::XrpcResp for SignPlcOperationResponse { impl jacquard_common::xrpc::XrpcRequest for SignPlcOperation { const NSID: &'static str = "com.atproto.identity.signPlcOperation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = SignPlcOperationResponse; } @@ -73,8 +69,9 @@ Path: `/xrpc/com.atproto.identity.signPlcOperation`. The request payload type is pub struct SignPlcOperationRequest; impl jacquard_common::xrpc::XrpcEndpoint for SignPlcOperationRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.signPlcOperation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = SignPlcOperation; type Response = SignPlcOperationResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/submit_plc_operation.rs b/crates/polymodel-api/src/com_atproto/identity/submit_plc_operation.rs index da692be..dcc6a22 100644 --- a/crates/polymodel-api/src/com_atproto/identity/submit_plc_operation.rs +++ b/crates/polymodel-api/src/com_atproto/identity/submit_plc_operation.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SubmitPlcOperation { pub operation: Data, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -40,8 +37,9 @@ impl jacquard_common::xrpc::XrpcResp for SubmitPlcOperationResponse { impl jacquard_common::xrpc::XrpcRequest for SubmitPlcOperation { const NSID: &'static str = "com.atproto.identity.submitPlcOperation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = SubmitPlcOperationResponse; } @@ -51,15 +49,16 @@ Path: `/xrpc/com.atproto.identity.submitPlcOperation`. The request payload type pub struct SubmitPlcOperationRequest; impl jacquard_common::xrpc::XrpcEndpoint for SubmitPlcOperationRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.submitPlcOperation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = SubmitPlcOperation; type Response = SubmitPlcOperationResponse; } pub mod submit_plc_operation_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -90,8 +89,10 @@ pub mod submit_plc_operation_state { } /// Builder for constructing an instance of this type. -pub struct SubmitPlcOperationBuilder -{ +pub struct SubmitPlcOperationBuilder< + St: submit_plc_operation_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -99,7 +100,10 @@ pub struct SubmitPlcOperationBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> SubmitPlcOperationBuilder { + pub fn new() -> SubmitPlcOperationBuilder< + submit_plc_operation_state::Empty, + DefaultStr, + > { SubmitPlcOperationBuilder::new() } } @@ -165,10 +169,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SubmitPlcOperation { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SubmitPlcOperation { SubmitPlcOperation { operation: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/identity/update_handle.rs b/crates/polymodel-api/src/com_atproto/identity/update_handle.rs index c190919..a0b78c1 100644 --- a/crates/polymodel-api/src/com_atproto/identity/update_handle.rs +++ b/crates/polymodel-api/src/com_atproto/identity/update_handle.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Handle; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateHandle { ///The new handle. pub handle: Handle, @@ -42,8 +39,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateHandleResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateHandle { const NSID: &'static str = "com.atproto.identity.updateHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateHandleResponse; } @@ -53,15 +51,16 @@ Path: `/xrpc/com.atproto.identity.updateHandle`. The request payload type is `Up pub struct UpdateHandleRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateHandleRequest { const PATH: &'static str = "/xrpc/com.atproto.identity.updateHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateHandle; type Response = UpdateHandleResponse; } pub mod update_handle_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -166,10 +165,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> UpdateHandle { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> UpdateHandle { UpdateHandle { handle: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/label.rs b/crates/polymodel-api/src/com_atproto/label.rs index 86d0dd5..35502dc 100644 --- a/crates/polymodel-api/src/com_atproto/label.rs +++ b/crates/polymodel-api/src/com_atproto/label.rs @@ -8,37 +8,36 @@ //! Generated bindings for the `com.atproto.label` Lexicon namespace/module. pub mod query_labels; + #[cfg(feature = "streaming")] pub mod subscribe_labels; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Datetime, Did, Language, UriValue}; +use jacquard_common::types::string::{Did, Cid, Datetime, Language, UriValue}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::label; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label; /// Metadata tag on an atproto resource (eg, repo or record). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Label { ///Optionally, CID specifying the specific version of 'uri' resource this label applies to. #[serde(skip_serializing_if = "Option::is_none")] @@ -68,6 +67,7 @@ pub struct Label { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum LabelValue { Hide, @@ -166,10 +166,7 @@ where /// Declares a label value and its expected interpretations and behaviors. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct LabelValueDefinition { ///Does the user need to have adult content enabled in order to configure this label? #[serde(skip_serializing_if = "Option::is_none")] @@ -239,7 +236,8 @@ impl Serialize for LabelValueDefinitionBlurs { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for LabelValueDefinitionBlurs { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for LabelValueDefinitionBlurs { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -324,7 +322,8 @@ impl Serialize for LabelValueDefinitionDefaultSetting { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for LabelValueDefinitionDefaultSetting { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for LabelValueDefinitionDefaultSetting { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -351,8 +350,12 @@ where LabelValueDefinitionDefaultSetting::Ignore => { LabelValueDefinitionDefaultSetting::Ignore } - LabelValueDefinitionDefaultSetting::Warn => LabelValueDefinitionDefaultSetting::Warn, - LabelValueDefinitionDefaultSetting::Hide => LabelValueDefinitionDefaultSetting::Hide, + LabelValueDefinitionDefaultSetting::Warn => { + LabelValueDefinitionDefaultSetting::Warn + } + LabelValueDefinitionDefaultSetting::Hide => { + LabelValueDefinitionDefaultSetting::Hide + } LabelValueDefinitionDefaultSetting::Other(v) => { LabelValueDefinitionDefaultSetting::Other(v.into_static()) } @@ -411,7 +414,8 @@ impl Serialize for LabelValueDefinitionSeverity { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for LabelValueDefinitionSeverity { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for LabelValueDefinitionSeverity { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -448,10 +452,7 @@ where /// Strings which describe the label in the UI, localized into a specific language. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct LabelValueDefinitionStrings { ///A longer description of what the label means and why it might be applied. pub description: S, @@ -466,10 +467,7 @@ pub struct LabelValueDefinitionStrings { /// Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SelfLabel { ///The short string name of the value or type of this label. pub val: S, @@ -480,10 +478,7 @@ pub struct SelfLabel { /// Metadata tags on an atproto record, published by the author within the record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SelfLabels { pub values: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -672,7 +667,7 @@ impl LexiconSchema for SelfLabels { pub mod label_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -816,7 +811,10 @@ where St::Cts: label_state::IsUnset, { /// Set the `cts` field (required) - pub fn cts(mut self, value: impl Into) -> LabelBuilder, S> { + pub fn cts( + mut self, + value: impl Into, + ) -> LabelBuilder, S> { self._fields.1 = Option::Some(value.into()); LabelBuilder { _state: PhantomData, @@ -871,7 +869,10 @@ where St::Src: label_state::IsUnset, { /// Set the `src` field (required) - pub fn src(mut self, value: impl Into>) -> LabelBuilder, S> { + pub fn src( + mut self, + value: impl Into>, + ) -> LabelBuilder, S> { self._fields.5 = Option::Some(value.into()); LabelBuilder { _state: PhantomData, @@ -906,7 +907,10 @@ where St::Val: label_state::IsUnset, { /// Set the `val` field (required) - pub fn val(mut self, value: impl Into) -> LabelBuilder, S> { + pub fn val( + mut self, + value: impl Into, + ) -> LabelBuilder, S> { self._fields.7 = Option::Some(value.into()); LabelBuilder { _state: PhantomData, @@ -970,10 +974,10 @@ where } fn lexicon_doc_com_atproto_label_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.label.defs"), @@ -1089,9 +1093,7 @@ fn lexicon_doc_com_atproto_label_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("labelValue"), - LexUserType::String(LexString { - ..Default::default() - }), + LexUserType::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("labelValueDefinition"), @@ -1301,7 +1303,7 @@ fn lexicon_doc_com_atproto_label_defs() -> LexiconDoc<'static> { pub mod label_value_definition_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1392,14 +1394,20 @@ pub struct LabelValueDefinitionBuilder< impl LabelValueDefinition { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> LabelValueDefinitionBuilder { + pub fn new() -> LabelValueDefinitionBuilder< + label_value_definition_state::Empty, + DefaultStr, + > { LabelValueDefinitionBuilder::new() } } impl LabelValueDefinition { /// Create a new builder for this type - pub fn builder() -> LabelValueDefinitionBuilder { + pub fn builder() -> LabelValueDefinitionBuilder< + label_value_definition_state::Empty, + S, + > { LabelValueDefinitionBuilder::builder() } } @@ -1426,7 +1434,10 @@ impl LabelValueDefinitionBuilder LabelValueDefinitionBuilder { +impl< + St: label_value_definition_state::State, + S: BosStr, +> LabelValueDefinitionBuilder { /// Set the `adultOnly` field (optional) pub fn adult_only(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); @@ -1458,7 +1469,10 @@ where } } -impl LabelValueDefinitionBuilder { +impl< + St: label_value_definition_state::State, + S: BosStr, +> LabelValueDefinitionBuilder { /// Set the `defaultSetting` field (optional) pub fn default_setting( mut self, @@ -1486,7 +1500,10 @@ where pub fn identifier( mut self, value: impl Into, - ) -> LabelValueDefinitionBuilder, S> { + ) -> LabelValueDefinitionBuilder< + label_value_definition_state::SetIdentifier, + S, + > { self._fields.3 = Option::Some(value.into()); LabelValueDefinitionBuilder { _state: PhantomData, @@ -1573,7 +1590,7 @@ where pub mod label_value_definition_strings_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1641,22 +1658,28 @@ pub struct LabelValueDefinitionStringsBuilder< impl LabelValueDefinitionStrings { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() - -> LabelValueDefinitionStringsBuilder - { + pub fn new() -> LabelValueDefinitionStringsBuilder< + label_value_definition_strings_state::Empty, + DefaultStr, + > { LabelValueDefinitionStringsBuilder::new() } } impl LabelValueDefinitionStrings { /// Create a new builder for this type - pub fn builder() - -> LabelValueDefinitionStringsBuilder { + pub fn builder() -> LabelValueDefinitionStringsBuilder< + label_value_definition_strings_state::Empty, + S, + > { LabelValueDefinitionStringsBuilder::builder() } } -impl LabelValueDefinitionStringsBuilder { +impl LabelValueDefinitionStringsBuilder< + label_value_definition_strings_state::Empty, + DefaultStr, +> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { LabelValueDefinitionStringsBuilder { @@ -1667,7 +1690,9 @@ impl LabelValueDefinitionStringsBuilder LabelValueDefinitionStringsBuilder { +impl< + S: BosStr, +> LabelValueDefinitionStringsBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { LabelValueDefinitionStringsBuilder { @@ -1709,8 +1734,10 @@ where pub fn lang( mut self, value: impl Into, - ) -> LabelValueDefinitionStringsBuilder, S> - { + ) -> LabelValueDefinitionStringsBuilder< + label_value_definition_strings_state::SetLang, + S, + > { self._fields.1 = Option::Some(value.into()); LabelValueDefinitionStringsBuilder { _state: PhantomData, @@ -1729,8 +1756,10 @@ where pub fn name( mut self, value: impl Into, - ) -> LabelValueDefinitionStringsBuilder, S> - { + ) -> LabelValueDefinitionStringsBuilder< + label_value_definition_strings_state::SetName, + S, + > { self._fields.2 = Option::Some(value.into()); LabelValueDefinitionStringsBuilder { _state: PhantomData, @@ -1772,7 +1801,7 @@ where pub mod self_labels_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1877,10 +1906,13 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> SelfLabels { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> SelfLabels { SelfLabels { values: self._fields.0.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/label/query_labels.rs b/crates/polymodel-api/src/com_atproto/label/query_labels.rs index dbdd223..ce28f99 100644 --- a/crates/polymodel-api/src/com_atproto/label/query_labels.rs +++ b/crates/polymodel-api/src/com_atproto/label/query_labels.rs @@ -8,21 +8,18 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::label::Label; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label::Label; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct QueryLabels { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -35,11 +32,9 @@ pub struct QueryLabels { pub uri_patterns: Vec, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct QueryLabelsOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -82,7 +77,7 @@ fn _default_limit() -> Option { pub mod query_labels_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -227,4 +222,4 @@ where uri_patterns: self._fields.3.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/label/subscribe_labels.rs b/crates/polymodel-api/src/com_atproto/label/subscribe_labels.rs index d9162f7..62a7ec5 100644 --- a/crates/polymodel-api/src/com_atproto/label/subscribe_labels.rs +++ b/crates/polymodel-api/src/com_atproto/label/subscribe_labels.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -20,17 +20,14 @@ use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::label::Label; -use crate::com_atproto::label::subscribe_labels; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label::Label; +use crate::com_atproto::label::subscribe_labels; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Info { #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, @@ -39,6 +36,7 @@ pub struct Info { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum InfoName { OutdatedCursor, @@ -112,11 +110,9 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Labels { pub labels: Vec>, pub seq: i64, @@ -124,6 +120,7 @@ pub struct Labels { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct SubscribeLabels { @@ -131,6 +128,7 @@ pub struct SubscribeLabels { pub cursor: Option, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -149,36 +147,50 @@ impl SubscribeLabelsMessage { where S: serde::Deserialize<'de>, { - let (header, body) = jacquard_common::xrpc::subscription::parse_event_header(bytes)?; + let (header, body) = jacquard_common::xrpc::subscription::parse_event_header( + bytes, + )?; match header.t.as_str() { "#labels" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Labels(Box::new(variant))) } "#info" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Info(Box::new(variant))) } - unknown => Err(jacquard_common::error::DecodeError::UnknownEventType( - unknown.into(), - )), + unknown => { + Err( + jacquard_common::error::DecodeError::UnknownEventType(unknown.into()), + ) + } } } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum SubscribeLabelsError { #[serde(rename = "FutureCursor")] FutureCursor(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for SubscribeLabelsError { @@ -237,8 +249,7 @@ impl LexiconSchema for Labels { pub struct SubscribeLabelsStream; impl jacquard_common::xrpc::SubscriptionResp for SubscribeLabelsStream { const NSID: &'static str = "com.atproto.label.subscribeLabels"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Message = SubscribeLabelsMessage; type Error = SubscribeLabelsError; fn decode_message<'de, S>( @@ -254,25 +265,23 @@ impl jacquard_common::xrpc::SubscriptionResp for SubscribeLabelsStream { impl jacquard_common::xrpc::XrpcSubscription for SubscribeLabels { const NSID: &'static str = "com.atproto.label.subscribeLabels"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Stream = SubscribeLabelsStream; } pub struct SubscribeLabelsEndpoint; impl jacquard_common::xrpc::SubscriptionEndpoint for SubscribeLabelsEndpoint { const PATH: &'static str = "/xrpc/com.atproto.label.subscribeLabels"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Params = SubscribeLabels; type Stream = SubscribeLabelsStream; } fn lexicon_doc_com_atproto_label_subscribeLabels() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.label.subscribeLabels"), @@ -287,15 +296,11 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("message"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -305,10 +310,9 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("labels"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("seq"), - SmolStr::new_static("labels"), - ]), + required: Some( + vec![SmolStr::new_static("seq"), SmolStr::new_static("labels")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -336,20 +340,22 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcSubscription(LexXrpcSubscription { - parameters: Some(LexXrpcSubscriptionParameter::Params(LexXrpcParameters { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcSubscriptionParameter::Params(LexXrpcParameters { + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); @@ -361,7 +367,7 @@ fn lexicon_doc_com_atproto_label_subscribeLabels() -> LexiconDoc<'static> { pub mod labels_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -471,7 +477,10 @@ where St::Seq: labels_state::IsUnset, { /// Set the `seq` field (required) - pub fn seq(mut self, value: impl Into) -> LabelsBuilder, S> { + pub fn seq( + mut self, + value: impl Into, + ) -> LabelsBuilder, S> { self._fields.1 = Option::Some(value.into()); LabelsBuilder { _state: PhantomData, @@ -507,7 +516,7 @@ where pub mod subscribe_labels_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -580,4 +589,4 @@ where cursor: self._fields.0, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/lexicon.rs b/crates/polymodel-api/src/com_atproto/lexicon.rs index 125d4aa..17f6bdb 100644 --- a/crates/polymodel-api/src/com_atproto/lexicon.rs +++ b/crates/polymodel-api/src/com_atproto/lexicon.rs @@ -5,4 +5,4 @@ //! Generated bindings for the `com.atproto.lexicon` Lexicon namespace/module. pub mod resolve_lexicon; -pub mod schema; +pub mod schema; \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/lexicon/resolve_lexicon.rs b/crates/polymodel-api/src/com_atproto/lexicon/resolve_lexicon.rs index 3c89ae5..3b5bbe0 100644 --- a/crates/polymodel-api/src/com_atproto/lexicon/resolve_lexicon.rs +++ b/crates/polymodel-api/src/com_atproto/lexicon/resolve_lexicon.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::lexicon::schema::Schema; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{AtUri, Cid, Nsid}; +use jacquard_common::types::string::{AtUri, Nsid, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::lexicon::schema::Schema; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveLexicon { pub nsid: Nsid, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResolveLexiconOutput { ///The CID of the lexicon schema record. pub cid: Cid, @@ -43,9 +38,18 @@ pub struct ResolveLexiconOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ResolveLexiconError { /// No lexicon was resolved for the NSID. @@ -53,10 +57,7 @@ pub enum ResolveLexiconError { LexiconNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ResolveLexiconError { @@ -110,7 +111,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for ResolveLexiconRequest { pub mod resolve_lexicon_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -141,7 +142,10 @@ pub mod resolve_lexicon_state { } /// Builder for constructing an instance of this type. -pub struct ResolveLexiconBuilder { +pub struct ResolveLexiconBuilder< + St: resolve_lexicon_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -213,4 +217,4 @@ where nsid: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/lexicon/schema.rs b/crates/polymodel-api/src/com_atproto/lexicon/schema.rs index 9f6843c..fa2bfbd 100644 --- a/crates/polymodel-api/src/com_atproto/lexicon/schema.rs +++ b/crates/polymodel-api/src/com_atproto/lexicon/schema.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -26,7 +26,7 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /// Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -104,7 +104,7 @@ impl LexiconSchema for Schema { pub mod schema_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -218,10 +218,10 @@ where } fn lexicon_doc_com_atproto_lexicon_schema() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.lexicon.schema"), @@ -258,4 +258,4 @@ fn lexicon_doc_com_atproto_lexicon_schema() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/moderation.rs b/crates/polymodel-api/src/com_atproto/moderation.rs index 07f4b85..e668eae 100644 --- a/crates/polymodel-api/src/com_atproto/moderation.rs +++ b/crates/polymodel-api/src/com_atproto/moderation.rs @@ -8,9 +8,9 @@ //! Generated bindings for the `com.atproto.moderation` Lexicon namespace/module. pub mod create_report; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /// Appeal a previously taken moderation action #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)] @@ -71,6 +71,7 @@ impl core::fmt::Display for ReasonSpam { } } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum ReasonType { ComAtprotoModerationDefsReasonSpam, @@ -126,7 +127,9 @@ pub enum ReasonType { impl ReasonType { pub fn as_str(&self) -> &str { match self { - Self::ComAtprotoModerationDefsReasonSpam => "com.atproto.moderation.defs#reasonSpam", + Self::ComAtprotoModerationDefsReasonSpam => { + "com.atproto.moderation.defs#reasonSpam" + } Self::ComAtprotoModerationDefsReasonViolation => { "com.atproto.moderation.defs#reasonViolation" } @@ -136,13 +139,21 @@ impl ReasonType { Self::ComAtprotoModerationDefsReasonSexual => { "com.atproto.moderation.defs#reasonSexual" } - Self::ComAtprotoModerationDefsReasonRude => "com.atproto.moderation.defs#reasonRude", - Self::ComAtprotoModerationDefsReasonOther => "com.atproto.moderation.defs#reasonOther", + Self::ComAtprotoModerationDefsReasonRude => { + "com.atproto.moderation.defs#reasonRude" + } + Self::ComAtprotoModerationDefsReasonOther => { + "com.atproto.moderation.defs#reasonOther" + } Self::ComAtprotoModerationDefsReasonAppeal => { "com.atproto.moderation.defs#reasonAppeal" } - Self::ToolsOzoneReportDefsReasonAppeal => "tools.ozone.report.defs#reasonAppeal", - Self::ToolsOzoneReportDefsReasonOther => "tools.ozone.report.defs#reasonOther", + Self::ToolsOzoneReportDefsReasonAppeal => { + "tools.ozone.report.defs#reasonAppeal" + } + Self::ToolsOzoneReportDefsReasonOther => { + "tools.ozone.report.defs#reasonOther" + } Self::ToolsOzoneReportDefsReasonViolenceAnimal => { "tools.ozone.report.defs#reasonViolenceAnimal" } @@ -239,7 +250,9 @@ impl ReasonType { Self::ToolsOzoneReportDefsReasonRuleBanEvasion => { "tools.ozone.report.defs#reasonRuleBanEvasion" } - Self::ToolsOzoneReportDefsReasonRuleOther => "tools.ozone.report.defs#reasonRuleOther", + Self::ToolsOzoneReportDefsReasonRuleOther => { + "tools.ozone.report.defs#reasonRuleOther" + } Self::ToolsOzoneReportDefsReasonSelfHarmContent => { "tools.ozone.report.defs#reasonSelfHarmContent" } @@ -261,7 +274,9 @@ impl ReasonType { /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { - "com.atproto.moderation.defs#reasonSpam" => Self::ComAtprotoModerationDefsReasonSpam, + "com.atproto.moderation.defs#reasonSpam" => { + Self::ComAtprotoModerationDefsReasonSpam + } "com.atproto.moderation.defs#reasonViolation" => { Self::ComAtprotoModerationDefsReasonViolation } @@ -271,13 +286,21 @@ impl ReasonType { "com.atproto.moderation.defs#reasonSexual" => { Self::ComAtprotoModerationDefsReasonSexual } - "com.atproto.moderation.defs#reasonRude" => Self::ComAtprotoModerationDefsReasonRude, - "com.atproto.moderation.defs#reasonOther" => Self::ComAtprotoModerationDefsReasonOther, + "com.atproto.moderation.defs#reasonRude" => { + Self::ComAtprotoModerationDefsReasonRude + } + "com.atproto.moderation.defs#reasonOther" => { + Self::ComAtprotoModerationDefsReasonOther + } "com.atproto.moderation.defs#reasonAppeal" => { Self::ComAtprotoModerationDefsReasonAppeal } - "tools.ozone.report.defs#reasonAppeal" => Self::ToolsOzoneReportDefsReasonAppeal, - "tools.ozone.report.defs#reasonOther" => Self::ToolsOzoneReportDefsReasonOther, + "tools.ozone.report.defs#reasonAppeal" => { + Self::ToolsOzoneReportDefsReasonAppeal + } + "tools.ozone.report.defs#reasonOther" => { + Self::ToolsOzoneReportDefsReasonOther + } "tools.ozone.report.defs#reasonViolenceAnimal" => { Self::ToolsOzoneReportDefsReasonViolenceAnimal } @@ -374,7 +397,9 @@ impl ReasonType { "tools.ozone.report.defs#reasonRuleBanEvasion" => { Self::ToolsOzoneReportDefsReasonRuleBanEvasion } - "tools.ozone.report.defs#reasonRuleOther" => Self::ToolsOzoneReportDefsReasonRuleOther, + "tools.ozone.report.defs#reasonRuleOther" => { + Self::ToolsOzoneReportDefsReasonRuleOther + } "tools.ozone.report.defs#reasonSelfHarmContent" => { Self::ToolsOzoneReportDefsReasonSelfHarmContent } @@ -665,4 +690,4 @@ where SubjectType::Other(v) => SubjectType::Other(v.into_static()), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/moderation/create_report.rs b/crates/polymodel-api/src/com_atproto/moderation/create_report.rs index 77dd80a..4a81d9d 100644 --- a/crates/polymodel-api/src/com_atproto/moderation/create_report.rs +++ b/crates/polymodel-api/src/com_atproto/moderation/create_report.rs @@ -10,30 +10,27 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Datetime, Did}; +use jacquard_common::types::string::{Did, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; +#[allow(unused_imports)] +use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; +use serde::{Serialize, Deserialize}; use crate::com_atproto::admin::RepoRef; use crate::com_atproto::moderation::ReasonType; -use crate::com_atproto::moderation::create_report; use crate::com_atproto::repo::strong_ref::StrongRef; -#[allow(unused_imports)] -use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use crate::com_atproto::moderation::create_report; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateReport { #[serde(skip_serializing_if = "Option::is_none")] pub mod_tool: Option>, @@ -47,6 +44,7 @@ pub struct CreateReport { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -57,11 +55,9 @@ pub enum CreateReportSubject { StrongRef(Box>), } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateReportOutput { pub created_at: Datetime, pub id: i64, @@ -74,6 +70,7 @@ pub struct CreateReportOutput { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -87,10 +84,7 @@ pub enum CreateReportOutputSubject { /// Moderation tool information for tracing the source of the action #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ModTool { ///Additional arbitrary metadata about the source #[serde(skip_serializing_if = "Option::is_none")] @@ -114,8 +108,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateReportResponse { impl jacquard_common::xrpc::XrpcRequest for CreateReport { const NSID: &'static str = "com.atproto.moderation.createReport"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateReportResponse; } @@ -125,8 +120,9 @@ Path: `/xrpc/com.atproto.moderation.createReport`. The request payload type is ` pub struct CreateReportRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateReportRequest { const PATH: &'static str = "/xrpc/com.atproto.moderation.createReport"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateReport; type Response = CreateReportResponse; } @@ -148,7 +144,7 @@ impl LexiconSchema for ModTool { pub mod create_report_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -240,7 +236,10 @@ impl CreateReportBuilder { impl CreateReportBuilder { /// Set the `modTool` field (optional) - pub fn mod_tool(mut self, value: impl Into>>) -> Self { + pub fn mod_tool( + mut self, + value: impl Into>>, + ) -> Self { self._fields.0 = value.into(); self } @@ -319,7 +318,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateReport { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateReport { CreateReport { mod_tool: self._fields.0, reason: self._fields.1, @@ -331,10 +333,10 @@ where } fn lexicon_doc_com_atproto_moderation_createReport() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.moderation.createReport"), @@ -345,55 +347,61 @@ fn lexicon_doc_com_atproto_moderation_createReport() -> LexiconDoc<'static> { LexUserType::XrpcProcedure(LexXrpcProcedure { input: Some(LexXrpcBody { encoding: CowStr::new_static("application/json"), - schema: Some(LexXrpcBodySchema::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("reasonType"), - SmolStr::new_static("subject"), - ]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("modTool"), - LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static("#modTool"), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("reason"), - LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "Additional context about the content and violation.", - )), - max_length: Some(20000usize), - max_graphemes: Some(2000usize), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("reasonType"), - LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static( - "com.atproto.moderation.defs#reasonType", - ), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("subject"), - LexObjectProperty::Union(LexRefUnion { - refs: vec![ - CowStr::new_static("com.atproto.admin.defs#repoRef"), - CowStr::new_static("com.atproto.repo.strongRef"), - ], - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + schema: Some( + LexXrpcBodySchema::Object(LexObject { + required: Some( + vec![ + SmolStr::new_static("reasonType"), + SmolStr::new_static("subject") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("modTool"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static("#modTool"), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("reason"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Additional context about the content and violation.", + ), + ), + max_length: Some(20000usize), + max_graphemes: Some(2000usize), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("reasonType"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static( + "com.atproto.moderation.defs#reasonType", + ), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("subject"), + LexObjectProperty::Union(LexRefUnion { + refs: vec![ + CowStr::new_static("com.atproto.admin.defs#repoRef"), + CowStr::new_static("com.atproto.repo.strongRef") + ], + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ..Default::default() @@ -437,4 +445,4 @@ fn lexicon_doc_com_atproto_moderation_createReport() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo.rs b/crates/polymodel-api/src/com_atproto/repo.rs index cfb2d44..4189658 100644 --- a/crates/polymodel-api/src/com_atproto/repo.rs +++ b/crates/polymodel-api/src/com_atproto/repo.rs @@ -18,6 +18,7 @@ pub mod put_record; pub mod strong_ref; pub mod upload_blob; + #[allow(unused_imports)] use alloc::collections::BTreeMap; @@ -28,7 +29,7 @@ use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Tid}; +use jacquard_common::types::string::{Tid, Cid}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; @@ -36,13 +37,10 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CommitMeta { pub cid: Cid, pub rev: Tid, @@ -67,7 +65,7 @@ impl LexiconSchema for CommitMeta { pub mod commit_meta_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -205,7 +203,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CommitMeta { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CommitMeta { CommitMeta { cid: self._fields.0.unwrap(), rev: self._fields.1.unwrap(), @@ -215,10 +216,10 @@ where } fn lexicon_doc_com_atproto_repo_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.repo.defs"), @@ -227,7 +228,9 @@ fn lexicon_doc_com_atproto_repo_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("commitMeta"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("cid"), SmolStr::new_static("rev")]), + required: Some( + vec![SmolStr::new_static("cid"), SmolStr::new_static("rev")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -254,4 +257,4 @@ fn lexicon_doc_com_atproto_repo_defs() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/apply_writes.rs b/crates/polymodel-api/src/com_atproto/repo/apply_writes.rs index cd3d3f2..d5572a5 100644 --- a/crates/polymodel-api/src/com_atproto/repo/apply_writes.rs +++ b/crates/polymodel-api/src/com_atproto/repo/apply_writes.rs @@ -10,30 +10,27 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{AtUri, Cid, Nsid, RecordKey, Rkey}; +use jacquard_common::types::string::{AtUri, Nsid, Cid, RecordKey, Rkey}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::CommitMeta; -use crate::com_atproto::repo::apply_writes; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::CommitMeta; +use crate::com_atproto::repo::apply_writes; /// Operation which creates a new record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Create { pub collection: Nsid, ///NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility. @@ -44,11 +41,9 @@ pub struct Create { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateResult { pub cid: Cid, pub uri: AtUri, @@ -58,6 +53,7 @@ pub struct CreateResult { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum CreateResultValidationStatus { Valid, @@ -104,7 +100,8 @@ impl Serialize for CreateResultValidationStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for CreateResultValidationStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for CreateResultValidationStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -129,7 +126,9 @@ where fn into_static(self) -> Self::Output { match self { CreateResultValidationStatus::Valid => CreateResultValidationStatus::Valid, - CreateResultValidationStatus::Unknown => CreateResultValidationStatus::Unknown, + CreateResultValidationStatus::Unknown => { + CreateResultValidationStatus::Unknown + } CreateResultValidationStatus::Other(v) => { CreateResultValidationStatus::Other(v.into_static()) } @@ -140,10 +139,7 @@ where /// Operation which deletes an existing record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Delete { pub collection: Nsid, pub rkey: RecordKey>, @@ -151,21 +147,17 @@ pub struct Delete { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeleteResult { #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ApplyWrites { ///The handle or DID of the repo (aka, current account). pub repo: AtIdentifier, @@ -180,6 +172,7 @@ pub struct ApplyWrites { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub enum ApplyWritesWritesItem { @@ -191,11 +184,9 @@ pub enum ApplyWritesWritesItem { Delete(Box>), } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ApplyWritesOutput { #[serde(skip_serializing_if = "Option::is_none")] pub commit: Option>, @@ -205,6 +196,7 @@ pub struct ApplyWritesOutput { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub enum ApplyWritesOutputResultsItem { @@ -216,9 +208,18 @@ pub enum ApplyWritesOutputResultsItem { DeleteResult(Box>), } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ApplyWritesError { /// Indicates that the 'swapCommit' parameter did not match current commit. @@ -226,10 +227,7 @@ pub enum ApplyWritesError { InvalidSwap(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ApplyWritesError { @@ -256,10 +254,7 @@ impl core::fmt::Display for ApplyWritesError { /// Operation which updates an existing record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Update { pub collection: Nsid, pub rkey: RecordKey>, @@ -268,11 +263,9 @@ pub struct Update { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateResult { pub cid: Cid, pub uri: AtUri, @@ -282,6 +275,7 @@ pub struct UpdateResult { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum UpdateResultValidationStatus { Valid, @@ -328,7 +322,8 @@ impl Serialize for UpdateResultValidationStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for UpdateResultValidationStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for UpdateResultValidationStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -353,7 +348,9 @@ where fn into_static(self) -> Self::Output { match self { UpdateResultValidationStatus::Valid => UpdateResultValidationStatus::Valid, - UpdateResultValidationStatus::Unknown => UpdateResultValidationStatus::Unknown, + UpdateResultValidationStatus::Unknown => { + UpdateResultValidationStatus::Unknown + } UpdateResultValidationStatus::Other(v) => { UpdateResultValidationStatus::Other(v.into_static()) } @@ -444,8 +441,9 @@ impl jacquard_common::xrpc::XrpcResp for ApplyWritesResponse { impl jacquard_common::xrpc::XrpcRequest for ApplyWrites { const NSID: &'static str = "com.atproto.repo.applyWrites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = ApplyWritesResponse; } @@ -455,8 +453,9 @@ Path: `/xrpc/com.atproto.repo.applyWrites`. The request payload type is `ApplyWr pub struct ApplyWritesRequest; impl jacquard_common::xrpc::XrpcEndpoint for ApplyWritesRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.applyWrites"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = ApplyWrites; type Response = ApplyWritesResponse; } @@ -493,7 +492,7 @@ impl LexiconSchema for UpdateResult { pub mod create_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -656,10 +655,10 @@ where } fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.repo.applyWrites"), @@ -714,7 +713,9 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("createResult"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")]), + required: Some( + vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -734,9 +735,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("validationStatus"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -746,13 +745,15 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("delete"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Operation which deletes an existing record.", - )), - required: Some(vec![ - SmolStr::new_static("collection"), - SmolStr::new_static("rkey"), - ]), + description: Some( + CowStr::new_static("Operation which deletes an existing record."), + ), + required: Some( + vec![ + SmolStr::new_static("collection"), + SmolStr::new_static("rkey") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -859,14 +860,15 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("update"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Operation which updates an existing record.", - )), - required: Some(vec![ - SmolStr::new_static("collection"), - SmolStr::new_static("rkey"), - SmolStr::new_static("value"), - ]), + description: Some( + CowStr::new_static("Operation which updates an existing record."), + ), + required: Some( + vec![ + SmolStr::new_static("collection"), + SmolStr::new_static("rkey"), SmolStr::new_static("value") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -898,7 +900,9 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("updateResult"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")]), + required: Some( + vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -918,9 +922,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("validationStatus"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -935,7 +937,7 @@ fn lexicon_doc_com_atproto_repo_applyWrites() -> LexiconDoc<'static> { pub mod create_result_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -980,11 +982,7 @@ pub mod create_result_state { /// Builder for constructing an instance of this type. pub struct CreateResultBuilder { _state: PhantomData St>, - _fields: ( - Option>, - Option>, - Option>, - ), + _fields: (Option>, Option>, Option>), _type: PhantomData S>, } @@ -1097,7 +1095,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateResult { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateResult { CreateResult { cid: self._fields.0.unwrap(), uri: self._fields.1.unwrap(), @@ -1109,7 +1110,7 @@ where pub mod delete_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1258,7 +1259,7 @@ where pub mod apply_writes_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1429,7 +1430,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ApplyWrites { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ApplyWrites { ApplyWrites { repo: self._fields.0.unwrap(), swap_commit: self._fields.1, @@ -1442,7 +1446,7 @@ where pub mod update_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1627,7 +1631,7 @@ where pub mod update_result_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1672,11 +1676,7 @@ pub mod update_result_state { /// Builder for constructing an instance of this type. pub struct UpdateResultBuilder { _state: PhantomData St>, - _fields: ( - Option>, - Option>, - Option>, - ), + _fields: (Option>, Option>, Option>), _type: PhantomData S>, } @@ -1789,7 +1789,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> UpdateResult { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> UpdateResult { UpdateResult { cid: self._fields.0.unwrap(), uri: self._fields.1.unwrap(), @@ -1797,4 +1800,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/create_record.rs b/crates/polymodel-api/src/com_atproto/repo/create_record.rs index 2bcca02..861c315 100644 --- a/crates/polymodel-api/src/com_atproto/repo/create_record.rs +++ b/crates/polymodel-api/src/com_atproto/repo/create_record.rs @@ -8,22 +8,19 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::repo::CommitMeta; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{AtUri, Cid, Nsid, RecordKey, Rkey}; +use jacquard_common::types::string::{AtUri, Nsid, Cid, RecordKey, Rkey}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::CommitMeta; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateRecord { ///The NSID of the record collection. pub collection: Nsid, @@ -44,11 +41,9 @@ pub struct CreateRecord { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateRecordOutput { pub cid: Cid, #[serde(skip_serializing_if = "Option::is_none")] @@ -60,6 +55,7 @@ pub struct CreateRecordOutput { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum CreateRecordOutputValidationStatus { Valid, @@ -106,7 +102,8 @@ impl Serialize for CreateRecordOutputValidationStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for CreateRecordOutputValidationStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for CreateRecordOutputValidationStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -130,7 +127,9 @@ where type Output = CreateRecordOutputValidationStatus; fn into_static(self) -> Self::Output { match self { - CreateRecordOutputValidationStatus::Valid => CreateRecordOutputValidationStatus::Valid, + CreateRecordOutputValidationStatus::Valid => { + CreateRecordOutputValidationStatus::Valid + } CreateRecordOutputValidationStatus::Unknown => { CreateRecordOutputValidationStatus::Unknown } @@ -141,9 +140,18 @@ where } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum CreateRecordError { /// Indicates that 'swapCommit' didn't match current repo commit. @@ -151,10 +159,7 @@ pub enum CreateRecordError { InvalidSwap(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for CreateRecordError { @@ -191,8 +196,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateRecordResponse { impl jacquard_common::xrpc::XrpcRequest for CreateRecord { const NSID: &'static str = "com.atproto.repo.createRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateRecordResponse; } @@ -202,15 +208,16 @@ Path: `/xrpc/com.atproto.repo.createRecord`. The request payload type is `Create pub struct CreateRecordRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateRecordRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.createRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateRecord; type Response = CreateRecordResponse; } pub mod create_record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -432,7 +439,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateRecord { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateRecord { CreateRecord { collection: self._fields.0.unwrap(), record: self._fields.1.unwrap(), @@ -443,4 +453,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/delete_record.rs b/crates/polymodel-api/src/com_atproto/repo/delete_record.rs index edcff7e..a79a924 100644 --- a/crates/polymodel-api/src/com_atproto/repo/delete_record.rs +++ b/crates/polymodel-api/src/com_atproto/repo/delete_record.rs @@ -8,22 +8,19 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::repo::CommitMeta; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{Cid, Nsid, RecordKey, Rkey}; +use jacquard_common::types::string::{Nsid, Cid, RecordKey, Rkey}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::CommitMeta; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeleteRecord { ///The NSID of the record collection. pub collection: Nsid, @@ -41,11 +38,9 @@ pub struct DeleteRecord { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeleteRecordOutput { #[serde(skip_serializing_if = "Option::is_none")] pub commit: Option>, @@ -53,19 +48,25 @@ pub struct DeleteRecordOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum DeleteRecordError { #[serde(rename = "InvalidSwap")] InvalidSwap(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for DeleteRecordError { @@ -102,8 +103,9 @@ impl jacquard_common::xrpc::XrpcResp for DeleteRecordResponse { impl jacquard_common::xrpc::XrpcRequest for DeleteRecord { const NSID: &'static str = "com.atproto.repo.deleteRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DeleteRecordResponse; } @@ -113,15 +115,16 @@ Path: `/xrpc/com.atproto.repo.deleteRecord`. The request payload type is `Delete pub struct DeleteRecordRequest; impl jacquard_common::xrpc::XrpcEndpoint for DeleteRecordRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.deleteRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DeleteRecord; type Response = DeleteRecordResponse; } pub mod delete_record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -328,7 +331,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> DeleteRecord { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> DeleteRecord { DeleteRecord { collection: self._fields.0.unwrap(), repo: self._fields.1.unwrap(), @@ -338,4 +344,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/describe_repo.rs b/crates/polymodel-api/src/com_atproto/repo/describe_repo.rs index bfc0919..704e45d 100644 --- a/crates/polymodel-api/src/com_atproto/repo/describe_repo.rs +++ b/crates/polymodel-api/src/com_atproto/repo/describe_repo.rs @@ -10,28 +10,23 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::string::{Did, Handle, Nsid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DescribeRepo { pub repo: AtIdentifier, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DescribeRepoOutput { ///List of all the collections (NSIDs) for which this repo contains at least one record. pub collections: Vec>, @@ -75,7 +70,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for DescribeRepoRequest { pub mod describe_repo_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -178,4 +173,4 @@ where repo: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/get_record.rs b/crates/polymodel-api/src/com_atproto/repo/get_record.rs index 370e5dd..1e6f639 100644 --- a/crates/polymodel-api/src/com_atproto/repo/get_record.rs +++ b/crates/polymodel-api/src/com_atproto/repo/get_record.rs @@ -10,19 +10,16 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{AtUri, Cid, Nsid, RecordKey, Rkey}; +use jacquard_common::types::string::{AtUri, Nsid, Cid, RecordKey, Rkey}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRecord { #[serde(skip_serializing_if = "Option::is_none")] pub cid: Option>, @@ -31,11 +28,9 @@ pub struct GetRecord { pub rkey: RecordKey>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRecordOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cid: Option>, @@ -45,19 +40,25 @@ pub struct GetRecordOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetRecordError { #[serde(rename = "RecordNotFound")] RecordNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetRecordError { @@ -111,7 +112,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetRecordRequest { pub mod get_record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -301,4 +302,4 @@ where rkey: self._fields.3.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/import_repo.rs b/crates/polymodel-api/src/com_atproto/repo/import_repo.rs index 890576a..3aa371c 100644 --- a/crates/polymodel-api/src/com_atproto/repo/import_repo.rs +++ b/crates/polymodel-api/src/com_atproto/repo/import_repo.rs @@ -10,12 +10,12 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] @@ -36,16 +36,22 @@ impl jacquard_common::xrpc::XrpcResp for ImportRepoResponse { impl jacquard_common::xrpc::XrpcRequest for ImportRepo { const NSID: &'static str = "com.atproto.repo.importRepo"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/vnd.ipld.car"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/vnd.ipld.car", + ); type Response = ImportRepoResponse; - fn encode_body(&self, buffer: &mut Vec) -> Result<(), jacquard_common::xrpc::EncodeError> + fn encode_body( + &self, + buffer: &mut Vec, + ) -> Result<(), jacquard_common::xrpc::EncodeError> where Self: Serialize, { Ok(buffer.copy_from_slice(self.body.as_ref())) } - fn decode_body<'de>(body: &'de [u8]) -> Result + fn decode_body<'de>( + body: &'de [u8], + ) -> Result where Self: Deserialize<'de>, { @@ -61,8 +67,9 @@ Path: `/xrpc/com.atproto.repo.importRepo`. The request payload type is `ImportRe pub struct ImportRepoRequest; impl jacquard_common::xrpc::XrpcEndpoint for ImportRepoRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.importRepo"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/vnd.ipld.car"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/vnd.ipld.car", + ); type Request = ImportRepo; type Response = ImportRepoResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/list_missing_blobs.rs b/crates/polymodel-api/src/com_atproto/repo/list_missing_blobs.rs index d4e2eb8..5ea9ab5 100644 --- a/crates/polymodel-api/src/com_atproto/repo/list_missing_blobs.rs +++ b/crates/polymodel-api/src/com_atproto/repo/list_missing_blobs.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::list_missing_blobs; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::list_missing_blobs; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListMissingBlobs { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -40,11 +37,9 @@ pub struct ListMissingBlobs { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListMissingBlobsOutput { pub blobs: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -53,11 +48,9 @@ pub struct ListMissingBlobsOutput { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RecordBlob { pub cid: Cid, pub record_uri: AtUri, @@ -114,7 +107,7 @@ fn _default_limit() -> Option { pub mod list_missing_blobs_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -132,7 +125,10 @@ pub mod list_missing_blobs_state { } /// Builder for constructing an instance of this type. -pub struct ListMissingBlobsBuilder { +pub struct ListMissingBlobsBuilder< + St: list_missing_blobs_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option), _type: PhantomData S>, @@ -140,7 +136,10 @@ pub struct ListMissingBlobsBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ListMissingBlobsBuilder { + pub fn new() -> ListMissingBlobsBuilder< + list_missing_blobs_state::Empty, + DefaultStr, + > { ListMissingBlobsBuilder::new() } } @@ -215,7 +214,7 @@ where pub mod record_blob_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -353,7 +352,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> RecordBlob { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> RecordBlob { RecordBlob { cid: self._fields.0.unwrap(), record_uri: self._fields.1.unwrap(), @@ -363,10 +365,10 @@ where } fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.repo.listMissingBlobs"), @@ -375,36 +377,39 @@ fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { - parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("limit"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcQueryParameter::Params(LexXrpcParameters { + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::String(LexString { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("limit"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); map.insert( SmolStr::new_static("recordBlob"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("cid"), - SmolStr::new_static("recordUri"), - ]), + required: Some( + vec![ + SmolStr::new_static("cid"), SmolStr::new_static("recordUri") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -431,4 +436,4 @@ fn lexicon_doc_com_atproto_repo_listMissingBlobs() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/list_records.rs b/crates/polymodel-api/src/com_atproto/repo/list_records.rs index 32eeba8..815fa18 100644 --- a/crates/polymodel-api/src/com_atproto/repo/list_records.rs +++ b/crates/polymodel-api/src/com_atproto/repo/list_records.rs @@ -10,28 +10,25 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{AtUri, Cid, Nsid}; +use jacquard_common::types::string::{AtUri, Nsid, Cid}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::list_records; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::list_records; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListRecords { pub collection: Nsid, #[serde(skip_serializing_if = "Option::is_none")] @@ -45,11 +42,9 @@ pub struct ListRecords { pub reverse: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListRecordsOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -58,11 +53,9 @@ pub struct ListRecordsOutput { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Record { pub cid: Cid, pub uri: AtUri, @@ -120,7 +113,7 @@ fn _default_limit() -> Option { pub mod list_records_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -308,7 +301,7 @@ where pub mod record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -413,7 +406,10 @@ where St::Cid: record_state::IsUnset, { /// Set the `cid` field (required) - pub fn cid(mut self, value: impl Into>) -> RecordBuilder, S> { + pub fn cid( + mut self, + value: impl Into>, + ) -> RecordBuilder, S> { self._fields.0 = Option::Some(value.into()); RecordBuilder { _state: PhantomData, @@ -429,7 +425,10 @@ where St::Uri: record_state::IsUnset, { /// Set the `uri` field (required) - pub fn uri(mut self, value: impl Into>) -> RecordBuilder, S> { + pub fn uri( + mut self, + value: impl Into>, + ) -> RecordBuilder, S> { self._fields.1 = Option::Some(value.into()); RecordBuilder { _state: PhantomData, @@ -486,10 +485,10 @@ where } fn lexicon_doc_com_atproto_repo_listRecords() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.repo.listRecords"), @@ -498,67 +497,72 @@ fn lexicon_doc_com_atproto_repo_listRecords() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { - parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters { - required: Some(vec![ - SmolStr::new_static("repo"), - SmolStr::new_static("collection"), - ]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("collection"), - LexXrpcParametersProperty::String(LexString { - description: Some(CowStr::new_static( - "The NSID of the record type.", - )), - format: Some(LexStringFormat::Nsid), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("limit"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("repo"), - LexXrpcParametersProperty::String(LexString { - description: Some(CowStr::new_static( - "The handle or DID of the repo.", - )), - format: Some(LexStringFormat::AtIdentifier), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("reverse"), - LexXrpcParametersProperty::Boolean(LexBoolean { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcQueryParameter::Params(LexXrpcParameters { + required: Some( + vec![ + SmolStr::new_static("repo"), + SmolStr::new_static("collection") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("collection"), + LexXrpcParametersProperty::String(LexString { + description: Some( + CowStr::new_static("The NSID of the record type."), + ), + format: Some(LexStringFormat::Nsid), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::String(LexString { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("limit"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("repo"), + LexXrpcParametersProperty::String(LexString { + description: Some( + CowStr::new_static("The handle or DID of the repo."), + ), + format: Some(LexStringFormat::AtIdentifier), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("reverse"), + LexXrpcParametersProperty::Boolean(LexBoolean { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); map.insert( SmolStr::new_static("record"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("uri"), - SmolStr::new_static("cid"), - SmolStr::new_static("value"), - ]), + required: Some( + vec![ + SmolStr::new_static("uri"), SmolStr::new_static("cid"), + SmolStr::new_static("value") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -591,4 +595,4 @@ fn lexicon_doc_com_atproto_repo_listRecords() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/put_record.rs b/crates/polymodel-api/src/com_atproto/repo/put_record.rs index ef3460b..3d2b80e 100644 --- a/crates/polymodel-api/src/com_atproto/repo/put_record.rs +++ b/crates/polymodel-api/src/com_atproto/repo/put_record.rs @@ -8,22 +8,19 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::repo::CommitMeta; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; -use jacquard_common::types::string::{AtUri, Cid, Nsid, RecordKey, Rkey}; +use jacquard_common::types::string::{AtUri, Nsid, Cid, RecordKey, Rkey}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::CommitMeta; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PutRecord { ///The NSID of the record collection. pub collection: Nsid, @@ -46,11 +43,9 @@ pub struct PutRecord { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PutRecordOutput { pub cid: Cid, #[serde(skip_serializing_if = "Option::is_none")] @@ -62,6 +57,7 @@ pub struct PutRecordOutput { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum PutRecordOutputValidationStatus { Valid, @@ -108,7 +104,8 @@ impl Serialize for PutRecordOutputValidationStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for PutRecordOutputValidationStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for PutRecordOutputValidationStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -132,8 +129,12 @@ where type Output = PutRecordOutputValidationStatus; fn into_static(self) -> Self::Output { match self { - PutRecordOutputValidationStatus::Valid => PutRecordOutputValidationStatus::Valid, - PutRecordOutputValidationStatus::Unknown => PutRecordOutputValidationStatus::Unknown, + PutRecordOutputValidationStatus::Valid => { + PutRecordOutputValidationStatus::Valid + } + PutRecordOutputValidationStatus::Unknown => { + PutRecordOutputValidationStatus::Unknown + } PutRecordOutputValidationStatus::Other(v) => { PutRecordOutputValidationStatus::Other(v.into_static()) } @@ -141,19 +142,25 @@ where } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum PutRecordError { #[serde(rename = "InvalidSwap")] InvalidSwap(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for PutRecordError { @@ -190,8 +197,9 @@ impl jacquard_common::xrpc::XrpcResp for PutRecordResponse { impl jacquard_common::xrpc::XrpcRequest for PutRecord { const NSID: &'static str = "com.atproto.repo.putRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = PutRecordResponse; } @@ -201,15 +209,16 @@ Path: `/xrpc/com.atproto.repo.putRecord`. The request payload type is `PutRecord pub struct PutRecordRequest; impl jacquard_common::xrpc::XrpcEndpoint for PutRecordRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.putRecord"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = PutRecord; type Response = PutRecordResponse; } pub mod put_record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -469,7 +478,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> PutRecord { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> PutRecord { PutRecord { collection: self._fields.0.unwrap(), record: self._fields.1.unwrap(), @@ -481,4 +493,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/strong_ref.rs b/crates/polymodel-api/src/com_atproto/repo/strong_ref.rs index 27d0334..5489e14 100644 --- a/crates/polymodel-api/src/com_atproto/repo/strong_ref.rs +++ b/crates/polymodel-api/src/com_atproto/repo/strong_ref.rs @@ -23,13 +23,10 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct StrongRef { pub cid: Cid, pub uri: AtUri, @@ -54,7 +51,7 @@ impl LexiconSchema for StrongRef { pub mod strong_ref_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -192,7 +189,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> StrongRef { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> StrongRef { StrongRef { cid: self._fields.0.unwrap(), uri: self._fields.1.unwrap(), @@ -202,10 +202,10 @@ where } fn lexicon_doc_com_atproto_repo_strongRef() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.repo.strongRef"), @@ -214,7 +214,9 @@ fn lexicon_doc_com_atproto_repo_strongRef() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")]), + required: Some( + vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -241,4 +243,4 @@ fn lexicon_doc_com_atproto_repo_strongRef() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/repo/upload_blob.rs b/crates/polymodel-api/src/com_atproto/repo/upload_blob.rs index 1217197..3529491 100644 --- a/crates/polymodel-api/src/com_atproto/repo/upload_blob.rs +++ b/crates/polymodel-api/src/com_atproto/repo/upload_blob.rs @@ -10,13 +10,13 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::blob::BlobRef; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] @@ -24,11 +24,9 @@ pub struct UploadBlob { pub body: Bytes, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UploadBlobOutput { pub blob: BlobRef, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -48,16 +46,22 @@ impl jacquard_common::xrpc::XrpcResp for UploadBlobResponse { impl jacquard_common::xrpc::XrpcRequest for UploadBlob { const NSID: &'static str = "com.atproto.repo.uploadBlob"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("*/*"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "*/*", + ); type Response = UploadBlobResponse; - fn encode_body(&self, buffer: &mut Vec) -> Result<(), jacquard_common::xrpc::EncodeError> + fn encode_body( + &self, + buffer: &mut Vec, + ) -> Result<(), jacquard_common::xrpc::EncodeError> where Self: Serialize, { Ok(buffer.copy_from_slice(self.body.as_ref())) } - fn decode_body<'de>(body: &'de [u8]) -> Result + fn decode_body<'de>( + body: &'de [u8], + ) -> Result where Self: Deserialize<'de>, { @@ -73,8 +77,9 @@ Path: `/xrpc/com.atproto.repo.uploadBlob`. The request payload type is `UploadBl pub struct UploadBlobRequest; impl jacquard_common::xrpc::XrpcEndpoint for UploadBlobRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.uploadBlob"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("*/*"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "*/*", + ); type Request = UploadBlob; type Response = UploadBlobResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server.rs b/crates/polymodel-api/src/com_atproto/server.rs index 56e5a89..7e8d51e 100644 --- a/crates/polymodel-api/src/com_atproto/server.rs +++ b/crates/polymodel-api/src/com_atproto/server.rs @@ -32,32 +32,30 @@ pub mod reset_password; pub mod revoke_app_password; pub mod update_email; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Datetime, Did}; +use jacquard_common::types::string::{Did, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::server; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct InviteCode { pub available: i64, pub code: S, @@ -70,11 +68,9 @@ pub struct InviteCode { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct InviteCodeUse { pub used_at: Datetime, pub used_by: Did, @@ -114,7 +110,7 @@ impl LexiconSchema for InviteCodeUse { pub mod invite_code_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -455,7 +451,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> InviteCode { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> InviteCode { InviteCode { available: self._fields.0.unwrap(), code: self._fields.1.unwrap(), @@ -470,10 +469,10 @@ where } fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.defs"), @@ -482,15 +481,16 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("inviteCode"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("code"), - SmolStr::new_static("available"), - SmolStr::new_static("disabled"), - SmolStr::new_static("forAccount"), - SmolStr::new_static("createdBy"), - SmolStr::new_static("createdAt"), - SmolStr::new_static("uses"), - ]), + required: Some( + vec![ + SmolStr::new_static("code"), + SmolStr::new_static("available"), + SmolStr::new_static("disabled"), + SmolStr::new_static("forAccount"), + SmolStr::new_static("createdBy"), + SmolStr::new_static("createdAt"), SmolStr::new_static("uses") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -502,9 +502,7 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("code"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), @@ -515,9 +513,7 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("createdBy"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("disabled"), @@ -527,9 +523,7 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("forAccount"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("uses"), @@ -549,10 +543,11 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("inviteCodeUse"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("usedBy"), - SmolStr::new_static("usedAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("usedBy"), SmolStr::new_static("usedAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -583,7 +578,7 @@ fn lexicon_doc_com_atproto_server_defs() -> LexiconDoc<'static> { pub mod invite_code_use_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -626,7 +621,10 @@ pub mod invite_code_use_state { } /// Builder for constructing an instance of this type. -pub struct InviteCodeUseBuilder { +pub struct InviteCodeUseBuilder< + St: invite_code_use_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option>), _type: PhantomData S>, @@ -721,11 +719,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> InviteCodeUse { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> InviteCodeUse { InviteCodeUse { used_at: self._fields.0.unwrap(), used_by: self._fields.1.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/activate_account.rs b/crates/polymodel-api/src/com_atproto/server/activate_account.rs index d9e9149..4ae1e59 100644 --- a/crates/polymodel-api/src/com_atproto/server/activate_account.rs +++ b/crates/polymodel-api/src/com_atproto/server/activate_account.rs @@ -10,11 +10,11 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /** Request marker for the `com.atproto.server.activateAccount` procedure. This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/ @@ -34,8 +34,9 @@ impl jacquard_common::xrpc::XrpcResp for ActivateAccountResponse { impl jacquard_common::xrpc::XrpcRequest for ActivateAccount { const NSID: &'static str = "com.atproto.server.activateAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = ActivateAccountResponse; } @@ -45,8 +46,9 @@ Path: `/xrpc/com.atproto.server.activateAccount`. The request payload type is `A pub struct ActivateAccountRequest; impl jacquard_common::xrpc::XrpcEndpoint for ActivateAccountRequest { const PATH: &'static str = "/xrpc/com.atproto.server.activateAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = ActivateAccount; type Response = ActivateAccountResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/check_account_status.rs b/crates/polymodel-api/src/com_atproto/server/check_account_status.rs index fc06189..402c5e0 100644 --- a/crates/polymodel-api/src/com_atproto/server/check_account_status.rs +++ b/crates/polymodel-api/src/com_atproto/server/check_account_status.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Cid; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CheckAccountStatusOutput { pub activated: bool, pub expected_blobs: i64, @@ -68,4 +65,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for CheckAccountStatusRequest { const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = CheckAccountStatus; type Response = CheckAccountStatusResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/confirm_email.rs b/crates/polymodel-api/src/com_atproto/server/confirm_email.rs index 1785bc8..1280eb5 100644 --- a/crates/polymodel-api/src/com_atproto/server/confirm_email.rs +++ b/crates/polymodel-api/src/com_atproto/server/confirm_email.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ConfirmEmail { pub email: S, pub token: S, @@ -28,9 +25,18 @@ pub struct ConfirmEmail { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ConfirmEmailError { #[serde(rename = "AccountNotFound")] @@ -43,10 +49,7 @@ pub enum ConfirmEmailError { InvalidEmail(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ConfirmEmailError { @@ -104,8 +107,9 @@ impl jacquard_common::xrpc::XrpcResp for ConfirmEmailResponse { impl jacquard_common::xrpc::XrpcRequest for ConfirmEmail { const NSID: &'static str = "com.atproto.server.confirmEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = ConfirmEmailResponse; } @@ -115,8 +119,9 @@ Path: `/xrpc/com.atproto.server.confirmEmail`. The request payload type is `Conf pub struct ConfirmEmailRequest; impl jacquard_common::xrpc::XrpcEndpoint for ConfirmEmailRequest { const PATH: &'static str = "/xrpc/com.atproto.server.confirmEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = ConfirmEmail; type Response = ConfirmEmailResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/create_account.rs b/crates/polymodel-api/src/com_atproto/server/create_account.rs index 6361690..5420ea3 100644 --- a/crates/polymodel-api/src/com_atproto/server/create_account.rs +++ b/crates/polymodel-api/src/com_atproto/server/create_account.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateAccount { ///Pre-existing atproto DID, being imported to a new account. #[serde(skip_serializing_if = "Option::is_none")] @@ -49,11 +46,9 @@ pub struct CreateAccount { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateAccountOutput { pub access_jwt: S, ///The DID of the new account. @@ -67,9 +62,18 @@ pub struct CreateAccountOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum CreateAccountError { #[serde(rename = "InvalidHandle")] @@ -88,10 +92,7 @@ pub enum CreateAccountError { IncompatibleDidDoc(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for CreateAccountError { @@ -170,8 +171,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateAccountResponse { impl jacquard_common::xrpc::XrpcRequest for CreateAccount { const NSID: &'static str = "com.atproto.server.createAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateAccountResponse; } @@ -181,15 +183,16 @@ Path: `/xrpc/com.atproto.server.createAccount`. The request payload type is `Cre pub struct CreateAccountRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateAccountRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateAccount; type Response = CreateAccountResponse; } pub mod create_account_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -220,7 +223,10 @@ pub mod create_account_state { } /// Builder for constructing an instance of this type. -pub struct CreateAccountBuilder { +pub struct CreateAccountBuilder< + St: create_account_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: ( Option>, @@ -416,7 +422,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateAccount { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateAccount { CreateAccount { did: self._fields.0, email: self._fields.1, @@ -430,4 +439,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/create_app_password.rs b/crates/polymodel-api/src/com_atproto/server/create_app_password.rs index b8ae8af..e22e986 100644 --- a/crates/polymodel-api/src/com_atproto/server/create_app_password.rs +++ b/crates/polymodel-api/src/com_atproto/server/create_app_password.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::server::create_app_password; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::create_app_password; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AppPassword { pub created_at: Datetime, pub name: S, @@ -41,11 +38,9 @@ pub struct AppPassword { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateAppPassword { ///A short name for the App Password, to help distinguish them. pub name: S, @@ -56,11 +51,9 @@ pub struct CreateAppPassword { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateAppPasswordOutput { #[serde(flatten)] pub value: Data, @@ -68,19 +61,25 @@ pub struct CreateAppPasswordOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum CreateAppPasswordError { #[serde(rename = "AccountTakedown")] AccountTakedown(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for CreateAppPasswordError { @@ -132,8 +131,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateAppPasswordResponse { impl jacquard_common::xrpc::XrpcRequest for CreateAppPassword { const NSID: &'static str = "com.atproto.server.createAppPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateAppPasswordResponse; } @@ -143,15 +143,16 @@ Path: `/xrpc/com.atproto.server.createAppPassword`. The request payload type is pub struct CreateAppPasswordRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateAppPasswordRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createAppPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateAppPassword; type Response = CreateAppPasswordResponse; } pub mod app_password_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -338,7 +339,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AppPassword { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AppPassword { AppPassword { created_at: self._fields.0.unwrap(), name: self._fields.1.unwrap(), @@ -350,10 +354,10 @@ where } fn lexicon_doc_com_atproto_server_createAppPassword() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.createAppPassword"), @@ -362,11 +366,12 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("appPassword"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("name"), - SmolStr::new_static("password"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("name"), SmolStr::new_static("password"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -379,15 +384,11 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("password"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("privileged"), @@ -442,4 +443,4 @@ fn lexicon_doc_com_atproto_server_createAppPassword() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/create_invite_code.rs b/crates/polymodel-api/src/com_atproto/server/create_invite_code.rs index ba35a7f..514a52e 100644 --- a/crates/polymodel-api/src/com_atproto/server/create_invite_code.rs +++ b/crates/polymodel-api/src/com_atproto/server/create_invite_code.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateInviteCode { #[serde(skip_serializing_if = "Option::is_none")] pub for_account: Option>, @@ -30,11 +27,9 @@ pub struct CreateInviteCode { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateInviteCodeOutput { pub code: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -54,8 +49,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateInviteCodeResponse { impl jacquard_common::xrpc::XrpcRequest for CreateInviteCode { const NSID: &'static str = "com.atproto.server.createInviteCode"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateInviteCodeResponse; } @@ -65,15 +61,16 @@ Path: `/xrpc/com.atproto.server.createInviteCode`. The request payload type is ` pub struct CreateInviteCodeRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateInviteCodeRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createInviteCode"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateInviteCode; type Response = CreateInviteCodeResponse; } pub mod create_invite_code_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -104,7 +101,10 @@ pub mod create_invite_code_state { } /// Builder for constructing an instance of this type. -pub struct CreateInviteCodeBuilder { +pub struct CreateInviteCodeBuilder< + St: create_invite_code_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>, Option), _type: PhantomData S>, @@ -112,7 +112,10 @@ pub struct CreateInviteCodeBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> CreateInviteCodeBuilder { + pub fn new() -> CreateInviteCodeBuilder< + create_invite_code_state::Empty, + DefaultStr, + > { CreateInviteCodeBuilder::new() } } @@ -192,11 +195,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateInviteCode { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateInviteCode { CreateInviteCode { for_account: self._fields.0, use_count: self._fields.1.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/create_invite_codes.rs b/crates/polymodel-api/src/com_atproto/server/create_invite_codes.rs index dc018bb..bb722c1 100644 --- a/crates/polymodel-api/src/com_atproto/server/create_invite_codes.rs +++ b/crates/polymodel-api/src/com_atproto/server/create_invite_codes.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::server::create_invite_codes; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::create_invite_codes; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AccountCodes { pub account: S, pub codes: Vec, @@ -38,11 +35,9 @@ pub struct AccountCodes { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateInviteCodes { /// Defaults to `1`. #[serde(default = "_default_create_invite_codes_code_count")] @@ -54,11 +49,9 @@ pub struct CreateInviteCodes { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateInviteCodesOutput { pub codes: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -93,8 +86,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateInviteCodesResponse { impl jacquard_common::xrpc::XrpcRequest for CreateInviteCodes { const NSID: &'static str = "com.atproto.server.createInviteCodes"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateInviteCodesResponse; } @@ -104,15 +98,16 @@ Path: `/xrpc/com.atproto.server.createInviteCodes`. The request payload type is pub struct CreateInviteCodesRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateInviteCodesRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createInviteCodes"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateInviteCodes; type Response = CreateInviteCodesResponse; } pub mod account_codes_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -250,7 +245,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AccountCodes { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AccountCodes { AccountCodes { account: self._fields.0.unwrap(), codes: self._fields.1.unwrap(), @@ -260,10 +258,10 @@ where } fn lexicon_doc_com_atproto_server_createInviteCodes() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.createInviteCodes"), @@ -272,18 +270,17 @@ fn lexicon_doc_com_atproto_server_createInviteCodes() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("accountCodes"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("account"), - SmolStr::new_static("codes"), - ]), + required: Some( + vec![ + SmolStr::new_static("account"), SmolStr::new_static("codes") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("account"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("codes"), @@ -304,40 +301,44 @@ fn lexicon_doc_com_atproto_server_createInviteCodes() -> LexiconDoc<'static> { LexUserType::XrpcProcedure(LexXrpcProcedure { input: Some(LexXrpcBody { encoding: CowStr::new_static("application/json"), - schema: Some(LexXrpcBodySchema::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("codeCount"), - SmolStr::new_static("useCount"), - ]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("codeCount"), - LexObjectProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("forAccounts"), - LexObjectProperty::Array(LexArray { - items: LexArrayItem::String(LexString { - format: Some(LexStringFormat::Did), + schema: Some( + LexXrpcBodySchema::Object(LexObject { + required: Some( + vec![ + SmolStr::new_static("codeCount"), + SmolStr::new_static("useCount") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("codeCount"), + LexObjectProperty::Integer(LexInteger { ..Default::default() }), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("useCount"), - LexObjectProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + ); + map.insert( + SmolStr::new_static("forAccounts"), + LexObjectProperty::Array(LexArray { + items: LexArrayItem::String(LexString { + format: Some(LexStringFormat::Did), + ..Default::default() + }), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("useCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ..Default::default() @@ -355,7 +356,7 @@ fn _default_create_invite_codes_code_count() -> i64 { pub mod create_invite_codes_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -398,7 +399,10 @@ pub mod create_invite_codes_state { } /// Builder for constructing an instance of this type. -pub struct CreateInviteCodesBuilder { +pub struct CreateInviteCodesBuilder< + St: create_invite_codes_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option>>, Option), _type: PhantomData S>, @@ -406,7 +410,10 @@ pub struct CreateInviteCodesBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> CreateInviteCodesBuilder { + pub fn new() -> CreateInviteCodesBuilder< + create_invite_codes_state::Empty, + DefaultStr, + > { CreateInviteCodesBuilder::new() } } @@ -507,7 +514,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> CreateInviteCodes { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> CreateInviteCodes { CreateInviteCodes { code_count: self._fields.0.unwrap(), for_accounts: self._fields.1, @@ -515,4 +525,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/create_session.rs b/crates/polymodel-api/src/com_atproto/server/create_session.rs index d29b659..ef83930 100644 --- a/crates/polymodel-api/src/com_atproto/server/create_session.rs +++ b/crates/polymodel-api/src/com_atproto/server/create_session.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateSession { ///When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned #[serde(skip_serializing_if = "Option::is_none")] @@ -35,11 +32,9 @@ pub struct CreateSession { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CreateSessionOutput { pub access_jwt: S, #[serde(skip_serializing_if = "Option::is_none")] @@ -113,7 +108,8 @@ impl Serialize for CreateSessionOutputStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for CreateSessionOutputStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for CreateSessionOutputStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -139,7 +135,9 @@ where match self { CreateSessionOutputStatus::Takendown => CreateSessionOutputStatus::Takendown, CreateSessionOutputStatus::Suspended => CreateSessionOutputStatus::Suspended, - CreateSessionOutputStatus::Deactivated => CreateSessionOutputStatus::Deactivated, + CreateSessionOutputStatus::Deactivated => { + CreateSessionOutputStatus::Deactivated + } CreateSessionOutputStatus::Other(v) => { CreateSessionOutputStatus::Other(v.into_static()) } @@ -147,9 +145,18 @@ where } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum CreateSessionError { #[serde(rename = "AccountTakedown")] @@ -158,10 +165,7 @@ pub enum CreateSessionError { AuthFactorTokenRequired(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for CreateSessionError { @@ -205,8 +209,9 @@ impl jacquard_common::xrpc::XrpcResp for CreateSessionResponse { impl jacquard_common::xrpc::XrpcRequest for CreateSession { const NSID: &'static str = "com.atproto.server.createSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = CreateSessionResponse; } @@ -216,8 +221,9 @@ Path: `/xrpc/com.atproto.server.createSession`. The request payload type is `Cre pub struct CreateSessionRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateSessionRequest { const PATH: &'static str = "/xrpc/com.atproto.server.createSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = CreateSession; type Response = CreateSessionResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/deactivate_account.rs b/crates/polymodel-api/src/com_atproto/server/deactivate_account.rs index 6d4c0bd..42dd83d 100644 --- a/crates/polymodel-api/src/com_atproto/server/deactivate_account.rs +++ b/crates/polymodel-api/src/com_atproto/server/deactivate_account.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Datetime; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeactivateAccount { ///A recommendation to server as to how long they should hold onto the deactivated account before deleting. #[serde(skip_serializing_if = "Option::is_none")] @@ -43,8 +40,9 @@ impl jacquard_common::xrpc::XrpcResp for DeactivateAccountResponse { impl jacquard_common::xrpc::XrpcRequest for DeactivateAccount { const NSID: &'static str = "com.atproto.server.deactivateAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DeactivateAccountResponse; } @@ -54,8 +52,9 @@ Path: `/xrpc/com.atproto.server.deactivateAccount`. The request payload type is pub struct DeactivateAccountRequest; impl jacquard_common::xrpc::XrpcEndpoint for DeactivateAccountRequest { const PATH: &'static str = "/xrpc/com.atproto.server.deactivateAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DeactivateAccount; type Response = DeactivateAccountResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/delete_account.rs b/crates/polymodel-api/src/com_atproto/server/delete_account.rs index 5050fdf..24497bf 100644 --- a/crates/polymodel-api/src/com_atproto/server/delete_account.rs +++ b/crates/polymodel-api/src/com_atproto/server/delete_account.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DeleteAccount { pub did: Did, pub password: S, @@ -30,9 +27,18 @@ pub struct DeleteAccount { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum DeleteAccountError { #[serde(rename = "ExpiredToken")] @@ -41,10 +47,7 @@ pub enum DeleteAccountError { InvalidToken(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for DeleteAccountError { @@ -88,8 +91,9 @@ impl jacquard_common::xrpc::XrpcResp for DeleteAccountResponse { impl jacquard_common::xrpc::XrpcRequest for DeleteAccount { const NSID: &'static str = "com.atproto.server.deleteAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DeleteAccountResponse; } @@ -99,15 +103,16 @@ Path: `/xrpc/com.atproto.server.deleteAccount`. The request payload type is `Del pub struct DeleteAccountRequest; impl jacquard_common::xrpc::XrpcEndpoint for DeleteAccountRequest { const PATH: &'static str = "/xrpc/com.atproto.server.deleteAccount"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DeleteAccount; type Response = DeleteAccountResponse; } pub mod delete_account_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -164,7 +169,10 @@ pub mod delete_account_state { } /// Builder for constructing an instance of this type. -pub struct DeleteAccountBuilder { +pub struct DeleteAccountBuilder< + St: delete_account_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>, Option, Option), _type: PhantomData S>, @@ -280,7 +288,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> DeleteAccount { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> DeleteAccount { DeleteAccount { did: self._fields.0.unwrap(), password: self._fields.1.unwrap(), @@ -288,4 +299,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/delete_session.rs b/crates/polymodel-api/src/com_atproto/server/delete_session.rs index eff080c..159d54c 100644 --- a/crates/polymodel-api/src/com_atproto/server/delete_session.rs +++ b/crates/polymodel-api/src/com_atproto/server/delete_session.rs @@ -10,15 +10,23 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum DeleteSessionError { #[serde(rename = "InvalidToken")] @@ -27,10 +35,7 @@ pub enum DeleteSessionError { ExpiredToken(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for DeleteSessionError { @@ -80,8 +85,9 @@ impl jacquard_common::xrpc::XrpcResp for DeleteSessionResponse { impl jacquard_common::xrpc::XrpcRequest for DeleteSession { const NSID: &'static str = "com.atproto.server.deleteSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = DeleteSessionResponse; } @@ -91,8 +97,9 @@ Path: `/xrpc/com.atproto.server.deleteSession`. The request payload type is `Del pub struct DeleteSessionRequest; impl jacquard_common::xrpc::XrpcEndpoint for DeleteSessionRequest { const PATH: &'static str = "/xrpc/com.atproto.server.deleteSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = DeleteSession; type Response = DeleteSessionResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/describe_server.rs b/crates/polymodel-api/src/com_atproto/server/describe_server.rs index ec0eee8..4d11a5a 100644 --- a/crates/polymodel-api/src/com_atproto/server/describe_server.rs +++ b/crates/polymodel-api/src/com_atproto/server/describe_server.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::server::describe_server; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::describe_server; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Contact { #[serde(skip_serializing_if = "Option::is_none")] pub email: Option, @@ -38,11 +35,9 @@ pub struct Contact { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Links { #[serde(skip_serializing_if = "Option::is_none")] pub privacy_policy: Option>, @@ -52,11 +47,9 @@ pub struct Links { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DescribeServerOutput { ///List of domain suffixes that can be used in account handles. pub available_user_domains: Vec, @@ -142,10 +135,10 @@ impl jacquard_common::xrpc::XrpcEndpoint for DescribeServerRequest { } fn lexicon_doc_com_atproto_server_describeServer() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.describeServer"), @@ -159,9 +152,7 @@ fn lexicon_doc_com_atproto_server_describeServer() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("email"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -204,4 +195,4 @@ fn lexicon_doc_com_atproto_server_describeServer() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/get_account_invite_codes.rs b/crates/polymodel-api/src/com_atproto/server/get_account_invite_codes.rs index dfa19e0..af60bec 100644 --- a/crates/polymodel-api/src/com_atproto/server/get_account_invite_codes.rs +++ b/crates/polymodel-api/src/com_atproto/server/get_account_invite_codes.rs @@ -8,14 +8,14 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::server::InviteCode; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::InviteCode; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] @@ -30,30 +30,34 @@ pub struct GetAccountInviteCodes { pub include_used: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAccountInviteCodesOutput { pub codes: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetAccountInviteCodesError { #[serde(rename = "DuplicateCreate")] DuplicateCreate(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetAccountInviteCodesError { @@ -115,7 +119,7 @@ fn _default_include_used() -> Option { pub mod get_account_invite_codes_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -202,4 +206,4 @@ where include_used: self._fields.1, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/get_service_auth.rs b/crates/polymodel-api/src/com_atproto/server/get_service_auth.rs index 164339c..4fe86fa 100644 --- a/crates/polymodel-api/src/com_atproto/server/get_service_auth.rs +++ b/crates/polymodel-api/src/com_atproto/server/get_service_auth.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Nsid; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetServiceAuth { pub aud: S, #[serde(skip_serializing_if = "Option::is_none")] @@ -30,20 +27,27 @@ pub struct GetServiceAuth { pub lxm: Option>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetServiceAuthOutput { pub token: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetServiceAuthError { /// Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes. @@ -51,10 +55,7 @@ pub enum GetServiceAuthError { BadExpiration(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetServiceAuthError { @@ -108,7 +109,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetServiceAuthRequest { pub mod get_service_auth_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -139,7 +140,10 @@ pub mod get_service_auth_state { } /// Builder for constructing an instance of this type. -pub struct GetServiceAuthBuilder { +pub struct GetServiceAuthBuilder< + St: get_service_auth_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option, Option, Option>), _type: PhantomData S>, @@ -239,4 +243,4 @@ where lxm: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/get_session.rs b/crates/polymodel-api/src/com_atproto/server/get_session.rs index 90660f8..f446dfe 100644 --- a/crates/polymodel-api/src/com_atproto/server/get_session.rs +++ b/crates/polymodel-api/src/com_atproto/server/get_session.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSessionOutput { #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -120,7 +117,9 @@ where GetSessionOutputStatus::Takendown => GetSessionOutputStatus::Takendown, GetSessionOutputStatus::Suspended => GetSessionOutputStatus::Suspended, GetSessionOutputStatus::Deactivated => GetSessionOutputStatus::Deactivated, - GetSessionOutputStatus::Other(v) => GetSessionOutputStatus::Other(v.into_static()), + GetSessionOutputStatus::Other(v) => { + GetSessionOutputStatus::Other(v.into_static()) + } } } } @@ -157,4 +156,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetSessionRequest { const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = GetSession; type Response = GetSessionResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/list_app_passwords.rs b/crates/polymodel-api/src/com_atproto/server/list_app_passwords.rs index c8b29aa..77026db 100644 --- a/crates/polymodel-api/src/com_atproto/server/list_app_passwords.rs +++ b/crates/polymodel-api/src/com_atproto/server/list_app_passwords.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::server::list_app_passwords; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::server::list_app_passwords; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AppPassword { pub created_at: Datetime, pub name: S, @@ -40,30 +37,34 @@ pub struct AppPassword { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListAppPasswordsOutput { pub passwords: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ListAppPasswordsError { #[serde(rename = "AccountTakedown")] AccountTakedown(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ListAppPasswordsError { @@ -138,7 +139,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for ListAppPasswordsRequest { pub mod app_password_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -290,7 +291,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AppPassword { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AppPassword { AppPassword { created_at: self._fields.0.unwrap(), name: self._fields.1.unwrap(), @@ -301,10 +305,10 @@ where } fn lexicon_doc_com_atproto_server_listAppPasswords() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.server.listAppPasswords"), @@ -313,10 +317,11 @@ fn lexicon_doc_com_atproto_server_listAppPasswords() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("appPassword"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("name"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("name"), SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -329,9 +334,7 @@ fn lexicon_doc_com_atproto_server_listAppPasswords() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("privileged"), @@ -355,4 +358,4 @@ fn lexicon_doc_com_atproto_server_listAppPasswords() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/refresh_session.rs b/crates/polymodel-api/src/com_atproto/server/refresh_session.rs index 04379b3..dc4935f 100644 --- a/crates/polymodel-api/src/com_atproto/server/refresh_session.rs +++ b/crates/polymodel-api/src/com_atproto/server/refresh_session.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Handle}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RefreshSessionOutput { pub access_jwt: S, #[serde(skip_serializing_if = "Option::is_none")] @@ -95,7 +92,8 @@ impl Serialize for RefreshSessionOutputStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for RefreshSessionOutputStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for RefreshSessionOutputStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -119,9 +117,15 @@ where type Output = RefreshSessionOutputStatus; fn into_static(self) -> Self::Output { match self { - RefreshSessionOutputStatus::Takendown => RefreshSessionOutputStatus::Takendown, - RefreshSessionOutputStatus::Suspended => RefreshSessionOutputStatus::Suspended, - RefreshSessionOutputStatus::Deactivated => RefreshSessionOutputStatus::Deactivated, + RefreshSessionOutputStatus::Takendown => { + RefreshSessionOutputStatus::Takendown + } + RefreshSessionOutputStatus::Suspended => { + RefreshSessionOutputStatus::Suspended + } + RefreshSessionOutputStatus::Deactivated => { + RefreshSessionOutputStatus::Deactivated + } RefreshSessionOutputStatus::Other(v) => { RefreshSessionOutputStatus::Other(v.into_static()) } @@ -129,9 +133,18 @@ where } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum RefreshSessionError { #[serde(rename = "AccountTakedown")] @@ -142,10 +155,7 @@ pub enum RefreshSessionError { ExpiredToken(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for RefreshSessionError { @@ -202,8 +212,9 @@ impl jacquard_common::xrpc::XrpcResp for RefreshSessionResponse { impl jacquard_common::xrpc::XrpcRequest for RefreshSession { const NSID: &'static str = "com.atproto.server.refreshSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RefreshSessionResponse; } @@ -213,8 +224,9 @@ Path: `/xrpc/com.atproto.server.refreshSession`. The request payload type is `Re pub struct RefreshSessionRequest; impl jacquard_common::xrpc::XrpcEndpoint for RefreshSessionRequest { const PATH: &'static str = "/xrpc/com.atproto.server.refreshSession"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RefreshSession; type Response = RefreshSessionResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/request_account_delete.rs b/crates/polymodel-api/src/com_atproto/server/request_account_delete.rs index f7a385a..1e27edd 100644 --- a/crates/polymodel-api/src/com_atproto/server/request_account_delete.rs +++ b/crates/polymodel-api/src/com_atproto/server/request_account_delete.rs @@ -10,11 +10,11 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /** Request marker for the `com.atproto.server.requestAccountDelete` procedure. This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/ @@ -34,8 +34,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestAccountDeleteResponse { impl jacquard_common::xrpc::XrpcRequest for RequestAccountDelete { const NSID: &'static str = "com.atproto.server.requestAccountDelete"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestAccountDeleteResponse; } @@ -45,8 +46,9 @@ Path: `/xrpc/com.atproto.server.requestAccountDelete`. The request payload type pub struct RequestAccountDeleteRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestAccountDeleteRequest { const PATH: &'static str = "/xrpc/com.atproto.server.requestAccountDelete"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestAccountDelete; type Response = RequestAccountDeleteResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/request_email_confirmation.rs b/crates/polymodel-api/src/com_atproto/server/request_email_confirmation.rs index bdf6831..dbcacde 100644 --- a/crates/polymodel-api/src/com_atproto/server/request_email_confirmation.rs +++ b/crates/polymodel-api/src/com_atproto/server/request_email_confirmation.rs @@ -10,11 +10,11 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /** Request marker for the `com.atproto.server.requestEmailConfirmation` procedure. This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/ @@ -34,8 +34,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestEmailConfirmationResponse { impl jacquard_common::xrpc::XrpcRequest for RequestEmailConfirmation { const NSID: &'static str = "com.atproto.server.requestEmailConfirmation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestEmailConfirmationResponse; } @@ -45,8 +46,9 @@ Path: `/xrpc/com.atproto.server.requestEmailConfirmation`. The request payload t pub struct RequestEmailConfirmationRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestEmailConfirmationRequest { const PATH: &'static str = "/xrpc/com.atproto.server.requestEmailConfirmation"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestEmailConfirmation; type Response = RequestEmailConfirmationResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/request_email_update.rs b/crates/polymodel-api/src/com_atproto/server/request_email_update.rs index c75a0b2..c32691a 100644 --- a/crates/polymodel-api/src/com_atproto/server/request_email_update.rs +++ b/crates/polymodel-api/src/com_atproto/server/request_email_update.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RequestEmailUpdateOutput { pub token_required: bool, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -46,8 +43,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestEmailUpdateResponse { impl jacquard_common::xrpc::XrpcRequest for RequestEmailUpdate { const NSID: &'static str = "com.atproto.server.requestEmailUpdate"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestEmailUpdateResponse; } @@ -57,8 +55,9 @@ Path: `/xrpc/com.atproto.server.requestEmailUpdate`. The request payload type is pub struct RequestEmailUpdateRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestEmailUpdateRequest { const PATH: &'static str = "/xrpc/com.atproto.server.requestEmailUpdate"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestEmailUpdate; type Response = RequestEmailUpdateResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/request_password_reset.rs b/crates/polymodel-api/src/com_atproto/server/request_password_reset.rs index 4e0201b..33148f1 100644 --- a/crates/polymodel-api/src/com_atproto/server/request_password_reset.rs +++ b/crates/polymodel-api/src/com_atproto/server/request_password_reset.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RequestPasswordReset { pub email: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -40,8 +37,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestPasswordResetResponse { impl jacquard_common::xrpc::XrpcRequest for RequestPasswordReset { const NSID: &'static str = "com.atproto.server.requestPasswordReset"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestPasswordResetResponse; } @@ -51,8 +49,9 @@ Path: `/xrpc/com.atproto.server.requestPasswordReset`. The request payload type pub struct RequestPasswordResetRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestPasswordResetRequest { const PATH: &'static str = "/xrpc/com.atproto.server.requestPasswordReset"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestPasswordReset; type Response = RequestPasswordResetResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/reserve_signing_key.rs b/crates/polymodel-api/src/com_atproto/server/reserve_signing_key.rs index 91ba253..3c03642 100644 --- a/crates/polymodel-api/src/com_atproto/server/reserve_signing_key.rs +++ b/crates/polymodel-api/src/com_atproto/server/reserve_signing_key.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ReserveSigningKey { ///The DID to reserve a key for. #[serde(skip_serializing_if = "Option::is_none")] @@ -30,11 +27,9 @@ pub struct ReserveSigningKey { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ReserveSigningKeyOutput { ///The public key for the reserved signing key, in did:key serialization. pub signing_key: S, @@ -55,8 +50,9 @@ impl jacquard_common::xrpc::XrpcResp for ReserveSigningKeyResponse { impl jacquard_common::xrpc::XrpcRequest for ReserveSigningKey { const NSID: &'static str = "com.atproto.server.reserveSigningKey"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = ReserveSigningKeyResponse; } @@ -66,8 +62,9 @@ Path: `/xrpc/com.atproto.server.reserveSigningKey`. The request payload type is pub struct ReserveSigningKeyRequest; impl jacquard_common::xrpc::XrpcEndpoint for ReserveSigningKeyRequest { const PATH: &'static str = "/xrpc/com.atproto.server.reserveSigningKey"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = ReserveSigningKey; type Response = ReserveSigningKeyResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/reset_password.rs b/crates/polymodel-api/src/com_atproto/server/reset_password.rs index 2f7a240..7a664e8 100644 --- a/crates/polymodel-api/src/com_atproto/server/reset_password.rs +++ b/crates/polymodel-api/src/com_atproto/server/reset_password.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResetPassword { pub password: S, pub token: S, @@ -28,9 +25,18 @@ pub struct ResetPassword { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ResetPasswordError { #[serde(rename = "ExpiredToken")] @@ -39,10 +45,7 @@ pub enum ResetPasswordError { InvalidToken(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ResetPasswordError { @@ -86,8 +89,9 @@ impl jacquard_common::xrpc::XrpcResp for ResetPasswordResponse { impl jacquard_common::xrpc::XrpcRequest for ResetPassword { const NSID: &'static str = "com.atproto.server.resetPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = ResetPasswordResponse; } @@ -97,8 +101,9 @@ Path: `/xrpc/com.atproto.server.resetPassword`. The request payload type is `Res pub struct ResetPasswordRequest; impl jacquard_common::xrpc::XrpcEndpoint for ResetPasswordRequest { const PATH: &'static str = "/xrpc/com.atproto.server.resetPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = ResetPassword; type Response = ResetPasswordResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/revoke_app_password.rs b/crates/polymodel-api/src/com_atproto/server/revoke_app_password.rs index 2dd460d..9f8b181 100644 --- a/crates/polymodel-api/src/com_atproto/server/revoke_app_password.rs +++ b/crates/polymodel-api/src/com_atproto/server/revoke_app_password.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RevokeAppPassword { pub name: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -40,8 +37,9 @@ impl jacquard_common::xrpc::XrpcResp for RevokeAppPasswordResponse { impl jacquard_common::xrpc::XrpcRequest for RevokeAppPassword { const NSID: &'static str = "com.atproto.server.revokeAppPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RevokeAppPasswordResponse; } @@ -51,8 +49,9 @@ Path: `/xrpc/com.atproto.server.revokeAppPassword`. The request payload type is pub struct RevokeAppPasswordRequest; impl jacquard_common::xrpc::XrpcEndpoint for RevokeAppPasswordRequest { const PATH: &'static str = "/xrpc/com.atproto.server.revokeAppPassword"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RevokeAppPassword; type Response = RevokeAppPasswordResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/server/update_email.rs b/crates/polymodel-api/src/com_atproto/server/update_email.rs index 07c6b80..94dce71 100644 --- a/crates/polymodel-api/src/com_atproto/server/update_email.rs +++ b/crates/polymodel-api/src/com_atproto/server/update_email.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct UpdateEmail { pub email: S, #[serde(skip_serializing_if = "Option::is_none")] @@ -32,9 +29,18 @@ pub struct UpdateEmail { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum UpdateEmailError { #[serde(rename = "ExpiredToken")] @@ -45,10 +51,7 @@ pub enum UpdateEmailError { TokenRequired(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for UpdateEmailError { @@ -99,8 +102,9 @@ impl jacquard_common::xrpc::XrpcResp for UpdateEmailResponse { impl jacquard_common::xrpc::XrpcRequest for UpdateEmail { const NSID: &'static str = "com.atproto.server.updateEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = UpdateEmailResponse; } @@ -110,8 +114,9 @@ Path: `/xrpc/com.atproto.server.updateEmail`. The request payload type is `Updat pub struct UpdateEmailRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateEmailRequest { const PATH: &'static str = "/xrpc/com.atproto.server.updateEmail"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = UpdateEmail; type Response = UpdateEmailResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync.rs b/crates/polymodel-api/src/com_atproto/sync.rs index de25e03..a4721c5 100644 --- a/crates/polymodel-api/src/com_atproto/sync.rs +++ b/crates/polymodel-api/src/com_atproto/sync.rs @@ -22,10 +22,11 @@ pub mod list_repos_by_collection; pub mod notify_of_update; pub mod request_crawl; + #[cfg(feature = "streaming")] pub mod subscribe_repos; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum HostStatus { @@ -82,7 +83,8 @@ impl serde::Serialize for HostStatus { } } -impl<'de, S: serde::Deserialize<'de> + BosStr> serde::Deserialize<'de> for HostStatus { +impl<'de, S: serde::Deserialize<'de> + BosStr> serde::Deserialize<'de> +for HostStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -108,4 +110,4 @@ where HostStatus::Other(v) => HostStatus::Other(v.into_static()), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_blob.rs b/crates/polymodel-api/src/com_atproto/sync/get_blob.rs index d7151ed..92a7f8f 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_blob.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_blob.rs @@ -10,33 +10,40 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did}; +use jacquard_common::types::string::{Did, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetBlob { pub cid: Cid, pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetBlobOutput { pub body: Bytes, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetBlobError { #[serde(rename = "BlobNotFound")] @@ -51,10 +58,7 @@ pub enum GetBlobError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetBlobError { @@ -155,7 +159,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetBlobRequest { pub mod get_blob_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -291,4 +295,4 @@ where did: self._fields.1.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_blocks.rs b/crates/polymodel-api/src/com_atproto/sync/get_blocks.rs index a1bb818..7a6d715 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_blocks.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_blocks.rs @@ -10,33 +10,40 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did}; +use jacquard_common::types::string::{Did, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetBlocks { pub cids: Vec>, pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetBlocksOutput { pub body: Bytes, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetBlocksError { #[serde(rename = "BlockNotFound")] @@ -51,10 +58,7 @@ pub enum GetBlocksError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetBlocksError { @@ -155,7 +159,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetBlocksRequest { pub mod get_blocks_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -291,4 +295,4 @@ where did: self._fields.1.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_checkout.rs b/crates/polymodel-api/src/com_atproto/sync/get_checkout.rs index 6cf969f..ee96f71 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_checkout.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_checkout.rs @@ -10,23 +10,21 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetCheckout { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetCheckoutOutput { @@ -82,7 +80,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetCheckoutRequest { pub mod get_checkout_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -185,4 +183,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_head.rs b/crates/polymodel-api/src/com_atproto/sync/get_head.rs index 62fcdc6..2f00bd3 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_head.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_head.rs @@ -10,46 +10,47 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did}; +use jacquard_common::types::string::{Did, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetHead { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetHeadOutput { pub root: Cid, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetHeadError { #[serde(rename = "HeadNotFound")] HeadNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetHeadError { @@ -103,7 +104,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetHeadRequest { pub mod get_head_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -206,4 +207,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_host_status.rs b/crates/polymodel-api/src/com_atproto/sync/get_host_status.rs index 9a86f3b..75d0c91 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_host_status.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_host_status.rs @@ -8,29 +8,24 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::sync::HostStatus; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::sync::HostStatus; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetHostStatus { pub hostname: S, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetHostStatusOutput { ///Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. #[serde(skip_serializing_if = "Option::is_none")] @@ -45,19 +40,25 @@ pub struct GetHostStatusOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetHostStatusError { #[serde(rename = "HostNotFound")] HostNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetHostStatusError { @@ -111,7 +112,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetHostStatusRequest { pub mod get_host_status_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -142,7 +143,10 @@ pub mod get_host_status_state { } /// Builder for constructing an instance of this type. -pub struct GetHostStatusBuilder { +pub struct GetHostStatusBuilder< + St: get_host_status_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option,), _type: PhantomData S>, @@ -214,4 +218,4 @@ where hostname: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_latest_commit.rs b/crates/polymodel-api/src/com_atproto/sync/get_latest_commit.rs index d94290b..38fe03e 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_latest_commit.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_latest_commit.rs @@ -10,27 +10,22 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did, Tid}; +use jacquard_common::types::string::{Did, Tid, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetLatestCommit { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetLatestCommitOutput { pub cid: Cid, pub rev: Tid, @@ -38,9 +33,18 @@ pub struct GetLatestCommitOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetLatestCommitError { #[serde(rename = "RepoNotFound")] @@ -53,10 +57,7 @@ pub enum GetLatestCommitError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetLatestCommitError { @@ -131,7 +132,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetLatestCommitRequest { pub mod get_latest_commit_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -162,7 +163,10 @@ pub mod get_latest_commit_state { } /// Builder for constructing an instance of this type. -pub struct GetLatestCommitBuilder { +pub struct GetLatestCommitBuilder< + St: get_latest_commit_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -234,4 +238,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_record.rs b/crates/polymodel-api/src/com_atproto/sync/get_record.rs index 917fe53..881a11e 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_record.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_record.rs @@ -10,34 +10,41 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Nsid, RecordKey, Rkey}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRecord { pub collection: Nsid, pub did: Did, pub rkey: RecordKey>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetRecordOutput { pub body: Bytes, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetRecordError { #[serde(rename = "RecordNotFound")] @@ -52,10 +59,7 @@ pub enum GetRecordError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetRecordError { @@ -156,7 +160,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetRecordRequest { pub mod get_record_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -327,4 +331,4 @@ where rkey: self._fields.2.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_repo.rs b/crates/polymodel-api/src/com_atproto/sync/get_repo.rs index cdb9b09..42e2432 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_repo.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_repo.rs @@ -10,34 +10,41 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Tid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRepo { pub did: Did, #[serde(skip_serializing_if = "Option::is_none")] pub since: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct GetRepoOutput { pub body: Bytes, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetRepoError { #[serde(rename = "RepoNotFound")] @@ -50,10 +57,7 @@ pub enum GetRepoError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetRepoError { @@ -147,7 +151,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetRepoRequest { pub mod get_repo_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -264,4 +268,4 @@ where since: self._fields.1, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/get_repo_status.rs b/crates/polymodel-api/src/com_atproto/sync/get_repo_status.rs index 4bb9541..9cb22b0 100644 --- a/crates/polymodel-api/src/com_atproto/sync/get_repo_status.rs +++ b/crates/polymodel-api/src/com_atproto/sync/get_repo_status.rs @@ -10,27 +10,22 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::{Did, Tid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRepoStatus { pub did: Did, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetRepoStatusOutput { pub active: bool, pub did: Did, @@ -104,7 +99,8 @@ impl Serialize for GetRepoStatusOutputStatus { } } -impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for GetRepoStatusOutputStatus { +impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> +for GetRepoStatusOutputStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -131,8 +127,12 @@ where GetRepoStatusOutputStatus::Takendown => GetRepoStatusOutputStatus::Takendown, GetRepoStatusOutputStatus::Suspended => GetRepoStatusOutputStatus::Suspended, GetRepoStatusOutputStatus::Deleted => GetRepoStatusOutputStatus::Deleted, - GetRepoStatusOutputStatus::Deactivated => GetRepoStatusOutputStatus::Deactivated, - GetRepoStatusOutputStatus::Desynchronized => GetRepoStatusOutputStatus::Desynchronized, + GetRepoStatusOutputStatus::Deactivated => { + GetRepoStatusOutputStatus::Deactivated + } + GetRepoStatusOutputStatus::Desynchronized => { + GetRepoStatusOutputStatus::Desynchronized + } GetRepoStatusOutputStatus::Throttled => GetRepoStatusOutputStatus::Throttled, GetRepoStatusOutputStatus::Other(v) => { GetRepoStatusOutputStatus::Other(v.into_static()) @@ -141,19 +141,25 @@ where } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum GetRepoStatusError { #[serde(rename = "RepoNotFound")] RepoNotFound(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for GetRepoStatusError { @@ -207,7 +213,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetRepoStatusRequest { pub mod get_repo_status_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -238,7 +244,10 @@ pub mod get_repo_status_state { } /// Builder for constructing an instance of this type. -pub struct GetRepoStatusBuilder { +pub struct GetRepoStatusBuilder< + St: get_repo_status_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>,), _type: PhantomData S>, @@ -310,4 +319,4 @@ where did: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/list_blobs.rs b/crates/polymodel-api/src/com_atproto/sync/list_blobs.rs index c05fa7e..82f34d3 100644 --- a/crates/polymodel-api/src/com_atproto/sync/list_blobs.rs +++ b/crates/polymodel-api/src/com_atproto/sync/list_blobs.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did, Tid}; +use jacquard_common::types::string::{Did, Tid, Cid}; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListBlobs { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -34,11 +31,9 @@ pub struct ListBlobs { pub since: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListBlobsOutput { pub cids: Vec>, #[serde(skip_serializing_if = "Option::is_none")] @@ -47,9 +42,18 @@ pub struct ListBlobsOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum ListBlobsError { #[serde(rename = "RepoNotFound")] @@ -62,10 +66,7 @@ pub enum ListBlobsError { RepoDeactivated(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for ListBlobsError { @@ -144,7 +145,7 @@ fn _default_limit() -> Option { pub mod list_blobs_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -289,4 +290,4 @@ where since: self._fields.3, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/list_hosts.rs b/crates/polymodel-api/src/com_atproto/sync/list_hosts.rs index c989c10..c63e71e 100644 --- a/crates/polymodel-api/src/com_atproto/sync/list_hosts.rs +++ b/crates/polymodel-api/src/com_atproto/sync/list_hosts.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -20,17 +20,14 @@ use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::sync::HostStatus; -use crate::com_atproto::sync::list_hosts; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::sync::HostStatus; +use crate::com_atproto::sync::list_hosts; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Host { #[serde(skip_serializing_if = "Option::is_none")] pub account_count: Option, @@ -45,11 +42,9 @@ pub struct Host { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListHosts { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -59,11 +54,9 @@ pub struct ListHosts { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListHostsOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -117,10 +110,10 @@ impl jacquard_common::xrpc::XrpcEndpoint for ListHostsRequest { } fn lexicon_doc_com_atproto_sync_listHosts() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.sync.listHosts"), @@ -142,9 +135,11 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("hostname"), LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "hostname of server; not a URL (no scheme)", - )), + description: Some( + CowStr::new_static( + "hostname of server; not a URL (no scheme)", + ), + ), ..Default::default() }), ); @@ -157,7 +152,9 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("status"), LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static("com.atproto.sync.defs#hostStatus"), + r#ref: CowStr::new_static( + "com.atproto.sync.defs#hostStatus", + ), ..Default::default() }), ); @@ -169,26 +166,28 @@ fn lexicon_doc_com_atproto_sync_listHosts() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { - parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("limit"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcQueryParameter::Params(LexXrpcParameters { + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::String(LexString { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("limit"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); @@ -204,7 +203,7 @@ fn _default_limit() -> Option { pub mod list_hosts_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -301,4 +300,4 @@ where limit: self._fields.1, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/list_repos.rs b/crates/polymodel-api/src/com_atproto/sync/list_repos.rs index 7d447c7..eb3400a 100644 --- a/crates/polymodel-api/src/com_atproto/sync/list_repos.rs +++ b/crates/polymodel-api/src/com_atproto/sync/list_repos.rs @@ -10,27 +10,24 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Cid, Did, Tid}; +use jacquard_common::types::string::{Did, Tid, Cid}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::sync::list_repos; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::sync::list_repos; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListRepos { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -40,11 +37,9 @@ pub struct ListRepos { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListReposOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -53,11 +48,9 @@ pub struct ListReposOutput { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Repo { #[serde(skip_serializing_if = "Option::is_none")] pub active: Option, @@ -216,7 +209,7 @@ fn _default_limit() -> Option { pub mod list_repos_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -317,7 +310,7 @@ where pub mod repo_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -441,7 +434,10 @@ where St::Did: repo_state::IsUnset, { /// Set the `did` field (required) - pub fn did(mut self, value: impl Into>) -> RepoBuilder, S> { + pub fn did( + mut self, + value: impl Into>, + ) -> RepoBuilder, S> { self._fields.1 = Option::Some(value.into()); RepoBuilder { _state: PhantomData, @@ -457,7 +453,10 @@ where St::Head: repo_state::IsUnset, { /// Set the `head` field (required) - pub fn head(mut self, value: impl Into>) -> RepoBuilder, S> { + pub fn head( + mut self, + value: impl Into>, + ) -> RepoBuilder, S> { self._fields.2 = Option::Some(value.into()); RepoBuilder { _state: PhantomData, @@ -473,7 +472,10 @@ where St::Rev: repo_state::IsUnset, { /// Set the `rev` field (required) - pub fn rev(mut self, value: impl Into) -> RepoBuilder, S> { + pub fn rev( + mut self, + value: impl Into, + ) -> RepoBuilder, S> { self._fields.3 = Option::Some(value.into()); RepoBuilder { _state: PhantomData, @@ -528,10 +530,10 @@ where } fn lexicon_doc_com_atproto_sync_listRepos() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.sync.listRepos"), @@ -540,26 +542,28 @@ fn lexicon_doc_com_atproto_sync_listRepos() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { - parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("limit"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcQueryParameter::Params(LexXrpcParameters { + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::String(LexString { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("limit"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); @@ -625,4 +629,4 @@ fn lexicon_doc_com_atproto_sync_listRepos() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/list_repos_by_collection.rs b/crates/polymodel-api/src/com_atproto/sync/list_repos_by_collection.rs index 26ad69f..e46303e 100644 --- a/crates/polymodel-api/src/com_atproto/sync/list_repos_by_collection.rs +++ b/crates/polymodel-api/src/com_atproto/sync/list_repos_by_collection.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -21,16 +21,13 @@ use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::sync::list_repos_by_collection; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::sync::list_repos_by_collection; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListReposByCollection { pub collection: Nsid, #[serde(skip_serializing_if = "Option::is_none")] @@ -41,11 +38,9 @@ pub struct ListReposByCollection { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ListReposByCollectionOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -54,11 +49,9 @@ pub struct ListReposByCollectionOutput { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Repo { pub did: Did, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -114,7 +107,7 @@ fn _default_limit() -> Option { pub mod list_repos_by_collection_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -156,15 +149,20 @@ pub struct ListReposByCollectionBuilder< impl ListReposByCollection { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ListReposByCollectionBuilder - { + pub fn new() -> ListReposByCollectionBuilder< + list_repos_by_collection_state::Empty, + DefaultStr, + > { ListReposByCollectionBuilder::new() } } impl ListReposByCollection { /// Create a new builder for this type - pub fn builder() -> ListReposByCollectionBuilder { + pub fn builder() -> ListReposByCollectionBuilder< + list_repos_by_collection_state::Empty, + S, + > { ListReposByCollectionBuilder::builder() } } @@ -200,7 +198,10 @@ where pub fn collection( mut self, value: impl Into>, - ) -> ListReposByCollectionBuilder, S> { + ) -> ListReposByCollectionBuilder< + list_repos_by_collection_state::SetCollection, + S, + > { self._fields.0 = Option::Some(value.into()); ListReposByCollectionBuilder { _state: PhantomData, @@ -210,7 +211,10 @@ where } } -impl ListReposByCollectionBuilder { +impl< + St: list_repos_by_collection_state::State, + S: BosStr, +> ListReposByCollectionBuilder { /// Set the `cursor` field (optional) pub fn cursor(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); @@ -223,7 +227,10 @@ impl ListReposByCollection } } -impl ListReposByCollectionBuilder { +impl< + St: list_repos_by_collection_state::State, + S: BosStr, +> ListReposByCollectionBuilder { /// Set the `limit` field (optional) pub fn limit(mut self, value: impl Into>) -> Self { self._fields.2 = value.into(); @@ -253,7 +260,7 @@ where pub mod repo_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -332,7 +339,10 @@ where St::Did: repo_state::IsUnset, { /// Set the `did` field (required) - pub fn did(mut self, value: impl Into>) -> RepoBuilder, S> { + pub fn did( + mut self, + value: impl Into>, + ) -> RepoBuilder, S> { self._fields.0 = Option::Some(value.into()); RepoBuilder { _state: PhantomData, @@ -364,10 +374,10 @@ where } fn lexicon_doc_com_atproto_sync_listReposByCollection() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.sync.listReposByCollection"), @@ -376,34 +386,36 @@ fn lexicon_doc_com_atproto_sync_listReposByCollection() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { - parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters { - required: Some(vec![SmolStr::new_static("collection")]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("collection"), - LexXrpcParametersProperty::String(LexString { - format: Some(LexStringFormat::Nsid), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("limit"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcQueryParameter::Params(LexXrpcParameters { + required: Some(vec![SmolStr::new_static("collection")]), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("collection"), + LexXrpcParametersProperty::String(LexString { + format: Some(LexStringFormat::Nsid), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::String(LexString { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("limit"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); @@ -430,4 +442,4 @@ fn lexicon_doc_com_atproto_sync_listReposByCollection() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/notify_of_update.rs b/crates/polymodel-api/src/com_atproto/sync/notify_of_update.rs index d16a37f..6515b70 100644 --- a/crates/polymodel-api/src/com_atproto/sync/notify_of_update.rs +++ b/crates/polymodel-api/src/com_atproto/sync/notify_of_update.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct NotifyOfUpdate { ///Hostname of the current service (usually a PDS) that is notifying of update. pub hostname: S, @@ -41,8 +38,9 @@ impl jacquard_common::xrpc::XrpcResp for NotifyOfUpdateResponse { impl jacquard_common::xrpc::XrpcRequest for NotifyOfUpdate { const NSID: &'static str = "com.atproto.sync.notifyOfUpdate"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = NotifyOfUpdateResponse; } @@ -52,8 +50,9 @@ Path: `/xrpc/com.atproto.sync.notifyOfUpdate`. The request payload type is `Noti pub struct NotifyOfUpdateRequest; impl jacquard_common::xrpc::XrpcEndpoint for NotifyOfUpdateRequest { const PATH: &'static str = "/xrpc/com.atproto.sync.notifyOfUpdate"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = NotifyOfUpdate; type Response = NotifyOfUpdateResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/request_crawl.rs b/crates/polymodel-api/src/com_atproto/sync/request_crawl.rs index dd67f96..5bcfba5 100644 --- a/crates/polymodel-api/src/com_atproto/sync/request_crawl.rs +++ b/crates/polymodel-api/src/com_atproto/sync/request_crawl.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RequestCrawl { ///Hostname of the current service (eg, PDS) that is requesting to be crawled. pub hostname: S, @@ -28,19 +25,25 @@ pub struct RequestCrawl { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum RequestCrawlError { #[serde(rename = "HostBanned")] HostBanned(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for RequestCrawlError { @@ -77,8 +80,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestCrawlResponse { impl jacquard_common::xrpc::XrpcRequest for RequestCrawl { const NSID: &'static str = "com.atproto.sync.requestCrawl"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestCrawlResponse; } @@ -88,8 +92,9 @@ Path: `/xrpc/com.atproto.sync.requestCrawl`. The request payload type is `Reques pub struct RequestCrawlRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestCrawlRequest { const PATH: &'static str = "/xrpc/com.atproto.sync.requestCrawl"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestCrawl; type Response = RequestCrawlResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/sync/subscribe_repos.rs b/crates/polymodel-api/src/com_atproto/sync/subscribe_repos.rs index 67806a3..ad6cdbd 100644 --- a/crates/polymodel-api/src/com_atproto/sync/subscribe_repos.rs +++ b/crates/polymodel-api/src/com_atproto/sync/subscribe_repos.rs @@ -10,30 +10,27 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::cid::CidLink; -use jacquard_common::types::string::{Datetime, Did, Handle, Tid}; +use jacquard_common::types::string::{Did, Handle, Tid, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::sync::subscribe_repos; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::sync::subscribe_repos; /// Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Account { ///Indicates that the account has a repository which can be fetched from the host that emitted this event. pub active: bool, @@ -145,10 +142,7 @@ where /// Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Commit { pub blobs: Vec>, ///CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list. @@ -182,10 +176,7 @@ pub struct Commit { /// Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Identity { pub did: Did, ///The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. @@ -197,11 +188,9 @@ pub struct Identity { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Info { #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, @@ -210,6 +199,7 @@ pub struct Info { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum InfoName { OutdatedCursor, @@ -283,6 +273,7 @@ where } } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct SubscribeRepos { @@ -290,6 +281,7 @@ pub struct SubscribeRepos { pub cursor: Option, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -314,38 +306,61 @@ impl SubscribeReposMessage { where S: serde::Deserialize<'de>, { - let (header, body) = jacquard_common::xrpc::subscription::parse_event_header(bytes)?; + let (header, body) = jacquard_common::xrpc::subscription::parse_event_header( + bytes, + )?; match header.t.as_str() { "#commit" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Commit(Box::new(variant))) } "#sync" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Sync(Box::new(variant))) } "#identity" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Identity(Box::new(variant))) } "#account" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Account(Box::new(variant))) } "#info" => { - let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice(body)?; + let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( + body, + )?; Ok(Self::Info(Box::new(variant))) } - unknown => Err(jacquard_common::error::DecodeError::UnknownEventType( - unknown.into(), - )), + unknown => { + Err( + jacquard_common::error::DecodeError::UnknownEventType(unknown.into()), + ) + } } } } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum SubscribeReposError { #[serde(rename = "FutureCursor")] @@ -355,10 +370,7 @@ pub enum SubscribeReposError { ConsumerTooSlow(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for SubscribeReposError { @@ -392,10 +404,7 @@ impl core::fmt::Display for SubscribeReposError { /// A repo operation, ie a mutation of a single record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RepoOp { pub action: RepoOpAction, ///For creates and updates, the new record CID. For deletions, null. @@ -409,6 +418,7 @@ pub struct RepoOp { pub extra_data: Option>>, } + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum RepoOpAction { Create, @@ -493,10 +503,7 @@ where /// Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Sync { ///CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'. #[serde(with = "jacquard_common::serde_bytes_helper")] @@ -589,8 +596,7 @@ impl LexiconSchema for Info { pub struct SubscribeReposStream; impl jacquard_common::xrpc::SubscriptionResp for SubscribeReposStream { const NSID: &'static str = "com.atproto.sync.subscribeRepos"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Message = SubscribeReposMessage; type Error = SubscribeReposError; fn decode_message<'de, S>( @@ -606,16 +612,14 @@ impl jacquard_common::xrpc::SubscriptionResp for SubscribeReposStream { impl jacquard_common::xrpc::XrpcSubscription for SubscribeRepos { const NSID: &'static str = "com.atproto.sync.subscribeRepos"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Stream = SubscribeReposStream; } pub struct SubscribeReposEndpoint; impl jacquard_common::xrpc::SubscriptionEndpoint for SubscribeReposEndpoint { const PATH: &'static str = "/xrpc/com.atproto.sync.subscribeRepos"; - const ENCODING: jacquard_common::xrpc::MessageEncoding = - jacquard_common::xrpc::MessageEncoding::DagCbor; + const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Params = SubscribeRepos; type Stream = SubscribeReposStream; } @@ -652,7 +656,7 @@ impl LexiconSchema for Sync { pub mod account_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -798,7 +802,10 @@ where St::Did: account_state::IsUnset, { /// Set the `did` field (required) - pub fn did(mut self, value: impl Into>) -> AccountBuilder, S> { + pub fn did( + mut self, + value: impl Into>, + ) -> AccountBuilder, S> { self._fields.1 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, @@ -814,7 +821,10 @@ where St::Seq: account_state::IsUnset, { /// Set the `seq` field (required) - pub fn seq(mut self, value: impl Into) -> AccountBuilder, S> { + pub fn seq( + mut self, + value: impl Into, + ) -> AccountBuilder, S> { self._fields.2 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, @@ -889,10 +899,10 @@ where } fn lexicon_doc_com_atproto_sync_subscribeRepos() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.sync.subscribeRepos"), @@ -1151,15 +1161,11 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("message"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map }, @@ -1169,42 +1175,45 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::XrpcSubscription(LexXrpcSubscription { - parameters: Some(LexXrpcSubscriptionParameter::Params(LexXrpcParameters { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("cursor"), - LexXrpcParametersProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - })), + parameters: Some( + LexXrpcSubscriptionParameter::Params(LexXrpcParameters { + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("cursor"), + LexXrpcParametersProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ), ..Default::default() }), ); map.insert( SmolStr::new_static("repoOp"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "A repo operation, ie a mutation of a single record.", - )), - required: Some(vec![ - SmolStr::new_static("action"), - SmolStr::new_static("path"), - SmolStr::new_static("cid"), - ]), + description: Some( + CowStr::new_static( + "A repo operation, ie a mutation of a single record.", + ), + ), + required: Some( + vec![ + SmolStr::new_static("action"), SmolStr::new_static("path"), + SmolStr::new_static("cid") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("action"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("cid"), @@ -1214,9 +1223,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("path"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("prev"), @@ -1308,7 +1315,7 @@ fn lexicon_doc_com_atproto_sync_subscribeRepos() -> LexiconDoc<'static> { pub mod commit_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1558,7 +1565,18 @@ impl CommitBuilder { CommitBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -1571,7 +1589,18 @@ impl CommitBuilder { CommitBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -1692,7 +1721,10 @@ where St::Repo: commit_state::IsUnset, { /// Set the `repo` field (required) - pub fn repo(mut self, value: impl Into>) -> CommitBuilder, S> { + pub fn repo( + mut self, + value: impl Into>, + ) -> CommitBuilder, S> { self._fields.6 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, @@ -1708,7 +1740,10 @@ where St::Rev: commit_state::IsUnset, { /// Set the `rev` field (required) - pub fn rev(mut self, value: impl Into) -> CommitBuilder, S> { + pub fn rev( + mut self, + value: impl Into, + ) -> CommitBuilder, S> { self._fields.7 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, @@ -1724,7 +1759,10 @@ where St::Seq: commit_state::IsUnset, { /// Set the `seq` field (required) - pub fn seq(mut self, value: impl Into) -> CommitBuilder, S> { + pub fn seq( + mut self, + value: impl Into, + ) -> CommitBuilder, S> { self._fields.8 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, @@ -1839,7 +1877,7 @@ where pub mod identity_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1898,12 +1936,7 @@ pub mod identity_state { /// Builder for constructing an instance of this type. pub struct IdentityBuilder { _state: PhantomData St>, - _fields: ( - Option>, - Option>, - Option, - Option, - ), + _fields: (Option>, Option>, Option, Option), _type: PhantomData S>, } @@ -1981,7 +2014,10 @@ where St::Seq: identity_state::IsUnset, { /// Set the `seq` field (required) - pub fn seq(mut self, value: impl Into) -> IdentityBuilder, S> { + pub fn seq( + mut self, + value: impl Into, + ) -> IdentityBuilder, S> { self._fields.2 = Option::Some(value.into()); IdentityBuilder { _state: PhantomData, @@ -2041,7 +2077,7 @@ where pub mod subscribe_repos_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2118,7 +2154,7 @@ where pub mod repo_op_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2246,7 +2282,10 @@ where St::Path: repo_op_state::IsUnset, { /// Set the `path` field (required) - pub fn path(mut self, value: impl Into) -> RepoOpBuilder, S> { + pub fn path( + mut self, + value: impl Into, + ) -> RepoOpBuilder, S> { self._fields.2 = Option::Some(value.into()); RepoOpBuilder { _state: PhantomData, @@ -2299,7 +2338,7 @@ where pub mod sync_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2392,13 +2431,7 @@ pub mod sync_state { /// Builder for constructing an instance of this type. pub struct SyncBuilder { _state: PhantomData St>, - _fields: ( - Option, - Option>, - Option, - Option, - Option, - ), + _fields: (Option, Option>, Option, Option, Option), _type: PhantomData S>, } @@ -2444,7 +2477,10 @@ where St::Blocks: sync_state::IsUnset, { /// Set the `blocks` field (required) - pub fn blocks(mut self, value: impl Into) -> SyncBuilder, S> { + pub fn blocks( + mut self, + value: impl Into, + ) -> SyncBuilder, S> { self._fields.0 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, @@ -2460,7 +2496,10 @@ where St::Did: sync_state::IsUnset, { /// Set the `did` field (required) - pub fn did(mut self, value: impl Into>) -> SyncBuilder, S> { + pub fn did( + mut self, + value: impl Into>, + ) -> SyncBuilder, S> { self._fields.1 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, @@ -2492,7 +2531,10 @@ where St::Seq: sync_state::IsUnset, { /// Set the `seq` field (required) - pub fn seq(mut self, value: impl Into) -> SyncBuilder, S> { + pub fn seq( + mut self, + value: impl Into, + ) -> SyncBuilder, S> { self._fields.3 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, @@ -2508,7 +2550,10 @@ where St::Time: sync_state::IsUnset, { /// Set the `time` field (required) - pub fn time(mut self, value: impl Into) -> SyncBuilder, S> { + pub fn time( + mut self, + value: impl Into, + ) -> SyncBuilder, S> { self._fields.4 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, @@ -2549,4 +2594,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp.rs b/crates/polymodel-api/src/com_atproto/temp.rs index fe54700..1d64a1a 100644 --- a/crates/polymodel-api/src/com_atproto/temp.rs +++ b/crates/polymodel-api/src/com_atproto/temp.rs @@ -10,4 +10,4 @@ pub mod check_signup_queue; pub mod dereference_scope; pub mod fetch_labels; pub mod request_phone_verification; -pub mod revoke_account_credentials; +pub mod revoke_account_credentials; \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/add_reserved_handle.rs b/crates/polymodel-api/src/com_atproto/temp/add_reserved_handle.rs index 7e9e4a5..cb9433d 100644 --- a/crates/polymodel-api/src/com_atproto/temp/add_reserved_handle.rs +++ b/crates/polymodel-api/src/com_atproto/temp/add_reserved_handle.rs @@ -10,28 +10,23 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AddReservedHandle { pub handle: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AddReservedHandleOutput { #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, @@ -50,8 +45,9 @@ impl jacquard_common::xrpc::XrpcResp for AddReservedHandleResponse { impl jacquard_common::xrpc::XrpcRequest for AddReservedHandle { const NSID: &'static str = "com.atproto.temp.addReservedHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = AddReservedHandleResponse; } @@ -61,8 +57,9 @@ Path: `/xrpc/com.atproto.temp.addReservedHandle`. The request payload type is `A pub struct AddReservedHandleRequest; impl jacquard_common::xrpc::XrpcEndpoint for AddReservedHandleRequest { const PATH: &'static str = "/xrpc/com.atproto.temp.addReservedHandle"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = AddReservedHandle; type Response = AddReservedHandleResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/check_handle_availability.rs b/crates/polymodel-api/src/com_atproto/temp/check_handle_availability.rs index 980f6c4..b9d20f9 100644 --- a/crates/polymodel-api/src/com_atproto/temp/check_handle_availability.rs +++ b/crates/polymodel-api/src/com_atproto/temp/check_handle_availability.rs @@ -10,27 +10,24 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Datetime, Handle}; +use jacquard_common::types::string::{Handle, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::temp::check_handle_availability; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::temp::check_handle_availability; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CheckHandleAvailability { #[serde(skip_serializing_if = "Option::is_none")] pub birth_date: Option, @@ -39,11 +36,9 @@ pub struct CheckHandleAvailability { pub handle: Handle, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CheckHandleAvailabilityOutput { ///Echo of the input handle. pub handle: Handle, @@ -52,6 +47,7 @@ pub struct CheckHandleAvailabilityOutput { pub extra_data: Option>>, } + #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] @@ -62,9 +58,18 @@ pub enum CheckHandleAvailabilityOutputResult { ResultUnavailable(Box>), } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum CheckHandleAvailabilityError { /// An invalid email was provided. @@ -72,10 +77,7 @@ pub enum CheckHandleAvailabilityError { InvalidEmail(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for CheckHandleAvailabilityError { @@ -102,10 +104,7 @@ impl core::fmt::Display for CheckHandleAvailabilityError { /// Indicates the provided handle is available. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResultAvailable { #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, @@ -114,10 +113,7 @@ pub struct ResultAvailable { /// Indicates the provided handle is unavailable and gives suggestions of available handles. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ResultUnavailable { ///List of suggested handles based on the provided inputs. pub suggestions: Vec>, @@ -125,11 +121,9 @@ pub struct ResultUnavailable { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Suggestion { pub handle: Handle, ///Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics. @@ -213,7 +207,7 @@ impl LexiconSchema for Suggestion { pub mod check_handle_availability_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -255,15 +249,20 @@ pub struct CheckHandleAvailabilityBuilder< impl CheckHandleAvailability { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() - -> CheckHandleAvailabilityBuilder { + pub fn new() -> CheckHandleAvailabilityBuilder< + check_handle_availability_state::Empty, + DefaultStr, + > { CheckHandleAvailabilityBuilder::new() } } impl CheckHandleAvailability { /// Create a new builder for this type - pub fn builder() -> CheckHandleAvailabilityBuilder { + pub fn builder() -> CheckHandleAvailabilityBuilder< + check_handle_availability_state::Empty, + S, + > { CheckHandleAvailabilityBuilder::builder() } } @@ -279,7 +278,9 @@ impl CheckHandleAvailabilityBuilder CheckHandleAvailabilityBuilder { +impl< + S: BosStr, +> CheckHandleAvailabilityBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { CheckHandleAvailabilityBuilder { @@ -290,7 +291,10 @@ impl CheckHandleAvailabilityBuilder CheckHandleAvailabilityBuilder { +impl< + St: check_handle_availability_state::State, + S: BosStr, +> CheckHandleAvailabilityBuilder { /// Set the `birthDate` field (optional) pub fn birth_date(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); @@ -303,7 +307,10 @@ impl CheckHandleAvailabil } } -impl CheckHandleAvailabilityBuilder { +impl< + St: check_handle_availability_state::State, + S: BosStr, +> CheckHandleAvailabilityBuilder { /// Set the `email` field (optional) pub fn email(mut self, value: impl Into>) -> Self { self._fields.1 = value.into(); @@ -325,7 +332,10 @@ where pub fn handle( mut self, value: impl Into>, - ) -> CheckHandleAvailabilityBuilder, S> { + ) -> CheckHandleAvailabilityBuilder< + check_handle_availability_state::SetHandle, + S, + > { self._fields.2 = Option::Some(value.into()); CheckHandleAvailabilityBuilder { _state: PhantomData, @@ -351,10 +361,10 @@ where } fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("com.atproto.temp.checkHandleAvailability"), @@ -415,9 +425,9 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> LexiconDoc<'static> map.insert( SmolStr::new_static("resultAvailable"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Indicates the provided handle is available.", - )), + description: Some( + CowStr::new_static("Indicates the provided handle is available."), + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -500,7 +510,7 @@ fn lexicon_doc_com_atproto_temp_checkHandleAvailability() -> LexiconDoc<'static> pub mod result_unavailable_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -531,7 +541,10 @@ pub mod result_unavailable_state { } /// Builder for constructing an instance of this type. -pub struct ResultUnavailableBuilder { +pub struct ResultUnavailableBuilder< + St: result_unavailable_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>>,), _type: PhantomData S>, @@ -539,7 +552,10 @@ pub struct ResultUnavailableBuilder { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> ResultUnavailableBuilder { + pub fn new() -> ResultUnavailableBuilder< + result_unavailable_state::Empty, + DefaultStr, + > { ResultUnavailableBuilder::new() } } @@ -605,7 +621,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ResultUnavailable { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ResultUnavailable { ResultUnavailable { suggestions: self._fields.0.unwrap(), extra_data: Some(extra_data), @@ -615,7 +634,7 @@ where pub mod suggestion_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -753,11 +772,14 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> Suggestion { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> Suggestion { Suggestion { handle: self._fields.0.unwrap(), method: self._fields.1.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/check_signup_queue.rs b/crates/polymodel-api/src/com_atproto/temp/check_signup_queue.rs index 7c474c8..4dd614d 100644 --- a/crates/polymodel-api/src/com_atproto/temp/check_signup_queue.rs +++ b/crates/polymodel-api/src/com_atproto/temp/check_signup_queue.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct CheckSignupQueueOutput { pub activated: bool, #[serde(skip_serializing_if = "Option::is_none")] @@ -63,4 +60,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for CheckSignupQueueRequest { const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = CheckSignupQueue; type Response = CheckSignupQueueResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/dereference_scope.rs b/crates/polymodel-api/src/com_atproto/temp/dereference_scope.rs index 76dba6a..d3d31d5 100644 --- a/crates/polymodel-api/src/com_atproto/temp/dereference_scope.rs +++ b/crates/polymodel-api/src/com_atproto/temp/dereference_scope.rs @@ -10,26 +10,21 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::{IntoStatic, open_union}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DereferenceScope { pub scope: S, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct DereferenceScopeOutput { ///The full oauth permission scope pub scope: S, @@ -37,9 +32,18 @@ pub struct DereferenceScopeOutput { pub extra_data: Option>>, } + #[derive( - Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, + Serialize, + Deserialize, + Debug, + Clone, + PartialEq, + Eq, + thiserror::Error, + miette::Diagnostic )] + #[serde(tag = "error", content = "message")] pub enum DereferenceScopeError { /// An invalid scope reference was provided. @@ -47,10 +51,7 @@ pub enum DereferenceScopeError { InvalidScopeReference(Option), /// Catch-all for unknown error codes. #[serde(untagged)] - Other { - error: SmolStr, - message: Option, - }, + Other { error: SmolStr, message: Option }, } impl core::fmt::Display for DereferenceScopeError { @@ -104,7 +105,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for DereferenceScopeRequest { pub mod dereference_scope_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -135,7 +136,10 @@ pub mod dereference_scope_state { } /// Builder for constructing an instance of this type. -pub struct DereferenceScopeBuilder { +pub struct DereferenceScopeBuilder< + St: dereference_scope_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option,), _type: PhantomData S>, @@ -207,4 +211,4 @@ where scope: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/fetch_labels.rs b/crates/polymodel-api/src/com_atproto/temp/fetch_labels.rs index c7a9c17..b2c1079 100644 --- a/crates/polymodel-api/src/com_atproto/temp/fetch_labels.rs +++ b/crates/polymodel-api/src/com_atproto/temp/fetch_labels.rs @@ -8,14 +8,14 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::com_atproto::label::Label; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::label::Label; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] @@ -28,11 +28,9 @@ pub struct FetchLabels { pub since: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct FetchLabelsOutput { pub labels: Vec>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -73,7 +71,7 @@ fn _default_limit() -> Option { pub mod fetch_labels_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -160,4 +158,4 @@ where since: self._fields.1, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/request_phone_verification.rs b/crates/polymodel-api/src/com_atproto/temp/request_phone_verification.rs index 8d1f8ec..d8d42ce 100644 --- a/crates/polymodel-api/src/com_atproto/temp/request_phone_verification.rs +++ b/crates/polymodel-api/src/com_atproto/temp/request_phone_verification.rs @@ -10,17 +10,14 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RequestPhoneVerification { pub phone_number: S, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -40,8 +37,9 @@ impl jacquard_common::xrpc::XrpcResp for RequestPhoneVerificationResponse { impl jacquard_common::xrpc::XrpcRequest for RequestPhoneVerification { const NSID: &'static str = "com.atproto.temp.requestPhoneVerification"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RequestPhoneVerificationResponse; } @@ -51,8 +49,9 @@ Path: `/xrpc/com.atproto.temp.requestPhoneVerification`. The request payload typ pub struct RequestPhoneVerificationRequest; impl jacquard_common::xrpc::XrpcEndpoint for RequestPhoneVerificationRequest { const PATH: &'static str = "/xrpc/com.atproto.temp.requestPhoneVerification"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RequestPhoneVerification; type Response = RequestPhoneVerificationResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/com_atproto/temp/revoke_account_credentials.rs b/crates/polymodel-api/src/com_atproto/temp/revoke_account_credentials.rs index 48e6c15..e730bb3 100644 --- a/crates/polymodel-api/src/com_atproto/temp/revoke_account_credentials.rs +++ b/crates/polymodel-api/src/com_atproto/temp/revoke_account_credentials.rs @@ -10,18 +10,15 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RevokeAccountCredentials { pub account: AtIdentifier, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] @@ -41,8 +38,9 @@ impl jacquard_common::xrpc::XrpcResp for RevokeAccountCredentialsResponse { impl jacquard_common::xrpc::XrpcRequest for RevokeAccountCredentials { const NSID: &'static str = "com.atproto.temp.revokeAccountCredentials"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Response = RevokeAccountCredentialsResponse; } @@ -52,15 +50,16 @@ Path: `/xrpc/com.atproto.temp.revokeAccountCredentials`. The request payload typ pub struct RevokeAccountCredentialsRequest; impl jacquard_common::xrpc::XrpcEndpoint for RevokeAccountCredentialsRequest { const PATH: &'static str = "/xrpc/com.atproto.temp.revokeAccountCredentials"; - const METHOD: jacquard_common::xrpc::XrpcMethod = - jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); + const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( + "application/json", + ); type Request = RevokeAccountCredentials; type Response = RevokeAccountCredentialsResponse; } pub mod revoke_account_credentials_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -102,21 +101,28 @@ pub struct RevokeAccountCredentialsBuilder< impl RevokeAccountCredentials { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() - -> RevokeAccountCredentialsBuilder { + pub fn new() -> RevokeAccountCredentialsBuilder< + revoke_account_credentials_state::Empty, + DefaultStr, + > { RevokeAccountCredentialsBuilder::new() } } impl RevokeAccountCredentials { /// Create a new builder for this type - pub fn builder() -> RevokeAccountCredentialsBuilder - { + pub fn builder() -> RevokeAccountCredentialsBuilder< + revoke_account_credentials_state::Empty, + S, + > { RevokeAccountCredentialsBuilder::builder() } } -impl RevokeAccountCredentialsBuilder { +impl RevokeAccountCredentialsBuilder< + revoke_account_credentials_state::Empty, + DefaultStr, +> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { RevokeAccountCredentialsBuilder { @@ -127,7 +133,9 @@ impl RevokeAccountCredentialsBuilder RevokeAccountCredentialsBuilder { +impl< + S: BosStr, +> RevokeAccountCredentialsBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { RevokeAccountCredentialsBuilder { @@ -147,7 +155,10 @@ where pub fn account( mut self, value: impl Into>, - ) -> RevokeAccountCredentialsBuilder, S> { + ) -> RevokeAccountCredentialsBuilder< + revoke_account_credentials_state::SetAccount, + S, + > { self._fields.0 = Option::Some(value.into()); RevokeAccountCredentialsBuilder { _state: PhantomData, @@ -179,4 +190,4 @@ where extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/lib.rs b/crates/polymodel-api/src/lib.rs index f4a808b..2e9e982 100644 --- a/crates/polymodel-api/src/lib.rs +++ b/crates/polymodel-api/src/lib.rs @@ -46,8 +46,10 @@ extern crate alloc; pub mod app_bsky; pub mod builder_types; + #[cfg(feature = "com_atproto")] pub mod com_atproto; + #[cfg(feature = "space_polymodel")] -pub mod space_polymodel; +pub mod space_polymodel; \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel.rs b/crates/polymodel-api/src/space_polymodel.rs index 882a0d6..9fa9e38 100644 --- a/crates/polymodel-api/src/space_polymodel.rs +++ b/crates/polymodel-api/src/space_polymodel.rs @@ -6,4 +6,4 @@ //! Generated bindings for the `space.polymodel` Lexicon namespace/module. pub mod actor; pub mod graph; -pub mod library; +pub mod library; \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/actor.rs b/crates/polymodel-api/src/space_polymodel/actor.rs index d13f559..86d352f 100644 --- a/crates/polymodel-api/src/space_polymodel/actor.rs +++ b/crates/polymodel-api/src/space_polymodel/actor.rs @@ -10,34 +10,32 @@ pub mod get_profile; pub mod get_session; pub mod profile; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{Datetime, Did, UriValue}; +use jacquard_common::types::string::{Did, Datetime, UriValue}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::app_bsky::actor::ProfileViewDetailed; -use crate::space_polymodel::actor; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::app_bsky::actor::ProfileViewDetailed; +use crate::space_polymodel::actor; /// Polymodel actor profile view (union variant). Hydrated from the space.polymodel.actor.profile record plus SQLite-derived stats (thingCount, totalLikes). Returned when the actor authored a polymodel profile record; otherwise getProfile returns the app.bsky.actor.defs#profileViewDetailed variant. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ProfileView { ///Resolved avatar URL (CDN). Null until the app view resolves the polymodel profile avatar blob. #[serde(skip_serializing_if = "Option::is_none")] @@ -96,7 +94,7 @@ impl LexiconSchema for ProfileView { pub mod profile_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -193,7 +191,19 @@ impl ProfileViewBuilder { ProfileViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -206,7 +216,19 @@ impl ProfileViewBuilder { ProfileViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -427,7 +449,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ProfileView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ProfileView { ProfileView { avatar: self._fields.0, default_license: self._fields.1, @@ -448,10 +473,10 @@ where } fn lexicon_doc_space_polymodel_actor_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.actor.defs"), @@ -567,7 +592,7 @@ fn lexicon_doc_space_polymodel_actor_defs() -> LexiconDoc<'static> { LexUserType::Union(LexRefUnion { refs: vec![ CowStr::new_static("space.polymodel.actor.defs#profileView"), - CowStr::new_static("app.bsky.actor.defs#profileViewDetailed"), + CowStr::new_static("app.bsky.actor.defs#profileViewDetailed") ], closed: Some(true), ..Default::default() @@ -577,4 +602,4 @@ fn lexicon_doc_space_polymodel_actor_defs() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/actor/get_profile.rs b/crates/polymodel-api/src/space_polymodel/actor/get_profile.rs index 23e1507..898ea10 100644 --- a/crates/polymodel-api/src/space_polymodel/actor/get_profile.rs +++ b/crates/polymodel-api/src/space_polymodel/actor/get_profile.rs @@ -8,30 +8,25 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::actor::ProfileViewUnion; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::actor::ProfileViewUnion; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfile { pub actor: AtIdentifier, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetProfileOutput { #[serde(flatten)] pub value: ProfileViewUnion, @@ -69,7 +64,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetProfileRequest { pub mod get_profile_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -172,4 +167,4 @@ where actor: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/actor/get_session.rs b/crates/polymodel-api/src/space_polymodel/actor/get_session.rs index a4a864f..54ab947 100644 --- a/crates/polymodel-api/src/space_polymodel/actor/get_session.rs +++ b/crates/polymodel-api/src/space_polymodel/actor/get_session.rs @@ -8,21 +8,18 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::actor::ProfileViewUnion; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::Did; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::actor::ProfileViewUnion; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetSessionOutput { ///Always present. When false the response carries only this field (no identity/profile); when true, did/handle/profile are populated. pub authenticated: bool, @@ -68,4 +65,4 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetSessionRequest { const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request = GetSession; type Response = GetSessionResponse; -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/actor/profile.rs b/crates/polymodel-api/src/space_polymodel/actor/profile.rs index 49c8362..33705b6 100644 --- a/crates/polymodel-api/src/space_polymodel/actor/profile.rs +++ b/crates/polymodel-api/src/space_polymodel/actor/profile.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -27,7 +27,7 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /// Polymodel actor profile (singleton). Appview unions app.bsky.actor.profile. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -127,20 +127,25 @@ impl LexiconSchema for Profile { { let mime = value.blob().mime_type.as_str(); let accepted: &[&str] = &["image/png", "image/jpeg"]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("avatar"), - accepted: vec!["image/png".to_string(), "image/jpeg".to_string()], + accepted: vec![ + "image/png".to_string(), "image/jpeg".to_string() + ], actual: mime.to_string(), }); } @@ -238,7 +243,7 @@ impl LexiconSchema for Profile { pub mod profile_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -430,10 +435,10 @@ where } fn lexicon_doc_space_polymodel_actor_profile() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.actor.profile"), @@ -520,4 +525,4 @@ fn lexicon_doc_space_polymodel_actor_profile() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph.rs b/crates/polymodel-api/src/space_polymodel/graph.rs index 1f62f71..e6e01e3 100644 --- a/crates/polymodel-api/src/space_polymodel/graph.rs +++ b/crates/polymodel-api/src/space_polymodel/graph.rs @@ -9,4 +9,4 @@ pub mod like; pub mod list; pub mod listitem; pub mod save; -pub mod tag; +pub mod tag; \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/get_list.rs b/crates/polymodel-api/src/space_polymodel/graph/get_list.rs index 20251ef..74a5618 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/get_list.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/get_list.rs @@ -8,21 +8,18 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::ThingViewBasic; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::AtUri; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::ThingViewBasic; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetList { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -33,11 +30,9 @@ pub struct GetList { pub list: AtUri, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetListOutput { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -80,7 +75,7 @@ fn _default_limit() -> Option { pub mod get_list_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -211,4 +206,4 @@ where list: self._fields.2.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/like.rs b/crates/polymodel-api/src/space_polymodel/graph/like.rs index 99e0a56..284a9a5 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/like.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/like.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,10 +24,10 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; /// Like any content record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -105,7 +105,7 @@ impl LexiconSchema for Like { pub mod like_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -253,10 +253,10 @@ where } fn lexicon_doc_space_polymodel_graph_like() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.graph.like"), @@ -268,10 +268,12 @@ fn lexicon_doc_space_polymodel_graph_like() -> LexiconDoc<'static> { description: Some(CowStr::new_static("Like any content record.")), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("subject"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("subject"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -300,4 +302,4 @@ fn lexicon_doc_space_polymodel_graph_like() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/list.rs b/crates/polymodel-api/src/space_polymodel/graph/list.rs index ac73955..88e63e0 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/list.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/list.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -27,7 +27,7 @@ use jacquard_lexicon::schema::LexiconSchema; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; /// A list of things (minimal metadata). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -121,20 +121,25 @@ impl LexiconSchema for List { { let mime = value.blob().mime_type.as_str(); let accepted: &[&str] = &["image/png", "image/jpeg"]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("avatar"), - accepted: vec!["image/png".to_string(), "image/jpeg".to_string()], + accepted: vec![ + "image/png".to_string(), "image/jpeg".to_string() + ], actual: mime.to_string(), }); } @@ -180,7 +185,7 @@ impl LexiconSchema for List { pub mod list_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -225,13 +230,7 @@ pub mod list_state { /// Builder for constructing an instance of this type. pub struct ListBuilder { _state: PhantomData St>, - _fields: ( - Option>, - Option, - Option, - Option, - Option, - ), + _fields: (Option>, Option, Option, Option, Option), _type: PhantomData S>, } @@ -322,7 +321,10 @@ where St::Name: list_state::IsUnset, { /// Set the `name` field (required) - pub fn name(mut self, value: impl Into) -> ListBuilder, S> { + pub fn name( + mut self, + value: impl Into, + ) -> ListBuilder, S> { self._fields.3 = Option::Some(value.into()); ListBuilder { _state: PhantomData, @@ -376,10 +378,10 @@ where } fn lexicon_doc_space_polymodel_graph_list() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.graph.list"), @@ -388,21 +390,23 @@ fn lexicon_doc_space_polymodel_graph_list() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static("A list of things (minimal metadata).")), + description: Some( + CowStr::new_static("A list of things (minimal metadata)."), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("name"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("name"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("avatar"), - LexObjectProperty::Blob(LexBlob { - ..Default::default() - }), + LexObjectProperty::Blob(LexBlob { ..Default::default() }), ); map.insert( SmolStr::new_static("createdAt"), @@ -443,4 +447,4 @@ fn lexicon_doc_space_polymodel_graph_list() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/listitem.rs b/crates/polymodel-api/src/space_polymodel/graph/listitem.rs index 3b2ee35..26aa7a8 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/listitem.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/listitem.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,10 +24,10 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; /// Membership of a thing in a list (v1: thing only). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -106,7 +106,7 @@ impl LexiconSchema for Listitem { pub mod listitem_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -290,10 +290,10 @@ where } fn lexicon_doc_space_polymodel_graph_listitem() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.graph.listitem"), @@ -302,16 +302,19 @@ fn lexicon_doc_space_polymodel_graph_listitem() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "Membership of a thing in a list (v1: thing only).", - )), + description: Some( + CowStr::new_static( + "Membership of a thing in a list (v1: thing only).", + ), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("subject"), - SmolStr::new_static("list"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("subject"), SmolStr::new_static("list"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -347,4 +350,4 @@ fn lexicon_doc_space_polymodel_graph_listitem() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/save.rs b/crates/polymodel-api/src/space_polymodel/graph/save.rs index 700e141..3365e0a 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/save.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/save.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,10 +24,10 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; /// Bookmark/save with optional private note. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -117,7 +117,7 @@ impl LexiconSchema for Save { pub mod save_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -280,10 +280,10 @@ where } fn lexicon_doc_space_polymodel_graph_save() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.graph.save"), @@ -292,15 +292,17 @@ fn lexicon_doc_space_polymodel_graph_save() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "Bookmark/save with optional private note.", - )), + description: Some( + CowStr::new_static("Bookmark/save with optional private note."), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("subject"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("subject"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -336,4 +338,4 @@ fn lexicon_doc_space_polymodel_graph_save() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/graph/tag.rs b/crates/polymodel-api/src/space_polymodel/graph/tag.rs index eb49ee0..a3849eb 100644 --- a/crates/polymodel-api/src/space_polymodel/graph/tag.rs +++ b/crates/polymodel-api/src/space_polymodel/graph/tag.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,10 +24,10 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; /// Community tag asserting about a subject. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -130,7 +130,7 @@ impl LexiconSchema for Tag { pub mod tag_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -311,10 +311,10 @@ where } fn lexicon_doc_space_polymodel_graph_tag() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.graph.tag"), @@ -323,16 +323,17 @@ fn lexicon_doc_space_polymodel_graph_tag() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "Community tag asserting about a subject.", - )), + description: Some( + CowStr::new_static("Community tag asserting about a subject."), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("subject"), - SmolStr::new_static("tag"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("subject"), SmolStr::new_static("tag"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -369,4 +370,4 @@ fn lexicon_doc_space_polymodel_graph_tag() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library.rs b/crates/polymodel-api/src/space_polymodel/library.rs index 38c87c8..697398e 100644 --- a/crates/polymodel-api/src/space_polymodel/library.rs +++ b/crates/polymodel-api/src/space_polymodel/library.rs @@ -15,44 +15,112 @@ pub mod part; pub mod search_things; pub mod thing; + #[allow(unused_imports)] use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::blob::BlobRef; -use jacquard_common::types::string::{AtUri, Datetime, Did, UriValue}; +use jacquard_common::types::string::{Did, Handle, AtUri, Datetime, UriValue}; use jacquard_common::types::value::Data; use jacquard_derive::IntoStatic; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; -use crate::space_polymodel::library; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; +use crate::space_polymodel::library; -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Actor { ///Avatar image URL resolved by the app view (CDN). #[serde(skip_serializing_if = "Option::is_none")] pub avatar: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub did: Option>, + pub description: Option, + pub did: Did, #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub handle: Option, + pub follower_count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub following_count: Option, + pub handle: Handle, + ///Hydrated profile pronouns for bylines and cards. + #[serde(skip_serializing_if = "Option::is_none")] + pub pronouns: Option, + ///Count of published Polymodel things by this actor. + #[serde(skip_serializing_if = "Option::is_none")] + pub thing_count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub viewer: Option>, + #[serde(flatten, default, skip_serializing_if = "Option::is_none")] + pub extra_data: Option>>, +} + +/// Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits. + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] +pub struct ActorViewDetailed { + ///Avatar image URL resolved by the app view (CDN). + #[serde(skip_serializing_if = "Option::is_none")] + pub avatar: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub default_license: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + pub did: Did, + #[serde(skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub follower_count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub following_count: Option, + pub handle: Handle, + pub indexed_at: Datetime, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option>>, + #[serde(skip_serializing_if = "Option::is_none")] + pub printers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub pronouns: Option, + pub record: Data, + ///Count of published Polymodel things by this actor. + #[serde(skip_serializing_if = "Option::is_none")] + pub thing_count: Option, + pub viewer: library::ActorViewerState, + #[serde(flatten, default, skip_serializing_if = "Option::is_none")] + pub extra_data: Option>>, +} + +/// Viewer-specific relationship state for an actor/profile. + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] +pub struct ActorViewerState { + #[serde(skip_serializing_if = "Option::is_none")] + pub blocked_by: Option, + ///Block record URI if the requester blocks this actor. + #[serde(skip_serializing_if = "Option::is_none")] + pub blocking: Option>, + ///Follow record URI if this actor follows the requester. + #[serde(skip_serializing_if = "Option::is_none")] + pub followed_by: Option>, + ///Follow record URI if the requester follows this actor. + #[serde(skip_serializing_if = "Option::is_none")] + pub following: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub muted: Option, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } @@ -60,10 +128,7 @@ pub struct Actor { /// Width:height aspect ratio of an image, for layout before the blob loads. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct AspectRatio { pub height: i64, pub width: i64, @@ -74,10 +139,7 @@ pub struct AspectRatio { /// Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Bbox { #[serde(skip_serializing_if = "Option::is_none")] pub unit: Option, @@ -88,11 +150,9 @@ pub struct Bbox { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Chunk { pub blob: BlobRef, pub offset: i64, @@ -101,22 +161,18 @@ pub struct Chunk { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct FeedItem { pub thing: library::ThingViewBasic, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct FeedView { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -128,10 +184,7 @@ pub struct FeedView { /// Chunk-capable geometry manifest. Reassemble by concatenating chunks in offset order. Per-chunk integrity is the blob CID; offset+size make ordering explicit; digest verifies the fully reassembled file. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct File { pub chunks: Vec>, ///hex digest of the fully reassembled file (sha256 by convention) @@ -146,10 +199,7 @@ pub struct File { /// An authored image: a blob plus alt text and aspect ratio. Stored on records; the app view resolves it to #imageView. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Image { ///Alt text describing the image, for accessibility. pub alt: S, @@ -162,10 +212,7 @@ pub struct Image { /// A resolved image view: CDN URLs for thumbnail and full size plus aspect ratio. Currently resolved via Bluesky's CDN by the app view. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ImageView { #[serde(skip_serializing_if = "Option::is_none")] pub alt: Option, @@ -179,63 +226,51 @@ pub struct ImageView { pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ModelView { pub author: library::Actor, pub cid: S, #[serde(skip_serializing_if = "Option::is_none")] pub cover: Option>>, pub indexed_at: Datetime, - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub part_count: Option, + pub name: S, + pub part_count: i64, #[serde(skip_serializing_if = "Option::is_none")] pub previews: Option>>, pub record: Data, #[serde(skip_serializing_if = "Option::is_none")] pub summary: Option, pub uri: AtUri, - #[serde(skip_serializing_if = "Option::is_none")] - pub viewer: Option>, + pub viewer: library::ViewerState, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct PartView { pub author: library::Actor, pub cid: S, - #[serde(skip_serializing_if = "Option::is_none")] - pub file: Option>, + pub file: library::File, #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, pub indexed_at: Datetime, - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, + pub name: S, #[serde(skip_serializing_if = "Option::is_none")] pub previews: Option>>, pub record: Data, pub uri: AtUri, - #[serde(skip_serializing_if = "Option::is_none")] - pub viewer: Option>, + pub viewer: library::ViewerState, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ThingView { pub author: library::Actor, pub cid: S, @@ -246,64 +281,56 @@ pub struct ThingView { pub indexed_at: Datetime, #[serde(skip_serializing_if = "Option::is_none")] pub intended_to_work_with: Option>>, - #[serde(skip_serializing_if = "Option::is_none")] - pub license: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub like_count: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub model_count: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, + pub license: S, + pub like_count: i64, + pub model_count: i64, + pub name: S, + ///Thing-level aggregate count of parts across included models, computed by the app view. + pub part_count: i64, #[serde(skip_serializing_if = "Option::is_none")] pub previews: Option>>, pub record: Data, - #[serde(skip_serializing_if = "Option::is_none")] - pub save_count: Option, + pub save_count: i64, #[serde(skip_serializing_if = "Option::is_none")] pub summary: Option, + ///Hydrated display tags, including appview-aggregated external tag assertions. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, pub uri: AtUri, - #[serde(skip_serializing_if = "Option::is_none")] - pub viewer: Option>, + pub viewer: library::ViewerState, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ThingViewBasic { - #[serde(skip_serializing_if = "Option::is_none")] - pub author: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub cid: Option, + pub author: library::Actor, + pub cid: S, #[serde(skip_serializing_if = "Option::is_none")] pub cover: Option>>, - #[serde(skip_serializing_if = "Option::is_none")] - pub indexed_at: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub like_count: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub model_count: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, + pub indexed_at: Datetime, + pub like_count: i64, + pub model_count: i64, + pub name: S, + ///Thing-level aggregate count of parts across included models, computed by the app view. + pub part_count: i64, #[serde(skip_serializing_if = "Option::is_none")] pub previews: Option>>, + pub save_count: i64, + ///Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions. #[serde(skip_serializing_if = "Option::is_none")] - pub save_count: Option, + pub tags: Option>, pub uri: AtUri, + pub viewer: library::ViewerState, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct ViewerState { #[serde(skip_serializing_if = "Option::is_none")] pub like: Option>, @@ -316,10 +343,7 @@ pub struct ViewerState { /// Reference-only shared field set; fields are inlined on thing/model. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct WorkMeta { #[serde(skip_serializing_if = "Option::is_none")] pub cover: Option>>, @@ -358,6 +382,36 @@ impl LexiconSchema for Actor { } } +impl LexiconSchema for ActorViewDetailed { + fn nsid() -> &'static str { + "space.polymodel.library.defs" + } + fn def_name() -> &'static str { + "actorViewDetailed" + } + fn lexicon_doc() -> LexiconDoc<'static> { + lexicon_doc_space_polymodel_library_defs() + } + fn validate(&self) -> Result<(), ConstraintError> { + Ok(()) + } +} + +impl LexiconSchema for ActorViewerState { + fn nsid() -> &'static str { + "space.polymodel.library.defs" + } + fn def_name() -> &'static str { + "actorViewerState" + } + fn lexicon_doc() -> LexiconDoc<'static> { + lexicon_doc_space_polymodel_library_defs() + } + fn validate(&self) -> Result<(), ConstraintError> { + Ok(()) + } +} + impl LexiconSchema for AspectRatio { fn nsid() -> &'static str { "space.polymodel.library.defs" @@ -422,24 +476,25 @@ impl LexiconSchema for Chunk { "model/obj", "application/octet-stream", ]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("blob"), accepted: vec![ - "model/stl".to_string(), - "model/3mf".to_string(), - "model/obj".to_string(), - "application/octet-stream".to_string(), + "model/stl".to_string(), "model/3mf".to_string(), "model/obj" + .to_string(), "application/octet-stream".to_string() ], actual: mime.to_string(), }); @@ -579,23 +634,25 @@ impl LexiconSchema for Image { { let mime = value.blob().mime_type.as_str(); let accepted: &[&str] = &["image/png", "image/jpeg", "image/webp"]; - let matched = accepted.iter().any(|pattern| { - if *pattern == "*/*" { - true - } else if pattern.ends_with("/*") { - let prefix = &pattern[..pattern.len() - 2]; - mime.starts_with(prefix) && mime.as_bytes().get(prefix.len()) == Some(&b'/') - } else { - mime == *pattern - } - }); + let matched = accepted + .iter() + .any(|pattern| { + if *pattern == "*/*" { + true + } else if pattern.ends_with("/*") { + let prefix = &pattern[..pattern.len() - 2]; + mime.starts_with(prefix) + && mime.as_bytes().get(prefix.len()) == Some(&b'/') + } else { + mime == *pattern + } + }); if !matched { return Err(ConstraintError::BlobMimeTypeNotAccepted { path: ValidationPath::from_field("image"), accepted: vec![ - "image/png".to_string(), - "image/jpeg".to_string(), - "image/webp".to_string(), + "image/png".to_string(), "image/jpeg".to_string(), + "image/webp".to_string() ], actual: mime.to_string(), }); @@ -711,171 +768,685 @@ impl LexiconSchema for WorkMeta { } } -fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; - #[allow(unused_imports)] - use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; - use jacquard_lexicon::lexicon::*; - LexiconDoc { - lexicon: Lexicon::Lexicon1, - id: CowStr::new_static("space.polymodel.library.defs"), - defs: { - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("actor"), - LexUserType::Object(LexObject { - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("avatar"), - LexObjectProperty::String(LexString { - description: Some(CowStr::new_static( - "Avatar image URL resolved by the app view (CDN).", - )), - format: Some(LexStringFormat::Uri), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("did"), - LexObjectProperty::String(LexString { - format: Some(LexStringFormat::Did), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("displayName"), - LexObjectProperty::String(LexString { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("handle"), - LexObjectProperty::String(LexString { - ..Default::default() - }), - ); - map - }, - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("aspectRatio"), - LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Width:height aspect ratio of an image, for layout before the blob loads.", - )), - required: Some(vec![ - SmolStr::new_static("width"), - SmolStr::new_static("height"), - ]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("height"), - LexObjectProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("width"), - LexObjectProperty::Integer(LexInteger { - ..Default::default() - }), - ); - map - }, - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("bbox"), - LexUserType::Object(LexObject { - description: Some( - CowStr::new_static( - "Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally.", - ), - ), - required: Some( - vec![ - SmolStr::new_static("x"), SmolStr::new_static("y"), - SmolStr::new_static("z") - ], - ), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("unit"), - LexObjectProperty::String(LexString { ..Default::default() }), - ); - map.insert( - SmolStr::new_static("x"), - LexObjectProperty::String(LexString { ..Default::default() }), - ); - map.insert( - SmolStr::new_static("y"), - LexObjectProperty::String(LexString { ..Default::default() }), - ); - map.insert( - SmolStr::new_static("z"), - LexObjectProperty::String(LexString { ..Default::default() }), - ); - map - }, - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("chunk"), - LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("blob"), - SmolStr::new_static("offset"), - SmolStr::new_static("size"), - ]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("blob"), - LexObjectProperty::Blob(LexBlob { - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("offset"), - LexObjectProperty::Integer(LexInteger { - minimum: Some(0i64), - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("size"), - LexObjectProperty::Integer(LexInteger { - minimum: Some(0i64), - ..Default::default() - }), - ); - map - }, - ..Default::default() - }), - ); - map.insert( - SmolStr::new_static("feedItem"), - LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("thing")]), - properties: { - #[allow(unused_mut)] - let mut map = BTreeMap::new(); - map.insert( - SmolStr::new_static("thing"), - LexObjectProperty::Ref(LexRef { - r#ref: CowStr::new_static("#thingViewBasic"), +pub mod actor_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 Handle; + } + /// 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(PhantomData St>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Did = Set; + type Handle = St::Handle; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle(PhantomData St>); + impl sealed::Sealed for SetHandle {} + impl State for SetHandle { + type Did = St::Did; + type Handle = Set; + } + /// 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(()); + } +} + +/// Builder for constructing an instance of this type. +pub struct ActorBuilder { + _state: PhantomData St>, + _fields: ( + Option>, + Option, + Option>, + Option, + Option, + Option, + Option>, + Option, + Option, + Option>, + ), + _type: PhantomData S>, +} + +impl Actor { + /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed + pub fn new() -> ActorBuilder { + ActorBuilder::new() + } +} + +impl Actor { + /// Create a new builder for this type + pub fn builder() -> ActorBuilder { + ActorBuilder::builder() + } +} + +impl ActorBuilder { + /// Create a new builder with all fields unset, using the default string type, if needed + pub fn new() -> Self { + ActorBuilder { + _state: PhantomData, + _fields: (None, None, None, None, None, None, None, None, None, None), + _type: PhantomData, + } + } +} + +impl ActorBuilder { + /// Create a new builder with all fields unset + pub fn builder() -> Self { + ActorBuilder { + _state: PhantomData, + _fields: (None, None, None, None, None, None, None, None, None, None), + _type: PhantomData, + } + } +} + +impl ActorBuilder { + /// Set the `avatar` field (optional) + pub fn avatar(mut self, value: impl Into>>) -> Self { + self._fields.0 = value.into(); + self + } + /// Set the `avatar` field to an Option value (optional) + pub fn maybe_avatar(mut self, value: Option>) -> Self { + self._fields.0 = value; + self + } +} + +impl ActorBuilder { + /// Set the `description` field (optional) + pub fn description(mut self, value: impl Into>) -> Self { + self._fields.1 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description(mut self, value: Option) -> Self { + self._fields.1 = value; + self + } +} + +impl ActorBuilder +where + St: actor_state::State, + St::Did: actor_state::IsUnset, +{ + /// Set the `did` field (required) + pub fn did( + mut self, + value: impl Into>, + ) -> ActorBuilder, S> { + self._fields.2 = Option::Some(value.into()); + ActorBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorBuilder { + /// Set the `displayName` field (optional) + pub fn display_name(mut self, value: impl Into>) -> Self { + self._fields.3 = value.into(); + self + } + /// Set the `displayName` field to an Option value (optional) + pub fn maybe_display_name(mut self, value: Option) -> Self { + self._fields.3 = value; + self + } +} + +impl ActorBuilder { + /// Set the `followerCount` field (optional) + pub fn follower_count(mut self, value: impl Into>) -> Self { + self._fields.4 = value.into(); + self + } + /// Set the `followerCount` field to an Option value (optional) + pub fn maybe_follower_count(mut self, value: Option) -> Self { + self._fields.4 = value; + self + } +} + +impl ActorBuilder { + /// Set the `followingCount` field (optional) + pub fn following_count(mut self, value: impl Into>) -> Self { + self._fields.5 = value.into(); + self + } + /// Set the `followingCount` field to an Option value (optional) + pub fn maybe_following_count(mut self, value: Option) -> Self { + self._fields.5 = value; + self + } +} + +impl ActorBuilder +where + St: actor_state::State, + St::Handle: actor_state::IsUnset, +{ + /// Set the `handle` field (required) + pub fn handle( + mut self, + value: impl Into>, + ) -> ActorBuilder, S> { + self._fields.6 = Option::Some(value.into()); + ActorBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorBuilder { + /// Set the `pronouns` field (optional) + pub fn pronouns(mut self, value: impl Into>) -> Self { + self._fields.7 = value.into(); + self + } + /// Set the `pronouns` field to an Option value (optional) + pub fn maybe_pronouns(mut self, value: Option) -> Self { + self._fields.7 = value; + self + } +} + +impl ActorBuilder { + /// Set the `thingCount` field (optional) + pub fn thing_count(mut self, value: impl Into>) -> Self { + self._fields.8 = value.into(); + self + } + /// Set the `thingCount` field to an Option value (optional) + pub fn maybe_thing_count(mut self, value: Option) -> Self { + self._fields.8 = value; + self + } +} + +impl ActorBuilder { + /// Set the `viewer` field (optional) + pub fn viewer( + mut self, + value: impl Into>>, + ) -> Self { + self._fields.9 = value.into(); + self + } + /// Set the `viewer` field to an Option value (optional) + pub fn maybe_viewer(mut self, value: Option>) -> Self { + self._fields.9 = value; + self + } +} + +impl ActorBuilder +where + St: actor_state::State, + St::Did: actor_state::IsSet, + St::Handle: actor_state::IsSet, +{ + /// Build the final struct. + pub fn build(self) -> Actor { + Actor { + avatar: self._fields.0, + description: self._fields.1, + did: self._fields.2.unwrap(), + display_name: self._fields.3, + follower_count: self._fields.4, + following_count: self._fields.5, + handle: self._fields.6.unwrap(), + pronouns: self._fields.7, + thing_count: self._fields.8, + viewer: self._fields.9, + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data. + pub fn build_with_data(self, extra_data: BTreeMap>) -> Actor { + Actor { + avatar: self._fields.0, + description: self._fields.1, + did: self._fields.2.unwrap(), + display_name: self._fields.3, + follower_count: self._fields.4, + following_count: self._fields.5, + handle: self._fields.6.unwrap(), + pronouns: self._fields.7, + thing_count: self._fields.8, + viewer: self._fields.9, + extra_data: Some(extra_data), + } + } +} + +fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { + #[allow(unused_imports)] + use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; + use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; + LexiconDoc { + lexicon: Lexicon::Lexicon1, + id: CowStr::new_static("space.polymodel.library.defs"), + defs: { + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("actor"), + LexUserType::Object(LexObject { + required: Some( + vec![SmolStr::new_static("did"), SmolStr::new_static("handle")], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("avatar"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Avatar image URL resolved by the app view (CDN).", + ), + ), + format: Some(LexStringFormat::Uri), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("description"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("did"), + LexObjectProperty::String(LexString { + format: Some(LexStringFormat::Did), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("displayName"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("followerCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("followingCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("handle"), + LexObjectProperty::String(LexString { + format: Some(LexStringFormat::Handle), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("pronouns"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Hydrated profile pronouns for bylines and cards.", + ), + ), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("thingCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("viewer"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static("#actorViewerState"), + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("actorViewDetailed"), + LexUserType::Object(LexObject { + description: Some( + CowStr::new_static( + "Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits.", + ), + ), + required: Some( + vec![ + SmolStr::new_static("did"), SmolStr::new_static("handle"), + SmolStr::new_static("record"), + SmolStr::new_static("indexedAt"), + SmolStr::new_static("viewer") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("avatar"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Avatar image URL resolved by the app view (CDN).", + ), + ), + format: Some(LexStringFormat::Uri), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("defaultLicense"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("description"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("did"), + LexObjectProperty::String(LexString { + format: Some(LexStringFormat::Did), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("displayName"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("followerCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("followingCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("handle"), + LexObjectProperty::String(LexString { + format: Some(LexStringFormat::Handle), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("indexedAt"), + LexObjectProperty::String(LexString { + format: Some(LexStringFormat::Datetime), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("links"), + LexObjectProperty::Array(LexArray { + items: LexArrayItem::String(LexString { + format: Some(LexStringFormat::Uri), + ..Default::default() + }), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("printers"), + LexObjectProperty::Array(LexArray { + items: LexArrayItem::String(LexString { + ..Default::default() + }), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("pronouns"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("record"), + LexObjectProperty::Unknown(LexUnknown { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("thingCount"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("viewer"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static("#actorViewerState"), + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("actorViewerState"), + LexUserType::Object(LexObject { + description: Some( + CowStr::new_static( + "Viewer-specific relationship state for an actor/profile.", + ), + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("blockedBy"), + LexObjectProperty::Boolean(LexBoolean { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("blocking"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Block record URI if the requester blocks this actor.", + ), + ), + format: Some(LexStringFormat::AtUri), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("followedBy"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Follow record URI if this actor follows the requester.", + ), + ), + format: Some(LexStringFormat::AtUri), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("following"), + LexObjectProperty::String(LexString { + description: Some( + CowStr::new_static( + "Follow record URI if the requester follows this actor.", + ), + ), + format: Some(LexStringFormat::AtUri), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("muted"), + LexObjectProperty::Boolean(LexBoolean { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("aspectRatio"), + LexUserType::Object(LexObject { + description: Some( + CowStr::new_static( + "Width:height aspect ratio of an image, for layout before the blob loads.", + ), + ), + required: Some( + vec![SmolStr::new_static("width"), SmolStr::new_static("height")], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("height"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("width"), + LexObjectProperty::Integer(LexInteger { + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("bbox"), + LexUserType::Object(LexObject { + description: Some( + CowStr::new_static( + "Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally.", + ), + ), + required: Some( + vec![ + SmolStr::new_static("x"), SmolStr::new_static("y"), + SmolStr::new_static("z") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("unit"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("x"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("y"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("z"), + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("chunk"), + LexUserType::Object(LexObject { + required: Some( + vec![ + SmolStr::new_static("blob"), SmolStr::new_static("offset"), + SmolStr::new_static("size") + ], + ), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("blob"), + LexObjectProperty::Blob(LexBlob { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("offset"), + LexObjectProperty::Integer(LexInteger { + minimum: Some(0i64), + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("size"), + LexObjectProperty::Integer(LexInteger { + minimum: Some(0i64), + ..Default::default() + }), + ); + map + }, + ..Default::default() + }), + ); + map.insert( + SmolStr::new_static("feedItem"), + LexUserType::Object(LexObject { + required: Some(vec![SmolStr::new_static("thing")]), + properties: { + #[allow(unused_mut)] + let mut map = BTreeMap::new(); + map.insert( + SmolStr::new_static("thing"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static("#thingViewBasic"), ..Default::default() }), ); @@ -893,9 +1464,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("cursor"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("items"), @@ -1071,13 +1640,16 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("modelView"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("uri"), - SmolStr::new_static("cid"), - SmolStr::new_static("author"), - SmolStr::new_static("record"), - SmolStr::new_static("indexedAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("uri"), SmolStr::new_static("cid"), + SmolStr::new_static("author"), SmolStr::new_static("record"), + SmolStr::new_static("indexedAt"), + SmolStr::new_static("name"), + SmolStr::new_static("partCount"), + SmolStr::new_static("viewer") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -1090,9 +1662,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("cid"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("cover"), @@ -1113,9 +1683,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("partCount"), @@ -1141,9 +1709,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("summary"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("uri"), @@ -1167,13 +1733,15 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("partView"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("uri"), - SmolStr::new_static("cid"), - SmolStr::new_static("author"), - SmolStr::new_static("record"), - SmolStr::new_static("indexedAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("uri"), SmolStr::new_static("cid"), + SmolStr::new_static("author"), SmolStr::new_static("record"), + SmolStr::new_static("indexedAt"), + SmolStr::new_static("name"), SmolStr::new_static("file"), + SmolStr::new_static("viewer") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -1186,9 +1754,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("cid"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("file"), @@ -1199,9 +1765,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("format"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("indexedAt"), @@ -1212,9 +1776,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("previews"), @@ -1254,13 +1816,19 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("thingView"), LexUserType::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("uri"), - SmolStr::new_static("cid"), - SmolStr::new_static("author"), - SmolStr::new_static("record"), - SmolStr::new_static("indexedAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("uri"), SmolStr::new_static("cid"), + SmolStr::new_static("author"), SmolStr::new_static("record"), + SmolStr::new_static("indexedAt"), + SmolStr::new_static("name"), SmolStr::new_static("license"), + SmolStr::new_static("likeCount"), + SmolStr::new_static("saveCount"), + SmolStr::new_static("modelCount"), + SmolStr::new_static("partCount"), + SmolStr::new_static("viewer") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -1273,9 +1841,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("cid"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("cover"), @@ -1313,9 +1879,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("license"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("likeCount"), @@ -1331,7 +1895,11 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("partCount"), + LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); @@ -1359,13 +1927,16 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("summary"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("tags"), LexObjectProperty::Array(LexArray { + description: Some( + CowStr::new_static( + "Hydrated display tags, including appview-aggregated external tag assertions.", + ), + ), items: LexArrayItem::String(LexString { ..Default::default() }), @@ -1394,7 +1965,18 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("thingViewBasic"), LexUserType::Object(LexObject { - required: Some(vec![SmolStr::new_static("uri")]), + required: Some( + vec![ + SmolStr::new_static("uri"), SmolStr::new_static("cid"), + SmolStr::new_static("author"), SmolStr::new_static("name"), + SmolStr::new_static("likeCount"), + SmolStr::new_static("saveCount"), + SmolStr::new_static("modelCount"), + SmolStr::new_static("partCount"), + SmolStr::new_static("indexedAt"), + SmolStr::new_static("viewer") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -1407,9 +1989,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("cid"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("cover"), @@ -1442,7 +2022,11 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { + LexObjectProperty::String(LexString { ..Default::default() }), + ); + map.insert( + SmolStr::new_static("partCount"), + LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); @@ -1462,6 +2046,20 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ..Default::default() }), ); + map.insert( + SmolStr::new_static("tags"), + LexObjectProperty::Array(LexArray { + description: Some( + CowStr::new_static( + "Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions.", + ), + ), + items: LexArrayItem::String(LexString { + ..Default::default() + }), + ..Default::default() + }), + ); map.insert( SmolStr::new_static("uri"), LexObjectProperty::String(LexString { @@ -1469,6 +2067,13 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ..Default::default() }), ); + map.insert( + SmolStr::new_static("viewer"), + LexObjectProperty::Ref(LexRef { + r#ref: CowStr::new_static("#viewerState"), + ..Default::default() + }), + ); map }, ..Default::default() @@ -1502,9 +2107,11 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("workMeta"), LexUserType::Object(LexObject { - description: Some(CowStr::new_static( - "Reference-only shared field set; fields are inlined on thing/model.", - )), + description: Some( + CowStr::new_static( + "Reference-only shared field set; fields are inlined on thing/model.", + ), + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -1546,15 +2153,11 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("license"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("name"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("previews"), @@ -1568,9 +2171,7 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { ); map.insert( SmolStr::new_static("summary"), - LexObjectProperty::String(LexString { - ..Default::default() - }), + LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("tags"), @@ -1592,9 +2193,479 @@ fn lexicon_doc_space_polymodel_library_defs() -> LexiconDoc<'static> { } } +pub mod actor_view_detailed_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 Handle; + type IndexedAt; + type Record; + type Viewer; + } + /// 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 IndexedAt = Unset; + type Record = Unset; + type Viewer = Unset; + } + ///State transition - sets the `did` field to Set + pub struct SetDid(PhantomData St>); + impl sealed::Sealed for SetDid {} + impl State for SetDid { + type Did = Set; + type Handle = St::Handle; + type IndexedAt = St::IndexedAt; + type Record = St::Record; + type Viewer = St::Viewer; + } + ///State transition - sets the `handle` field to Set + pub struct SetHandle(PhantomData St>); + impl sealed::Sealed for SetHandle {} + impl State for SetHandle { + type Did = St::Did; + type Handle = Set; + type IndexedAt = St::IndexedAt; + type Record = St::Record; + type Viewer = St::Viewer; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData St>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type Did = St::Did; + type Handle = St::Handle; + type IndexedAt = Set; + type Record = St::Record; + type Viewer = St::Viewer; + } + ///State transition - sets the `record` field to Set + pub struct SetRecord(PhantomData St>); + impl sealed::Sealed for SetRecord {} + impl State for SetRecord { + type Did = St::Did; + type Handle = St::Handle; + type IndexedAt = St::IndexedAt; + type Record = Set; + type Viewer = St::Viewer; + } + ///State transition - sets the `viewer` field to Set + pub struct SetViewer(PhantomData St>); + impl sealed::Sealed for SetViewer {} + impl State for SetViewer { + type Did = St::Did; + type Handle = St::Handle; + type IndexedAt = St::IndexedAt; + type Record = St::Record; + type Viewer = Set; + } + /// 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 `indexed_at` field + pub struct indexed_at(()); + ///Marker type for the `record` field + pub struct record(()); + ///Marker type for the `viewer` field + pub struct viewer(()); + } +} + +/// Builder for constructing an instance of this type. +pub struct ActorViewDetailedBuilder< + St: actor_view_detailed_state::State, + S: BosStr = DefaultStr, +> { + _state: PhantomData St>, + _fields: ( + Option>, + Option, + Option, + Option>, + Option, + Option, + Option, + Option>, + Option, + Option>>, + Option>, + Option, + Option>, + Option, + Option>, + ), + _type: PhantomData S>, +} + +impl ActorViewDetailed { + /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed + pub fn new() -> ActorViewDetailedBuilder< + actor_view_detailed_state::Empty, + DefaultStr, + > { + ActorViewDetailedBuilder::new() + } +} + +impl ActorViewDetailed { + /// Create a new builder for this type + pub fn builder() -> ActorViewDetailedBuilder { + ActorViewDetailedBuilder::builder() + } +} + +impl ActorViewDetailedBuilder { + /// Create a new builder with all fields unset, using the default string type, if needed + pub fn new() -> Self { + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder { + /// Create a new builder with all fields unset + pub fn builder() -> Self { + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder { + /// Set the `avatar` field (optional) + pub fn avatar(mut self, value: impl Into>>) -> Self { + self._fields.0 = value.into(); + self + } + /// Set the `avatar` field to an Option value (optional) + pub fn maybe_avatar(mut self, value: Option>) -> Self { + self._fields.0 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `defaultLicense` field (optional) + pub fn default_license(mut self, value: impl Into>) -> Self { + self._fields.1 = value.into(); + self + } + /// Set the `defaultLicense` field to an Option value (optional) + pub fn maybe_default_license(mut self, value: Option) -> Self { + self._fields.1 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `description` field (optional) + pub fn description(mut self, value: impl Into>) -> Self { + self._fields.2 = value.into(); + self + } + /// Set the `description` field to an Option value (optional) + pub fn maybe_description(mut self, value: Option) -> Self { + self._fields.2 = value; + self + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::Did: actor_view_detailed_state::IsUnset, +{ + /// Set the `did` field (required) + pub fn did( + mut self, + value: impl Into>, + ) -> ActorViewDetailedBuilder, S> { + self._fields.3 = Option::Some(value.into()); + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder { + /// Set the `displayName` field (optional) + pub fn display_name(mut self, value: impl Into>) -> Self { + self._fields.4 = value.into(); + self + } + /// Set the `displayName` field to an Option value (optional) + pub fn maybe_display_name(mut self, value: Option) -> Self { + self._fields.4 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `followerCount` field (optional) + pub fn follower_count(mut self, value: impl Into>) -> Self { + self._fields.5 = value.into(); + self + } + /// Set the `followerCount` field to an Option value (optional) + pub fn maybe_follower_count(mut self, value: Option) -> Self { + self._fields.5 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `followingCount` field (optional) + pub fn following_count(mut self, value: impl Into>) -> Self { + self._fields.6 = value.into(); + self + } + /// Set the `followingCount` field to an Option value (optional) + pub fn maybe_following_count(mut self, value: Option) -> Self { + self._fields.6 = value; + self + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::Handle: actor_view_detailed_state::IsUnset, +{ + /// Set the `handle` field (required) + pub fn handle( + mut self, + value: impl Into>, + ) -> ActorViewDetailedBuilder, S> { + self._fields.7 = Option::Some(value.into()); + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::IndexedAt: actor_view_detailed_state::IsUnset, +{ + /// Set the `indexedAt` field (required) + pub fn indexed_at( + mut self, + value: impl Into, + ) -> ActorViewDetailedBuilder, S> { + self._fields.8 = Option::Some(value.into()); + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder { + /// Set the `links` field (optional) + pub fn links(mut self, value: impl Into>>>) -> Self { + self._fields.9 = value.into(); + self + } + /// Set the `links` field to an Option value (optional) + pub fn maybe_links(mut self, value: Option>>) -> Self { + self._fields.9 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `printers` field (optional) + pub fn printers(mut self, value: impl Into>>) -> Self { + self._fields.10 = value.into(); + self + } + /// Set the `printers` field to an Option value (optional) + pub fn maybe_printers(mut self, value: Option>) -> Self { + self._fields.10 = value; + self + } +} + +impl ActorViewDetailedBuilder { + /// Set the `pronouns` field (optional) + pub fn pronouns(mut self, value: impl Into>) -> Self { + self._fields.11 = value.into(); + self + } + /// Set the `pronouns` field to an Option value (optional) + pub fn maybe_pronouns(mut self, value: Option) -> Self { + self._fields.11 = value; + self + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::Record: actor_view_detailed_state::IsUnset, +{ + /// Set the `record` field (required) + pub fn record( + mut self, + value: impl Into>, + ) -> ActorViewDetailedBuilder, S> { + self._fields.12 = Option::Some(value.into()); + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder { + /// Set the `thingCount` field (optional) + pub fn thing_count(mut self, value: impl Into>) -> Self { + self._fields.13 = value.into(); + self + } + /// Set the `thingCount` field to an Option value (optional) + pub fn maybe_thing_count(mut self, value: Option) -> Self { + self._fields.13 = value; + self + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::Viewer: actor_view_detailed_state::IsUnset, +{ + /// Set the `viewer` field (required) + pub fn viewer( + mut self, + value: impl Into>, + ) -> ActorViewDetailedBuilder, S> { + self._fields.14 = Option::Some(value.into()); + ActorViewDetailedBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ActorViewDetailedBuilder +where + St: actor_view_detailed_state::State, + St::Did: actor_view_detailed_state::IsSet, + St::Handle: actor_view_detailed_state::IsSet, + St::IndexedAt: actor_view_detailed_state::IsSet, + St::Record: actor_view_detailed_state::IsSet, + St::Viewer: actor_view_detailed_state::IsSet, +{ + /// Build the final struct. + pub fn build(self) -> ActorViewDetailed { + ActorViewDetailed { + avatar: self._fields.0, + default_license: self._fields.1, + description: self._fields.2, + did: self._fields.3.unwrap(), + display_name: self._fields.4, + follower_count: self._fields.5, + following_count: self._fields.6, + handle: self._fields.7.unwrap(), + indexed_at: self._fields.8.unwrap(), + links: self._fields.9, + printers: self._fields.10, + pronouns: self._fields.11, + record: self._fields.12.unwrap(), + thing_count: self._fields.13, + viewer: self._fields.14.unwrap(), + extra_data: Default::default(), + } + } + /// Build the final struct with custom extra_data. + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ActorViewDetailed { + ActorViewDetailed { + avatar: self._fields.0, + default_license: self._fields.1, + description: self._fields.2, + did: self._fields.3.unwrap(), + display_name: self._fields.4, + follower_count: self._fields.5, + following_count: self._fields.6, + handle: self._fields.7.unwrap(), + indexed_at: self._fields.8.unwrap(), + links: self._fields.9, + printers: self._fields.10, + pronouns: self._fields.11, + record: self._fields.12.unwrap(), + thing_count: self._fields.13, + viewer: self._fields.14.unwrap(), + extra_data: Some(extra_data), + } + } +} + pub mod aspect_ratio_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1732,7 +2803,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> AspectRatio { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> AspectRatio { AspectRatio { height: self._fields.0.unwrap(), width: self._fields.1.unwrap(), @@ -1743,7 +2817,7 @@ where pub mod chunk_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -1867,7 +2941,10 @@ where St::Offset: chunk_state::IsUnset, { /// Set the `offset` field (required) - pub fn offset(mut self, value: impl Into) -> ChunkBuilder, S> { + pub fn offset( + mut self, + value: impl Into, + ) -> ChunkBuilder, S> { self._fields.1 = Option::Some(value.into()); ChunkBuilder { _state: PhantomData, @@ -1883,7 +2960,10 @@ where St::Size: chunk_state::IsUnset, { /// Set the `size` field (required) - pub fn size(mut self, value: impl Into) -> ChunkBuilder, S> { + pub fn size( + mut self, + value: impl Into, + ) -> ChunkBuilder, S> { self._fields.2 = Option::Some(value.into()); ChunkBuilder { _state: PhantomData, @@ -1922,7 +3002,7 @@ where pub mod feed_item_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2037,7 +3117,7 @@ where pub mod feed_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2167,7 +3247,7 @@ where pub mod file_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2226,12 +3306,7 @@ pub mod file_state { /// Builder for constructing an instance of this type. pub struct FileBuilder { _state: PhantomData St>, - _fields: ( - Option>>, - Option, - Option, - Option, - ), + _fields: (Option>>, Option, Option, Option), _type: PhantomData S>, } @@ -2309,7 +3384,10 @@ where St::MimeType: file_state::IsUnset, { /// Set the `mimeType` field (required) - pub fn mime_type(mut self, value: impl Into) -> FileBuilder, S> { + pub fn mime_type( + mut self, + value: impl Into, + ) -> FileBuilder, S> { self._fields.2 = Option::Some(value.into()); FileBuilder { _state: PhantomData, @@ -2325,7 +3403,10 @@ where St::Size: file_state::IsUnset, { /// Set the `size` field (required) - pub fn size(mut self, value: impl Into) -> FileBuilder, S> { + pub fn size( + mut self, + value: impl Into, + ) -> FileBuilder, S> { self._fields.3 = Option::Some(value.into()); FileBuilder { _state: PhantomData, @@ -2366,7 +3447,7 @@ where pub mod image_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2425,11 +3506,7 @@ pub mod image_state { /// Builder for constructing an instance of this type. pub struct ImageBuilder { _state: PhantomData St>, - _fields: ( - Option, - Option>, - Option>, - ), + _fields: (Option, Option>, Option>), _type: PhantomData S>, } @@ -2475,7 +3552,10 @@ where St::Alt: image_state::IsUnset, { /// Set the `alt` field (required) - pub fn alt(mut self, value: impl Into) -> ImageBuilder, S> { + pub fn alt( + mut self, + value: impl Into, + ) -> ImageBuilder, S> { self._fields.0 = Option::Some(value.into()); ImageBuilder { _state: PhantomData, @@ -2552,7 +3632,7 @@ where pub mod image_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2657,7 +3737,10 @@ impl ImageViewBuilder { impl ImageViewBuilder { /// Set the `aspectRatio` field (optional) - pub fn aspect_ratio(mut self, value: impl Into>>) -> Self { + pub fn aspect_ratio( + mut self, + value: impl Into>>, + ) -> Self { self._fields.1 = value.into(); self } @@ -2723,7 +3806,10 @@ where } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ImageView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ImageView { ImageView { alt: self._fields.0, aspect_ratio: self._fields.1, @@ -2736,7 +3822,7 @@ where pub mod model_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -2747,8 +3833,11 @@ pub mod model_view_state { type Author; type Cid; type IndexedAt; + type Name; + type PartCount; type Record; type Uri; + type Viewer; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -2757,8 +3846,11 @@ pub mod model_view_state { type Author = Unset; type Cid = Unset; type IndexedAt = Unset; + type Name = Unset; + type PartCount = Unset; type Record = Unset; type Uri = Unset; + type Viewer = Unset; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData St>); @@ -2767,8 +3859,11 @@ pub mod model_view_state { type Author = Set; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData St>); @@ -2777,8 +3872,11 @@ pub mod model_view_state { type Author = St::Author; type Cid = Set; type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData St>); @@ -2787,8 +3885,37 @@ pub mod model_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = Set; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData St>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type Name = Set; + type PartCount = St::PartCount; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `part_count` field to Set + pub struct SetPartCount(PhantomData St>); + impl sealed::Sealed for SetPartCount {} + impl State for SetPartCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = Set; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData St>); @@ -2797,8 +3924,11 @@ pub mod model_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = St::PartCount; type Record = Set; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData St>); @@ -2807,8 +3937,24 @@ pub mod model_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; type Uri = Set; + type Viewer = St::Viewer; + } + ///State transition - sets the `viewer` field to Set + pub struct SetViewer(PhantomData St>); + impl sealed::Sealed for SetViewer {} + impl State for SetViewer { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = Set; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -2819,10 +3965,16 @@ pub mod model_view_state { pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `part_count` field + pub struct part_count(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `viewer` field + pub struct viewer(()); } } @@ -2864,9 +4016,7 @@ impl ModelViewBuilder { pub fn new() -> Self { ModelViewBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -2877,9 +4027,7 @@ impl ModelViewBuilder { pub fn builder() -> Self { ModelViewBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -2910,7 +4058,10 @@ where St::Cid: model_view_state::IsUnset, { /// Set the `cid` field (required) - pub fn cid(mut self, value: impl Into) -> ModelViewBuilder, S> { + pub fn cid( + mut self, + value: impl Into, + ) -> ModelViewBuilder, S> { self._fields.1 = Option::Some(value.into()); ModelViewBuilder { _state: PhantomData, @@ -2922,7 +4073,10 @@ where impl ModelViewBuilder { /// Set the `cover` field (optional) - pub fn cover(mut self, value: impl Into>>>) -> Self { + pub fn cover( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.2 = value.into(); self } @@ -2952,35 +4106,50 @@ where } } -impl ModelViewBuilder { - /// Set the `name` field (optional) - pub fn name(mut self, value: impl Into>) -> Self { - self._fields.4 = value.into(); - self - } - /// Set the `name` field to an Option value (optional) - pub fn maybe_name(mut self, value: Option) -> Self { - self._fields.4 = value; - self +impl ModelViewBuilder +where + St: model_view_state::State, + St::Name: model_view_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into, + ) -> ModelViewBuilder, S> { + self._fields.4 = Option::Some(value.into()); + ModelViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ModelViewBuilder { - /// Set the `partCount` field (optional) - pub fn part_count(mut self, value: impl Into>) -> Self { - self._fields.5 = value.into(); - self - } - /// Set the `partCount` field to an Option value (optional) - pub fn maybe_part_count(mut self, value: Option) -> Self { - self._fields.5 = value; - self +impl ModelViewBuilder +where + St: model_view_state::State, + St::PartCount: model_view_state::IsUnset, +{ + /// Set the `partCount` field (required) + pub fn part_count( + mut self, + value: impl Into, + ) -> ModelViewBuilder, S> { + self._fields.5 = Option::Some(value.into()); + ModelViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl ModelViewBuilder { /// Set the `previews` field (optional) - pub fn previews(mut self, value: impl Into>>>) -> Self { + pub fn previews( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.6 = value.into(); self } @@ -3031,9 +4200,28 @@ where /// Set the `uri` field (required) pub fn uri( mut self, - value: impl Into>, - ) -> ModelViewBuilder, S> { - self._fields.9 = Option::Some(value.into()); + value: impl Into>, + ) -> ModelViewBuilder, S> { + self._fields.9 = Option::Some(value.into()); + ModelViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ModelViewBuilder +where + St: model_view_state::State, + St::Viewer: model_view_state::IsUnset, +{ + /// Set the `viewer` field (required) + pub fn viewer( + mut self, + value: impl Into>, + ) -> ModelViewBuilder, S> { + self._fields.10 = Option::Some(value.into()); ModelViewBuilder { _state: PhantomData, _fields: self._fields, @@ -3042,27 +4230,17 @@ where } } -impl ModelViewBuilder { - /// Set the `viewer` field (optional) - pub fn viewer(mut self, value: impl Into>>) -> Self { - self._fields.10 = value.into(); - self - } - /// Set the `viewer` field to an Option value (optional) - pub fn maybe_viewer(mut self, value: Option>) -> Self { - self._fields.10 = value; - self - } -} - impl ModelViewBuilder where St: model_view_state::State, St::Author: model_view_state::IsSet, St::Cid: model_view_state::IsSet, St::IndexedAt: model_view_state::IsSet, + St::Name: model_view_state::IsSet, + St::PartCount: model_view_state::IsSet, St::Record: model_view_state::IsSet, St::Uri: model_view_state::IsSet, + St::Viewer: model_view_state::IsSet, { /// Build the final struct. pub fn build(self) -> ModelView { @@ -3071,30 +4249,33 @@ where cid: self._fields.1.unwrap(), cover: self._fields.2, indexed_at: self._fields.3.unwrap(), - name: self._fields.4, - part_count: self._fields.5, + name: self._fields.4.unwrap(), + part_count: self._fields.5.unwrap(), previews: self._fields.6, record: self._fields.7.unwrap(), summary: self._fields.8, uri: self._fields.9.unwrap(), - viewer: self._fields.10, + viewer: self._fields.10.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ModelView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ModelView { ModelView { author: self._fields.0.unwrap(), cid: self._fields.1.unwrap(), cover: self._fields.2, indexed_at: self._fields.3.unwrap(), - name: self._fields.4, - part_count: self._fields.5, + name: self._fields.4.unwrap(), + part_count: self._fields.5.unwrap(), previews: self._fields.6, record: self._fields.7.unwrap(), summary: self._fields.8, uri: self._fields.9.unwrap(), - viewer: self._fields.10, + viewer: self._fields.10.unwrap(), extra_data: Some(extra_data), } } @@ -3102,7 +4283,7 @@ where pub mod part_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -3112,9 +4293,12 @@ pub mod part_view_state { pub trait State: sealed::Sealed { type Author; type Cid; + type File; type IndexedAt; + type Name; type Record; type Uri; + type Viewer; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -3122,9 +4306,12 @@ pub mod part_view_state { impl State for Empty { type Author = Unset; type Cid = Unset; + type File = Unset; type IndexedAt = Unset; + type Name = Unset; type Record = Unset; type Uri = Unset; + type Viewer = Unset; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData St>); @@ -3132,9 +4319,12 @@ pub mod part_view_state { impl State for SetAuthor { type Author = Set; type Cid = St::Cid; + type File = St::File; type IndexedAt = St::IndexedAt; + type Name = St::Name; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData St>); @@ -3142,9 +4332,25 @@ pub mod part_view_state { impl State for SetCid { type Author = St::Author; type Cid = Set; + type File = St::File; type IndexedAt = St::IndexedAt; + type Name = St::Name; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `file` field to Set + pub struct SetFile(PhantomData St>); + impl sealed::Sealed for SetFile {} + impl State for SetFile { + type Author = St::Author; + type Cid = St::Cid; + type File = Set; + type IndexedAt = St::IndexedAt; + type Name = St::Name; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData St>); @@ -3152,9 +4358,25 @@ pub mod part_view_state { impl State for SetIndexedAt { type Author = St::Author; type Cid = St::Cid; + type File = St::File; type IndexedAt = Set; + type Name = St::Name; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData St>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Author = St::Author; + type Cid = St::Cid; + type File = St::File; + type IndexedAt = St::IndexedAt; + type Name = Set; type Record = St::Record; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData St>); @@ -3162,9 +4384,12 @@ pub mod part_view_state { impl State for SetRecord { type Author = St::Author; type Cid = St::Cid; + type File = St::File; type IndexedAt = St::IndexedAt; + type Name = St::Name; type Record = Set; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData St>); @@ -3172,9 +4397,25 @@ pub mod part_view_state { impl State for SetUri { type Author = St::Author; type Cid = St::Cid; + type File = St::File; type IndexedAt = St::IndexedAt; + type Name = St::Name; type Record = St::Record; type Uri = Set; + type Viewer = St::Viewer; + } + ///State transition - sets the `viewer` field to Set + pub struct SetViewer(PhantomData St>); + impl sealed::Sealed for SetViewer {} + impl State for SetViewer { + type Author = St::Author; + type Cid = St::Cid; + type File = St::File; + type IndexedAt = St::IndexedAt; + type Name = St::Name; + type Record = St::Record; + type Uri = St::Uri; + type Viewer = Set; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -3183,12 +4424,18 @@ pub mod part_view_state { pub struct author(()); ///Marker type for the `cid` field pub struct cid(()); + ///Marker type for the `file` field + pub struct file(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `name` field + pub struct name(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `viewer` field + pub struct viewer(()); } } @@ -3271,7 +4518,10 @@ where St::Cid: part_view_state::IsUnset, { /// Set the `cid` field (required) - pub fn cid(mut self, value: impl Into) -> PartViewBuilder, S> { + pub fn cid( + mut self, + value: impl Into, + ) -> PartViewBuilder, S> { self._fields.1 = Option::Some(value.into()); PartViewBuilder { _state: PhantomData, @@ -3281,16 +4531,22 @@ where } } -impl PartViewBuilder { - /// Set the `file` field (optional) - pub fn file(mut self, value: impl Into>>) -> Self { - self._fields.2 = value.into(); - self - } - /// Set the `file` field to an Option value (optional) - pub fn maybe_file(mut self, value: Option>) -> Self { - self._fields.2 = value; - self +impl PartViewBuilder +where + St: part_view_state::State, + St::File: part_view_state::IsUnset, +{ + /// Set the `file` field (required) + pub fn file( + mut self, + value: impl Into>, + ) -> PartViewBuilder, S> { + self._fields.2 = Option::Some(value.into()); + PartViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } @@ -3326,22 +4582,31 @@ where } } -impl PartViewBuilder { - /// Set the `name` field (optional) - pub fn name(mut self, value: impl Into>) -> Self { - self._fields.5 = value.into(); - self - } - /// Set the `name` field to an Option value (optional) - pub fn maybe_name(mut self, value: Option) -> Self { - self._fields.5 = value; - self +impl PartViewBuilder +where + St: part_view_state::State, + St::Name: part_view_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into, + ) -> PartViewBuilder, S> { + self._fields.5 = Option::Some(value.into()); + PartViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl PartViewBuilder { /// Set the `previews` field (optional) - pub fn previews(mut self, value: impl Into>>>) -> Self { + pub fn previews( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.6 = value.into(); self } @@ -3390,16 +4655,22 @@ where } } -impl PartViewBuilder { - /// Set the `viewer` field (optional) - pub fn viewer(mut self, value: impl Into>>) -> Self { - self._fields.9 = value.into(); - self - } - /// Set the `viewer` field to an Option value (optional) - pub fn maybe_viewer(mut self, value: Option>) -> Self { - self._fields.9 = value; - self +impl PartViewBuilder +where + St: part_view_state::State, + St::Viewer: part_view_state::IsUnset, +{ + /// Set the `viewer` field (required) + pub fn viewer( + mut self, + value: impl Into>, + ) -> PartViewBuilder, S> { + self._fields.9 = Option::Some(value.into()); + PartViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } @@ -3408,23 +4679,26 @@ where St: part_view_state::State, St::Author: part_view_state::IsSet, St::Cid: part_view_state::IsSet, + St::File: part_view_state::IsSet, St::IndexedAt: part_view_state::IsSet, + St::Name: part_view_state::IsSet, St::Record: part_view_state::IsSet, St::Uri: part_view_state::IsSet, + St::Viewer: part_view_state::IsSet, { /// Build the final struct. pub fn build(self) -> PartView { PartView { author: self._fields.0.unwrap(), cid: self._fields.1.unwrap(), - file: self._fields.2, + file: self._fields.2.unwrap(), format: self._fields.3, indexed_at: self._fields.4.unwrap(), - name: self._fields.5, + name: self._fields.5.unwrap(), previews: self._fields.6, record: self._fields.7.unwrap(), uri: self._fields.8.unwrap(), - viewer: self._fields.9, + viewer: self._fields.9.unwrap(), extra_data: Default::default(), } } @@ -3433,14 +4707,14 @@ where PartView { author: self._fields.0.unwrap(), cid: self._fields.1.unwrap(), - file: self._fields.2, + file: self._fields.2.unwrap(), format: self._fields.3, indexed_at: self._fields.4.unwrap(), - name: self._fields.5, + name: self._fields.5.unwrap(), previews: self._fields.6, record: self._fields.7.unwrap(), uri: self._fields.8.unwrap(), - viewer: self._fields.9, + viewer: self._fields.9.unwrap(), extra_data: Some(extra_data), } } @@ -3448,7 +4722,7 @@ where pub mod thing_view_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -3459,8 +4733,15 @@ pub mod thing_view_state { type Author; type Cid; type IndexedAt; + type License; + type LikeCount; + type ModelCount; + type Name; + type PartCount; type Record; + type SaveCount; type Uri; + type Viewer; } /// Empty state - all required fields are unset pub struct Empty(()); @@ -3469,8 +4750,15 @@ pub mod thing_view_state { type Author = Unset; type Cid = Unset; type IndexedAt = Unset; + type License = Unset; + type LikeCount = Unset; + type ModelCount = Unset; + type Name = Unset; + type PartCount = Unset; type Record = Unset; + type SaveCount = Unset; type Uri = Unset; + type Viewer = Unset; } ///State transition - sets the `author` field to Set pub struct SetAuthor(PhantomData St>); @@ -3479,8 +4767,15 @@ pub mod thing_view_state { type Author = Set; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; + type SaveCount = St::SaveCount; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData St>); @@ -3489,8 +4784,15 @@ pub mod thing_view_state { type Author = St::Author; type Cid = Set; type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; + type SaveCount = St::SaveCount; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData St>); @@ -3499,8 +4801,100 @@ pub mod thing_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = Set; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `license` field to Set + pub struct SetLicense(PhantomData St>); + impl sealed::Sealed for SetLicense {} + impl State for SetLicense { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = Set; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `like_count` field to Set + pub struct SetLikeCount(PhantomData St>); + impl sealed::Sealed for SetLikeCount {} + impl State for SetLikeCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = Set; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `model_count` field to Set + pub struct SetModelCount(PhantomData St>); + impl sealed::Sealed for SetModelCount {} + impl State for SetModelCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = Set; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData St>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = Set; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `part_count` field to Set + pub struct SetPartCount(PhantomData St>); + impl sealed::Sealed for SetPartCount {} + impl State for SetPartCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = Set; type Record = St::Record; + type SaveCount = St::SaveCount; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData St>); @@ -3509,8 +4903,32 @@ pub mod thing_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; type Record = Set; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `save_count` field to Set + pub struct SetSaveCount(PhantomData St>); + impl sealed::Sealed for SetSaveCount {} + impl State for SetSaveCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = Set; type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData St>); @@ -3519,8 +4937,32 @@ pub mod thing_view_state { type Author = St::Author; type Cid = St::Cid; type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; type Record = St::Record; + type SaveCount = St::SaveCount; type Uri = Set; + type Viewer = St::Viewer; + } + ///State transition - sets the `viewer` field to Set + pub struct SetViewer(PhantomData St>); + impl sealed::Sealed for SetViewer {} + impl State for SetViewer { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type License = St::License; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type Record = St::Record; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = Set; } /// Marker types for field names #[allow(non_camel_case_types)] @@ -3531,10 +4973,24 @@ pub mod thing_view_state { pub struct cid(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); + ///Marker type for the `license` field + pub struct license(()); + ///Marker type for the `like_count` field + pub struct like_count(()); + ///Marker type for the `model_count` field + pub struct model_count(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `part_count` field + pub struct part_count(()); ///Marker type for the `record` field pub struct record(()); + ///Marker type for the `save_count` field + pub struct save_count(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `viewer` field + pub struct viewer(()); } } @@ -3552,6 +5008,7 @@ pub struct ThingViewBuilder Option, Option, Option, + Option, Option>>, Option>, Option, @@ -3583,8 +5040,24 @@ impl ThingViewBuilder { ThingViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, None, - None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -3597,8 +5070,24 @@ impl ThingViewBuilder { ThingViewBuilder { _state: PhantomData, _fields: ( - None, None, None, None, None, None, None, None, None, None, None, None, None, None, - None, None, None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, ), _type: PhantomData, } @@ -3630,7 +5119,10 @@ where St::Cid: thing_view_state::IsUnset, { /// Set the `cid` field (required) - pub fn cid(mut self, value: impl Into) -> ThingViewBuilder, S> { + pub fn cid( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { self._fields.1 = Option::Some(value.into()); ThingViewBuilder { _state: PhantomData, @@ -3642,7 +5134,10 @@ where impl ThingViewBuilder { /// Set the `cover` field (optional) - pub fn cover(mut self, value: impl Into>>>) -> Self { + pub fn cover( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.2 = value.into(); self } @@ -3687,78 +5182,130 @@ where impl ThingViewBuilder { /// Set the `intendedToWorkWith` field (optional) - pub fn intended_to_work_with(mut self, value: impl Into>>>) -> Self { + pub fn intended_to_work_with( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.5 = value.into(); self } /// Set the `intendedToWorkWith` field to an Option value (optional) - pub fn maybe_intended_to_work_with(mut self, value: Option>>) -> Self { + pub fn maybe_intended_to_work_with( + mut self, + value: Option>>, + ) -> Self { self._fields.5 = value; self } } -impl ThingViewBuilder { - /// Set the `license` field (optional) - pub fn license(mut self, value: impl Into>) -> Self { - self._fields.6 = value.into(); - self - } - /// Set the `license` field to an Option value (optional) - pub fn maybe_license(mut self, value: Option) -> Self { - self._fields.6 = value; - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::License: thing_view_state::IsUnset, +{ + /// Set the `license` field (required) + pub fn license( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.6 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBuilder { - /// Set the `likeCount` field (optional) - pub fn like_count(mut self, value: impl Into>) -> Self { - self._fields.7 = value.into(); - self - } - /// Set the `likeCount` field to an Option value (optional) - pub fn maybe_like_count(mut self, value: Option) -> Self { - self._fields.7 = value; - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::LikeCount: thing_view_state::IsUnset, +{ + /// Set the `likeCount` field (required) + pub fn like_count( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.7 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBuilder { - /// Set the `modelCount` field (optional) - pub fn model_count(mut self, value: impl Into>) -> Self { - self._fields.8 = value.into(); - self - } - /// Set the `modelCount` field to an Option value (optional) - pub fn maybe_model_count(mut self, value: Option) -> Self { - self._fields.8 = value; - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::ModelCount: thing_view_state::IsUnset, +{ + /// Set the `modelCount` field (required) + pub fn model_count( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.8 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBuilder { - /// Set the `name` field (optional) - pub fn name(mut self, value: impl Into>) -> Self { - self._fields.9 = value.into(); - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::Name: thing_view_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.9 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } - /// Set the `name` field to an Option value (optional) - pub fn maybe_name(mut self, value: Option) -> Self { - self._fields.9 = value; - self +} + +impl ThingViewBuilder +where + St: thing_view_state::State, + St::PartCount: thing_view_state::IsUnset, +{ + /// Set the `partCount` field (required) + pub fn part_count( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.10 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl ThingViewBuilder { /// Set the `previews` field (optional) - pub fn previews(mut self, value: impl Into>>>) -> Self { - self._fields.10 = value.into(); + pub fn previews( + mut self, + value: impl Into>>>, + ) -> Self { + self._fields.11 = value.into(); self } /// Set the `previews` field to an Option value (optional) pub fn maybe_previews(mut self, value: Option>>) -> Self { - self._fields.10 = value; + self._fields.11 = value; self } } @@ -3773,7 +5320,7 @@ where mut self, value: impl Into>, ) -> ThingViewBuilder, S> { - self._fields.11 = Option::Some(value.into()); + self._fields.12 = Option::Some(value.into()); ThingViewBuilder { _state: PhantomData, _fields: self._fields, @@ -3782,28 +5329,34 @@ where } } -impl ThingViewBuilder { - /// Set the `saveCount` field (optional) - pub fn save_count(mut self, value: impl Into>) -> Self { - self._fields.12 = value.into(); - self - } - /// Set the `saveCount` field to an Option value (optional) - pub fn maybe_save_count(mut self, value: Option) -> Self { - self._fields.12 = value; - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::SaveCount: thing_view_state::IsUnset, +{ + /// Set the `saveCount` field (required) + pub fn save_count( + mut self, + value: impl Into, + ) -> ThingViewBuilder, S> { + self._fields.13 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl ThingViewBuilder { /// Set the `summary` field (optional) pub fn summary(mut self, value: impl Into>) -> Self { - self._fields.13 = value.into(); + self._fields.14 = value.into(); self } /// Set the `summary` field to an Option value (optional) pub fn maybe_summary(mut self, value: Option) -> Self { - self._fields.13 = value; + self._fields.14 = value; self } } @@ -3811,12 +5364,12 @@ impl ThingViewBuilder { impl ThingViewBuilder { /// Set the `tags` field (optional) pub fn tags(mut self, value: impl Into>>) -> Self { - self._fields.14 = value.into(); + self._fields.15 = value.into(); self } /// Set the `tags` field to an Option value (optional) pub fn maybe_tags(mut self, value: Option>) -> Self { - self._fields.14 = value; + self._fields.15 = value; self } } @@ -3831,7 +5384,7 @@ where mut self, value: impl Into>, ) -> ThingViewBuilder, S> { - self._fields.15 = Option::Some(value.into()); + self._fields.16 = Option::Some(value.into()); ThingViewBuilder { _state: PhantomData, _fields: self._fields, @@ -3840,16 +5393,22 @@ where } } -impl ThingViewBuilder { - /// Set the `viewer` field (optional) - pub fn viewer(mut self, value: impl Into>>) -> Self { - self._fields.16 = value.into(); - self - } - /// Set the `viewer` field to an Option value (optional) - pub fn maybe_viewer(mut self, value: Option>) -> Self { - self._fields.16 = value; - self +impl ThingViewBuilder +where + St: thing_view_state::State, + St::Viewer: thing_view_state::IsUnset, +{ + /// Set the `viewer` field (required) + pub fn viewer( + mut self, + value: impl Into>, + ) -> ThingViewBuilder, S> { + self._fields.17 = Option::Some(value.into()); + ThingViewBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } @@ -3859,8 +5418,15 @@ where St::Author: thing_view_state::IsSet, St::Cid: thing_view_state::IsSet, St::IndexedAt: thing_view_state::IsSet, + St::License: thing_view_state::IsSet, + St::LikeCount: thing_view_state::IsSet, + St::ModelCount: thing_view_state::IsSet, + St::Name: thing_view_state::IsSet, + St::PartCount: thing_view_state::IsSet, St::Record: thing_view_state::IsSet, + St::SaveCount: thing_view_state::IsSet, St::Uri: thing_view_state::IsSet, + St::Viewer: thing_view_state::IsSet, { /// Build the final struct. pub fn build(self) -> ThingView { @@ -3871,22 +5437,26 @@ where derived_from: self._fields.3, indexed_at: self._fields.4.unwrap(), intended_to_work_with: self._fields.5, - license: self._fields.6, - like_count: self._fields.7, - model_count: self._fields.8, - name: self._fields.9, - previews: self._fields.10, - record: self._fields.11.unwrap(), - save_count: self._fields.12, - summary: self._fields.13, - tags: self._fields.14, - uri: self._fields.15.unwrap(), - viewer: self._fields.16, + license: self._fields.6.unwrap(), + like_count: self._fields.7.unwrap(), + model_count: self._fields.8.unwrap(), + name: self._fields.9.unwrap(), + part_count: self._fields.10.unwrap(), + previews: self._fields.11, + record: self._fields.12.unwrap(), + save_count: self._fields.13.unwrap(), + summary: self._fields.14, + tags: self._fields.15, + uri: self._fields.16.unwrap(), + viewer: self._fields.17.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ThingView { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ThingView { ThingView { author: self._fields.0.unwrap(), cid: self._fields.1.unwrap(), @@ -3894,17 +5464,18 @@ where derived_from: self._fields.3, indexed_at: self._fields.4.unwrap(), intended_to_work_with: self._fields.5, - license: self._fields.6, - like_count: self._fields.7, - model_count: self._fields.8, - name: self._fields.9, - previews: self._fields.10, - record: self._fields.11.unwrap(), - save_count: self._fields.12, - summary: self._fields.13, - tags: self._fields.14, - uri: self._fields.15.unwrap(), - viewer: self._fields.16, + license: self._fields.6.unwrap(), + like_count: self._fields.7.unwrap(), + model_count: self._fields.8.unwrap(), + name: self._fields.9.unwrap(), + part_count: self._fields.10.unwrap(), + previews: self._fields.11, + record: self._fields.12.unwrap(), + save_count: self._fields.13.unwrap(), + summary: self._fields.14, + tags: self._fields.15, + uri: self._fields.16.unwrap(), + viewer: self._fields.17.unwrap(), extra_data: Some(extra_data), } } @@ -3912,7 +5483,7 @@ where pub mod thing_view_basic_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -3920,30 +5491,213 @@ pub mod thing_view_basic_state { } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { + type Author; + type Cid; + type IndexedAt; + type LikeCount; + type ModelCount; + type Name; + type PartCount; + type SaveCount; type Uri; + type Viewer; } /// 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 LikeCount = Unset; + type ModelCount = Unset; + type Name = Unset; + type PartCount = Unset; + type SaveCount = Unset; type Uri = Unset; + type Viewer = Unset; + } + ///State transition - sets the `author` field to Set + pub struct SetAuthor(PhantomData St>); + impl sealed::Sealed for SetAuthor {} + impl State for SetAuthor { + type Author = Set; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `cid` field to Set + pub struct SetCid(PhantomData St>); + impl sealed::Sealed for SetCid {} + impl State for SetCid { + type Author = St::Author; + type Cid = Set; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `indexed_at` field to Set + pub struct SetIndexedAt(PhantomData St>); + impl sealed::Sealed for SetIndexedAt {} + impl State for SetIndexedAt { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = Set; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `like_count` field to Set + pub struct SetLikeCount(PhantomData St>); + impl sealed::Sealed for SetLikeCount {} + impl State for SetLikeCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = Set; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `model_count` field to Set + pub struct SetModelCount(PhantomData St>); + impl sealed::Sealed for SetModelCount {} + impl State for SetModelCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = Set; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `name` field to Set + pub struct SetName(PhantomData St>); + impl sealed::Sealed for SetName {} + impl State for SetName { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = Set; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `part_count` field to Set + pub struct SetPartCount(PhantomData St>); + impl sealed::Sealed for SetPartCount {} + impl State for SetPartCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = Set; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = St::Viewer; + } + ///State transition - sets the `save_count` field to Set + pub struct SetSaveCount(PhantomData St>); + impl sealed::Sealed for SetSaveCount {} + impl State for SetSaveCount { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = Set; + type Uri = St::Uri; + type Viewer = St::Viewer; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData St>); impl sealed::Sealed for SetUri {} impl State for SetUri { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; type Uri = Set; + type Viewer = St::Viewer; + } + ///State transition - sets the `viewer` field to Set + pub struct SetViewer(PhantomData St>); + impl sealed::Sealed for SetViewer {} + impl State for SetViewer { + type Author = St::Author; + type Cid = St::Cid; + type IndexedAt = St::IndexedAt; + type LikeCount = St::LikeCount; + type ModelCount = St::ModelCount; + type Name = St::Name; + type PartCount = St::PartCount; + type SaveCount = St::SaveCount; + type Uri = St::Uri; + type Viewer = Set; } /// 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 `like_count` field + pub struct like_count(()); + ///Marker type for the `model_count` field + pub struct model_count(()); + ///Marker type for the `name` field + pub struct name(()); + ///Marker type for the `part_count` field + pub struct part_count(()); + ///Marker type for the `save_count` field + pub struct save_count(()); ///Marker type for the `uri` field pub struct uri(()); + ///Marker type for the `viewer` field + pub struct viewer(()); } } /// Builder for constructing an instance of this type. -pub struct ThingViewBasicBuilder { +pub struct ThingViewBasicBuilder< + St: thing_view_basic_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: ( Option>, @@ -3953,9 +5707,12 @@ pub struct ThingViewBasicBuilder, Option, Option, + Option, Option>>, Option, + Option>, Option>, + Option>, ), _type: PhantomData S>, } @@ -3979,7 +5736,21 @@ impl ThingViewBasicBuilder { pub fn new() -> Self { ThingViewBasicBuilder { _state: PhantomData, - _fields: (None, None, None, None, None, None, None, None, None, None), + _fields: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), _type: PhantomData, } } @@ -3990,41 +5761,70 @@ impl ThingViewBasicBuilder { pub fn builder() -> Self { ThingViewBasicBuilder { _state: PhantomData, - _fields: (None, None, None, None, None, None, None, None, None, None), + _fields: ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ), _type: PhantomData, } } } -impl ThingViewBasicBuilder { - /// Set the `author` field (optional) - pub fn author(mut self, value: impl Into>>) -> Self { - self._fields.0 = value.into(); - self - } - /// Set the `author` field to an Option value (optional) - pub fn maybe_author(mut self, value: Option>) -> Self { - self._fields.0 = value; - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::Author: thing_view_basic_state::IsUnset, +{ + /// Set the `author` field (required) + pub fn author( + mut self, + value: impl Into>, + ) -> ThingViewBasicBuilder, S> { + self._fields.0 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBasicBuilder { - /// Set the `cid` field (optional) - pub fn cid(mut self, value: impl Into>) -> Self { - self._fields.1 = value.into(); - self - } - /// Set the `cid` field to an Option value (optional) - pub fn maybe_cid(mut self, value: Option) -> Self { - self._fields.1 = value; - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::Cid: thing_view_basic_state::IsUnset, +{ + /// Set the `cid` field (required) + pub fn cid( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.1 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl ThingViewBasicBuilder { /// Set the `cover` field (optional) - pub fn cover(mut self, value: impl Into>>>) -> Self { + pub fn cover( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.2 = value.into(); self } @@ -4035,80 +5835,145 @@ impl ThingViewBasicBuilder } } -impl ThingViewBasicBuilder { - /// Set the `indexedAt` field (optional) - pub fn indexed_at(mut self, value: impl Into>) -> Self { - self._fields.3 = value.into(); - self - } - /// Set the `indexedAt` field to an Option value (optional) - pub fn maybe_indexed_at(mut self, value: Option) -> Self { - self._fields.3 = value; - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::IndexedAt: thing_view_basic_state::IsUnset, +{ + /// Set the `indexedAt` field (required) + pub fn indexed_at( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.3 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBasicBuilder { - /// Set the `likeCount` field (optional) - pub fn like_count(mut self, value: impl Into>) -> Self { - self._fields.4 = value.into(); - self - } - /// Set the `likeCount` field to an Option value (optional) - pub fn maybe_like_count(mut self, value: Option) -> Self { - self._fields.4 = value; - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::LikeCount: thing_view_basic_state::IsUnset, +{ + /// Set the `likeCount` field (required) + pub fn like_count( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.4 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBasicBuilder { - /// Set the `modelCount` field (optional) - pub fn model_count(mut self, value: impl Into>) -> Self { - self._fields.5 = value.into(); - self - } - /// Set the `modelCount` field to an Option value (optional) - pub fn maybe_model_count(mut self, value: Option) -> Self { - self._fields.5 = value; - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::ModelCount: thing_view_basic_state::IsUnset, +{ + /// Set the `modelCount` field (required) + pub fn model_count( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.5 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } -impl ThingViewBasicBuilder { - /// Set the `name` field (optional) - pub fn name(mut self, value: impl Into>) -> Self { - self._fields.6 = value.into(); - self +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::Name: thing_view_basic_state::IsUnset, +{ + /// Set the `name` field (required) + pub fn name( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.6 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } - /// Set the `name` field to an Option value (optional) - pub fn maybe_name(mut self, value: Option) -> Self { - self._fields.6 = value; - self +} + +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::PartCount: thing_view_basic_state::IsUnset, +{ + /// Set the `partCount` field (required) + pub fn part_count( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.7 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } } } impl ThingViewBasicBuilder { /// Set the `previews` field (optional) - pub fn previews(mut self, value: impl Into>>>) -> Self { - self._fields.7 = value.into(); + pub fn previews( + mut self, + value: impl Into>>>, + ) -> Self { + self._fields.8 = value.into(); self } /// Set the `previews` field to an Option value (optional) pub fn maybe_previews(mut self, value: Option>>) -> Self { - self._fields.7 = value; + self._fields.8 = value; self } } +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::SaveCount: thing_view_basic_state::IsUnset, +{ + /// Set the `saveCount` field (required) + pub fn save_count( + mut self, + value: impl Into, + ) -> ThingViewBasicBuilder, S> { + self._fields.9 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + impl ThingViewBasicBuilder { - /// Set the `saveCount` field (optional) - pub fn save_count(mut self, value: impl Into>) -> Self { - self._fields.8 = value.into(); + /// Set the `tags` field (optional) + pub fn tags(mut self, value: impl Into>>) -> Self { + self._fields.10 = value.into(); self } - /// Set the `saveCount` field to an Option value (optional) - pub fn maybe_save_count(mut self, value: Option) -> Self { - self._fields.8 = value; + /// Set the `tags` field to an Option value (optional) + pub fn maybe_tags(mut self, value: Option>) -> Self { + self._fields.10 = value; self } } @@ -4123,7 +5988,26 @@ where mut self, value: impl Into>, ) -> ThingViewBasicBuilder, S> { - self._fields.9 = Option::Some(value.into()); + self._fields.11 = Option::Some(value.into()); + ThingViewBasicBuilder { + _state: PhantomData, + _fields: self._fields, + _type: PhantomData, + } + } +} + +impl ThingViewBasicBuilder +where + St: thing_view_basic_state::State, + St::Viewer: thing_view_basic_state::IsUnset, +{ + /// Set the `viewer` field (required) + pub fn viewer( + mut self, + value: impl Into>, + ) -> ThingViewBasicBuilder, S> { + self._fields.12 = Option::Some(value.into()); ThingViewBasicBuilder { _state: PhantomData, _fields: self._fields, @@ -4135,38 +6019,56 @@ where impl ThingViewBasicBuilder where St: thing_view_basic_state::State, + St::Author: thing_view_basic_state::IsSet, + St::Cid: thing_view_basic_state::IsSet, + St::IndexedAt: thing_view_basic_state::IsSet, + St::LikeCount: thing_view_basic_state::IsSet, + St::ModelCount: thing_view_basic_state::IsSet, + St::Name: thing_view_basic_state::IsSet, + St::PartCount: thing_view_basic_state::IsSet, + St::SaveCount: thing_view_basic_state::IsSet, St::Uri: thing_view_basic_state::IsSet, + St::Viewer: thing_view_basic_state::IsSet, { /// Build the final struct. pub fn build(self) -> ThingViewBasic { ThingViewBasic { - author: self._fields.0, - cid: self._fields.1, + author: self._fields.0.unwrap(), + cid: self._fields.1.unwrap(), cover: self._fields.2, - indexed_at: self._fields.3, - like_count: self._fields.4, - model_count: self._fields.5, - name: self._fields.6, - previews: self._fields.7, - save_count: self._fields.8, - uri: self._fields.9.unwrap(), + indexed_at: self._fields.3.unwrap(), + like_count: self._fields.4.unwrap(), + model_count: self._fields.5.unwrap(), + name: self._fields.6.unwrap(), + part_count: self._fields.7.unwrap(), + previews: self._fields.8, + save_count: self._fields.9.unwrap(), + tags: self._fields.10, + uri: self._fields.11.unwrap(), + viewer: self._fields.12.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. - pub fn build_with_data(self, extra_data: BTreeMap>) -> ThingViewBasic { + pub fn build_with_data( + self, + extra_data: BTreeMap>, + ) -> ThingViewBasic { ThingViewBasic { - author: self._fields.0, - cid: self._fields.1, + author: self._fields.0.unwrap(), + cid: self._fields.1.unwrap(), cover: self._fields.2, - indexed_at: self._fields.3, - like_count: self._fields.4, - model_count: self._fields.5, - name: self._fields.6, - previews: self._fields.7, - save_count: self._fields.8, - uri: self._fields.9.unwrap(), + indexed_at: self._fields.3.unwrap(), + like_count: self._fields.4.unwrap(), + model_count: self._fields.5.unwrap(), + name: self._fields.6.unwrap(), + part_count: self._fields.7.unwrap(), + previews: self._fields.8, + save_count: self._fields.9.unwrap(), + tags: self._fields.10, + uri: self._fields.11.unwrap(), + viewer: self._fields.12.unwrap(), extra_data: Some(extra_data), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/get_author_things.rs b/crates/polymodel-api/src/space_polymodel/library/get_author_things.rs index 584bfb6..54a5308 100644 --- a/crates/polymodel-api/src/space_polymodel/library/get_author_things.rs +++ b/crates/polymodel-api/src/space_polymodel/library/get_author_things.rs @@ -8,21 +8,18 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::FeedView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::ident::AtIdentifier; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::FeedView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAuthorThings { pub actor: AtIdentifier, #[serde(skip_serializing_if = "Option::is_none")] @@ -33,11 +30,9 @@ pub struct GetAuthorThings { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetAuthorThingsOutput { #[serde(flatten)] pub value: FeedView, @@ -79,7 +74,7 @@ fn _default_limit() -> Option { pub mod get_author_things_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -110,7 +105,10 @@ pub mod get_author_things_state { } /// Builder for constructing an instance of this type. -pub struct GetAuthorThingsBuilder { +pub struct GetAuthorThingsBuilder< + St: get_author_things_state::State, + S: BosStr = DefaultStr, +> { _state: PhantomData St>, _fields: (Option>, Option, Option), _type: PhantomData S>, @@ -210,4 +208,4 @@ where limit: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/get_feed.rs b/crates/polymodel-api/src/space_polymodel/library/get_feed.rs index ed2cebf..9931151 100644 --- a/crates/polymodel-api/src/space_polymodel/library/get_feed.rs +++ b/crates/polymodel-api/src/space_polymodel/library/get_feed.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::FeedView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::FeedView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetFeed { #[serde(skip_serializing_if = "Option::is_none")] pub algorithm: Option, @@ -33,11 +30,9 @@ pub struct GetFeed { pub limit: Option, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetFeedOutput { #[serde(flatten)] pub value: FeedView, @@ -79,7 +74,7 @@ fn _default_limit() -> Option { pub mod get_feed_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -190,4 +185,4 @@ where limit: self._fields.2, } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/get_model.rs b/crates/polymodel-api/src/space_polymodel/library/get_model.rs index b05ba11..b4921e3 100644 --- a/crates/polymodel-api/src/space_polymodel/library/get_model.rs +++ b/crates/polymodel-api/src/space_polymodel/library/get_model.rs @@ -8,32 +8,27 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::ModelView; -use crate::space_polymodel::library::PartView; -use crate::space_polymodel::library::ThingViewBasic; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::AtUri; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::ModelView; +use crate::space_polymodel::library::PartView; +use crate::space_polymodel::library::ThingViewBasic; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetModel { pub uri: AtUri, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetModelOutput { pub model: ModelView, #[serde(skip_serializing_if = "Option::is_none")] @@ -74,7 +69,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetModelRequest { pub mod get_model_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -177,4 +172,4 @@ where uri: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/get_thing.rs b/crates/polymodel-api/src/space_polymodel/library/get_thing.rs index f2219c6..31f554b 100644 --- a/crates/polymodel-api/src/space_polymodel/library/get_thing.rs +++ b/crates/polymodel-api/src/space_polymodel/library/get_thing.rs @@ -8,31 +8,26 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::ModelView; -use crate::space_polymodel::library::ThingView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::string::AtUri; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::ModelView; +use crate::space_polymodel::library::ThingView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetThing { pub uri: AtUri, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct GetThingOutput { #[serde(skip_serializing_if = "Option::is_none")] pub models: Option>>, @@ -71,7 +66,7 @@ impl jacquard_common::xrpc::XrpcEndpoint for GetThingRequest { pub mod get_thing_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -174,4 +169,4 @@ where uri: self._fields.0.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/model.rs b/crates/polymodel-api/src/space_polymodel/library/model.rs index 4d217b6..2bbff9b 100644 --- a/crates/polymodel-api/src/space_polymodel/library/model.rs +++ b/crates/polymodel-api/src/space_polymodel/library/model.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,11 +24,11 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; -use crate::space_polymodel::library::Image; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; +use crate::space_polymodel::library::Image; /// A model: an ordered set of parts; a variant of a thing. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -230,7 +230,7 @@ impl LexiconSchema for Model { pub mod model_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -324,9 +324,7 @@ impl ModelBuilder { pub fn new() -> Self { ModelBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -337,9 +335,7 @@ impl ModelBuilder { pub fn builder() -> Self { ModelBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -405,12 +401,18 @@ impl ModelBuilder { impl ModelBuilder { /// Set the `intendedToWorkWith` field (optional) - pub fn intended_to_work_with(mut self, value: impl Into>>>) -> Self { + pub fn intended_to_work_with( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.4 = value.into(); self } /// Set the `intendedToWorkWith` field to an Option value (optional) - pub fn maybe_intended_to_work_with(mut self, value: Option>>) -> Self { + pub fn maybe_intended_to_work_with( + mut self, + value: Option>>, + ) -> Self { self._fields.4 = value; self } @@ -435,7 +437,10 @@ where St::Name: model_state::IsUnset, { /// Set the `name` field (required) - pub fn name(mut self, value: impl Into) -> ModelBuilder, S> { + pub fn name( + mut self, + value: impl Into, + ) -> ModelBuilder, S> { self._fields.6 = Option::Some(value.into()); ModelBuilder { _state: PhantomData, @@ -547,10 +552,10 @@ where } fn lexicon_doc_space_polymodel_library_model() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.library.model"), @@ -559,16 +564,19 @@ fn lexicon_doc_space_polymodel_library_model() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "A model: an ordered set of parts; a variant of a thing.", - )), + description: Some( + CowStr::new_static( + "A model: an ordered set of parts; a variant of a thing.", + ), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("name"), - SmolStr::new_static("parts"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("name"), SmolStr::new_static("parts"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -689,4 +697,4 @@ fn lexicon_doc_space_polymodel_library_model() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/part.rs b/crates/polymodel-api/src/space_polymodel/library/part.rs index c4f06ec..7a0c198 100644 --- a/crates/polymodel-api/src/space_polymodel/library/part.rs +++ b/crates/polymodel-api/src/space_polymodel/library/part.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,13 +24,13 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; +#[allow(unused_imports)] +use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; +use serde::{Serialize, Deserialize}; use crate::com_atproto::repo::strong_ref::StrongRef; use crate::space_polymodel::library::Bbox; use crate::space_polymodel::library::File; use crate::space_polymodel::library::Image; -#[allow(unused_imports)] -use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; /// A part: a single printable geometry file (STL/3MF/OBJ; multi-body discouraged). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -207,7 +207,7 @@ fn _default_part_units() -> ::core::option::Option { pub mod part_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -301,9 +301,7 @@ impl PartBuilder { pub fn new() -> Self { PartBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -314,9 +312,7 @@ impl PartBuilder { pub fn builder() -> Self { PartBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -373,7 +369,10 @@ where St::File: part_state::IsUnset, { /// Set the `file` field (required) - pub fn file(mut self, value: impl Into>) -> PartBuilder, S> { + pub fn file( + mut self, + value: impl Into>, + ) -> PartBuilder, S> { self._fields.3 = Option::Some(value.into()); PartBuilder { _state: PhantomData, @@ -398,12 +397,18 @@ impl PartBuilder { impl PartBuilder { /// Set the `intendedToWorkWith` field (optional) - pub fn intended_to_work_with(mut self, value: impl Into>>>) -> Self { + pub fn intended_to_work_with( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.5 = value.into(); self } /// Set the `intendedToWorkWith` field to an Option value (optional) - pub fn maybe_intended_to_work_with(mut self, value: Option>>) -> Self { + pub fn maybe_intended_to_work_with( + mut self, + value: Option>>, + ) -> Self { self._fields.5 = value; self } @@ -415,7 +420,10 @@ where St::Name: part_state::IsUnset, { /// Set the `name` field (required) - pub fn name(mut self, value: impl Into) -> PartBuilder, S> { + pub fn name( + mut self, + value: impl Into, + ) -> PartBuilder, S> { self._fields.6 = Option::Some(value.into()); PartBuilder { _state: PhantomData, @@ -521,10 +529,10 @@ where } fn lexicon_doc_space_polymodel_library_part() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.library.part"), @@ -654,4 +662,4 @@ fn lexicon_doc_space_polymodel_library_part() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/search_things.rs b/crates/polymodel-api/src/space_polymodel/library/search_things.rs index abf3ce4..6cdbc09 100644 --- a/crates/polymodel-api/src/space_polymodel/library/search_things.rs +++ b/crates/polymodel-api/src/space_polymodel/library/search_things.rs @@ -8,20 +8,17 @@ #[allow(unused_imports)] use alloc::collections::BTreeMap; -use crate::space_polymodel::library::FeedView; #[allow(unused_imports)] use core::marker::PhantomData; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::value::Data; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; use jacquard_derive::IntoStatic; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::space_polymodel::library::FeedView; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchThings { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, @@ -32,11 +29,9 @@ pub struct SearchThings { pub q: S, } + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: Deserialize<'de> + BosStr") -)] +#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct SearchThingsOutput { #[serde(flatten)] pub value: FeedView, @@ -78,7 +73,7 @@ fn _default_limit() -> Option { pub mod search_things_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -209,4 +204,4 @@ where q: self._fields.2.unwrap(), } } -} +} \ No newline at end of file diff --git a/crates/polymodel-api/src/space_polymodel/library/thing.rs b/crates/polymodel-api/src/space_polymodel/library/thing.rs index c33ec4a..b843a92 100644 --- a/crates/polymodel-api/src/space_polymodel/library/thing.rs +++ b/crates/polymodel-api/src/space_polymodel/library/thing.rs @@ -10,7 +10,7 @@ use alloc::collections::BTreeMap; #[allow(unused_imports)] use core::marker::PhantomData; -use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr}; +use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; @@ -24,11 +24,11 @@ use jacquard_derive::{IntoStatic, lexicon}; use jacquard_lexicon::lexicon::LexiconDoc; use jacquard_lexicon::schema::LexiconSchema; -use crate::com_atproto::repo::strong_ref::StrongRef; -use crate::space_polymodel::library::Image; #[allow(unused_imports)] use jacquard_lexicon::validation::{ConstraintError, ValidationPath}; -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; +use crate::com_atproto::repo::strong_ref::StrongRef; +use crate::space_polymodel::library::Image; /// A Polymodel thing: landing page grouping one or more models. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] @@ -229,7 +229,7 @@ impl LexiconSchema for Thing { pub mod thing_state { - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { @@ -323,9 +323,7 @@ impl ThingBuilder { pub fn new() -> Self { ThingBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -336,9 +334,7 @@ impl ThingBuilder { pub fn builder() -> Self { ThingBuilder { _state: PhantomData, - _fields: ( - None, None, None, None, None, None, None, None, None, None, None, - ), + _fields: (None, None, None, None, None, None, None, None, None, None, None), _type: PhantomData, } } @@ -404,12 +400,18 @@ impl ThingBuilder { impl ThingBuilder { /// Set the `intendedToWorkWith` field (optional) - pub fn intended_to_work_with(mut self, value: impl Into>>>) -> Self { + pub fn intended_to_work_with( + mut self, + value: impl Into>>>, + ) -> Self { self._fields.4 = value.into(); self } /// Set the `intendedToWorkWith` field to an Option value (optional) - pub fn maybe_intended_to_work_with(mut self, value: Option>>) -> Self { + pub fn maybe_intended_to_work_with( + mut self, + value: Option>>, + ) -> Self { self._fields.4 = value; self } @@ -421,7 +423,10 @@ where St::License: thing_state::IsUnset, { /// Set the `license` field (required) - pub fn license(mut self, value: impl Into) -> ThingBuilder, S> { + pub fn license( + mut self, + value: impl Into, + ) -> ThingBuilder, S> { self._fields.5 = Option::Some(value.into()); ThingBuilder { _state: PhantomData, @@ -450,7 +455,10 @@ where St::Name: thing_state::IsUnset, { /// Set the `name` field (required) - pub fn name(mut self, value: impl Into) -> ThingBuilder, S> { + pub fn name( + mut self, + value: impl Into, + ) -> ThingBuilder, S> { self._fields.7 = Option::Some(value.into()); ThingBuilder { _state: PhantomData, @@ -543,10 +551,10 @@ where } fn lexicon_doc_space_polymodel_library_thing() -> LexiconDoc<'static> { - use alloc::collections::BTreeMap; #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; + use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("space.polymodel.library.thing"), @@ -555,16 +563,19 @@ fn lexicon_doc_space_polymodel_library_thing() -> LexiconDoc<'static> { map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { - description: Some(CowStr::new_static( - "A Polymodel thing: landing page grouping one or more models.", - )), + description: Some( + CowStr::new_static( + "A Polymodel thing: landing page grouping one or more models.", + ), + ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { - required: Some(vec![ - SmolStr::new_static("name"), - SmolStr::new_static("license"), - SmolStr::new_static("createdAt"), - ]), + required: Some( + vec![ + SmolStr::new_static("name"), SmolStr::new_static("license"), + SmolStr::new_static("createdAt") + ], + ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); @@ -685,4 +696,4 @@ fn lexicon_doc_space_polymodel_library_thing() -> LexiconDoc<'static> { }, ..Default::default() } -} +} \ No newline at end of file diff --git a/e2e/tests/home.spec.ts b/e2e/tests/home.spec.ts index 46b72ca..b87eafa 100644 --- a/e2e/tests/home.spec.ts +++ b/e2e/tests/home.spec.ts @@ -1,15 +1,46 @@ import { expect, test } from '@playwright/test'; -test('home page shows the product browse shell', async ({ page }) => { +test('home page shows the product browse shell with reusable thing cards', async ({ page }) => { await page.goto('/'); await expect(page.getByRole('heading', { name: 'Polymodel' })).toBeVisible(); await expect(page.getByLabel('Browse shell')).toBeVisible(); - await expect(page.getByLabel('Browse results placeholder')).toBeVisible(); - await expect(page.getByText('Empty')).toBeVisible(); await expect(page.getByRole('tab', { name: 'Recent' })).toBeVisible(); await expect(page.getByRole('tab', { name: 'Hot' })).toBeVisible(); await expect(page.getByRole('searchbox', { name: 'Search model projects' })).toBeVisible(); + + const results = page.getByLabel('Browse results'); + await expect(results).toBeVisible(); + await expect(results.getByRole('article')).toHaveCount(3); + await expect(page.getByRole('heading', { name: 'Parametric enclosure kit' })).toBeVisible(); + await expect(page.getByText('by Ari Chen')).toBeVisible(); + await expect(page.getByText('#parametric')).toBeVisible(); + await expect(page.getByText('3 models')).toBeVisible(); + await expect(page.getByText('18 parts')).toBeVisible(); + await expect(page.getByRole('img', { name: 'Rendered preview of a parametric electronics enclosure' })).toBeVisible(); + + + await expect(page.getByRole('heading', { name: 'Untitled thing' })).toBeVisible(); + await expect(page.getByText('by mira.tools')).toBeVisible(); + + await expect(page.getByRole('heading', { name: 'Modular calibration tower' })).toBeVisible(); + await expect(page.getByRole('img', { name: 'Blueprint placeholder for missing preview media' })).toHaveCount(2); + await expect(page.getByText('No preview')).toHaveCount(2); + await expect(page.getByText('preview pending')).toHaveCount(2); + + await expect(page.getByLabel('Browse results placeholder')).toHaveCount(0); + await expect(page.getByText('Empty')).toHaveCount(0); +}); + +test('home thing cards remain readable at narrow widths', async ({ page }) => { + await page.setViewportSize({ width: 390, height: 900 }); + await page.goto('/'); + + await expect(page.getByLabel('Browse results')).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Parametric enclosure kit' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Untitled thing' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Modular calibration tower' })).toBeVisible(); + await expect(page.getByRole('img', { name: 'Blueprint placeholder for missing preview media' })).toHaveCount(2); }); test('foundation route shows PM-38 primitives and reusable states', async ({ page }) => { diff --git a/lexicons/library/defs.json b/lexicons/library/defs.json index 3e72ba0..6f2d915 100644 --- a/lexicons/library/defs.json +++ b/lexicons/library/defs.json @@ -4,181 +4,677 @@ "defs": { "actor": { "type": "object", + "required": [ + "did", + "handle" + ], "properties": { - "did": { "type": "string", "format": "did" }, - "handle": { "type": "string" }, - "displayName": { "type": "string" }, - "avatar": { "type": "string", "format": "uri", "description": "Avatar image URL resolved by the app view (CDN)." } + "did": { + "type": "string", + "format": "did" + }, + "handle": { + "type": "string", + "format": "handle" + }, + "displayName": { + "type": "string" + }, + "avatar": { + "type": "string", + "format": "uri", + "description": "Avatar image URL resolved by the app view (CDN)." + }, + "pronouns": { + "type": "string", + "description": "Hydrated profile pronouns for bylines and cards." + }, + "description": { + "type": "string" + }, + "followerCount": { + "type": "integer" + }, + "followingCount": { + "type": "integer" + }, + "thingCount": { + "type": "integer", + "description": "Count of published Polymodel things by this actor." + }, + "viewer": { + "type": "ref", + "ref": "#actorViewerState" + } } }, "viewerState": { "type": "object", "properties": { - "like": { "type": "string", "format": "at-uri" }, - "save": { "type": "string", "format": "at-uri" } + "like": { + "type": "string", + "format": "at-uri" + }, + "save": { + "type": "string", + "format": "at-uri" + } } }, "bbox": { "type": "object", "description": "Axis-aligned bounding-box dimensions. ATProto has no float type, so x/y/z are decimal strings (e.g. 12.5) parsed to floats internally.", "properties": { - "x": { "type": "string" }, - "y": { "type": "string" }, - "z": { "type": "string" }, - "unit": { "type": "string" } + "x": { + "type": "string" + }, + "y": { + "type": "string" + }, + "z": { + "type": "string" + }, + "unit": { + "type": "string" + } }, - "required": ["x", "y", "z"] + "required": [ + "x", + "y", + "z" + ] }, "aspectRatio": { "type": "object", "description": "Width:height aspect ratio of an image, for layout before the blob loads.", - "required": ["width", "height"], + "required": [ + "width", + "height" + ], "properties": { - "width": { "type": "integer" }, - "height": { "type": "integer" } + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + } } }, "image": { "type": "object", "description": "An authored image: a blob plus alt text and aspect ratio. Stored on records; the app view resolves it to #imageView.", - "required": ["image", "alt", "aspectRatio"], + "required": [ + "image", + "alt", + "aspectRatio" + ], "properties": { - "image": { "type": "blob", "accept": ["image/png", "image/jpeg", "image/webp"], "maxSize": 5242880 }, - "alt": { "type": "string", "maxGraphemes": 300, "maxLength": 2000, "description": "Alt text describing the image, for accessibility." }, - "aspectRatio": { "type": "ref", "ref": "#aspectRatio" } + "image": { + "type": "blob", + "accept": [ + "image/png", + "image/jpeg", + "image/webp" + ], + "maxSize": 5242880 + }, + "alt": { + "type": "string", + "maxGraphemes": 300, + "maxLength": 2000, + "description": "Alt text describing the image, for accessibility." + }, + "aspectRatio": { + "type": "ref", + "ref": "#aspectRatio" + } } }, "imageView": { "type": "object", "description": "A resolved image view: CDN URLs for thumbnail and full size plus aspect ratio. Currently resolved via Bluesky's CDN by the app view.", - "required": ["thumb", "fullsize"], + "required": [ + "thumb", + "fullsize" + ], "properties": { - "alt": { "type": "string" }, - "thumb": { "type": "string", "format": "uri", "description": "Fully-qualified thumbnail URL (CDN, resolved by the app view)." }, - "fullsize": { "type": "string", "format": "uri", "description": "Fully-qualified full-size URL (CDN, resolved by the app view)." }, - "aspectRatio": { "type": "ref", "ref": "#aspectRatio" } + "alt": { + "type": "string" + }, + "thumb": { + "type": "string", + "format": "uri", + "description": "Fully-qualified thumbnail URL (CDN, resolved by the app view)." + }, + "fullsize": { + "type": "string", + "format": "uri", + "description": "Fully-qualified full-size URL (CDN, resolved by the app view)." + }, + "aspectRatio": { + "type": "ref", + "ref": "#aspectRatio" + } } }, "file": { "type": "object", "description": "Chunk-capable geometry manifest. Reassemble by concatenating chunks in offset order. Per-chunk integrity is the blob CID; offset+size make ordering explicit; digest verifies the fully reassembled file.", "properties": { - "mimeType": { "type": "string" }, - "size": { "type": "integer" }, - "digest": { "type": "string", "description": "hex digest of the fully reassembled file (sha256 by convention)" }, - "chunks": { "type": "array", "items": { "type": "ref", "ref": "#chunk" }, "maxLength": 4096 } + "mimeType": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "digest": { + "type": "string", + "description": "hex digest of the fully reassembled file (sha256 by convention)" + }, + "chunks": { + "type": "array", + "items": { + "type": "ref", + "ref": "#chunk" + }, + "maxLength": 4096 + } }, - "required": ["mimeType", "size", "chunks"] + "required": [ + "mimeType", + "size", + "chunks" + ] }, "chunk": { "type": "object", "properties": { - "blob": { "type": "blob", "accept": ["model/stl", "model/3mf", "model/obj", "application/octet-stream"], "maxSize": 104857600 }, - "offset": { "type": "integer", "minimum": 0 }, - "size": { "type": "integer", "minimum": 0 } + "blob": { + "type": "blob", + "accept": [ + "model/stl", + "model/3mf", + "model/obj", + "application/octet-stream" + ], + "maxSize": 104857600 + }, + "offset": { + "type": "integer", + "minimum": 0 + }, + "size": { + "type": "integer", + "minimum": 0 + } }, - "required": ["blob", "offset", "size"] + "required": [ + "blob", + "offset", + "size" + ] }, "thingView": { "type": "object", - "required": ["uri", "cid", "author", "record", "indexedAt"], - "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string" }, - "author": { "type": "ref", "ref": "#actor" }, - "record": { "type": "unknown" }, - "indexedAt": { "type": "string", "format": "datetime" }, - "name": { "type": "string" }, - "summary": { "type": "string" }, - "license": { "type": "string" }, - "tags": { "type": "array", "items": { "type": "string" } }, - "cover": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "previews": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "derivedFrom": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, - "intendedToWorkWith": { "type": "array", "items": { "type": "ref", "ref": "com.atproto.repo.strongRef" } }, - "likeCount": { "type": "integer" }, - "saveCount": { "type": "integer" }, - "modelCount": { "type": "integer" }, - "viewer": { "type": "ref", "ref": "#viewerState" } + "required": [ + "uri", + "cid", + "author", + "record", + "indexedAt", + "name", + "license", + "likeCount", + "saveCount", + "modelCount", + "partCount", + "viewer" + ], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "cid": { + "type": "string" + }, + "author": { + "type": "ref", + "ref": "#actor" + }, + "record": { + "type": "unknown" + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "name": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "license": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Hydrated display tags, including appview-aggregated external tag assertions." + }, + "cover": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "previews": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "derivedFrom": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + }, + "intendedToWorkWith": { + "type": "array", + "items": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + } + }, + "likeCount": { + "type": "integer" + }, + "saveCount": { + "type": "integer" + }, + "modelCount": { + "type": "integer" + }, + "partCount": { + "type": "integer", + "description": "Thing-level aggregate count of parts across included models, computed by the app view." + }, + "viewer": { + "type": "ref", + "ref": "#viewerState" + } } }, "thingViewBasic": { "type": "object", - "required": ["uri"], - "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string" }, - "name": { "type": "string" }, - "author": { "type": "ref", "ref": "#actor" }, - "cover": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "previews": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "likeCount": { "type": "integer" }, - "saveCount": { "type": "integer" }, - "modelCount": { "type": "integer" }, - "indexedAt": { "type": "string", "format": "datetime" } + "required": [ + "uri", + "cid", + "author", + "name", + "likeCount", + "saveCount", + "modelCount", + "partCount", + "indexedAt", + "viewer" + ], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "cid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "author": { + "type": "ref", + "ref": "#actor" + }, + "cover": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "previews": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Hydrated display tags for browse/search/profile cards, including appview-aggregated external tag assertions." + }, + "likeCount": { + "type": "integer" + }, + "saveCount": { + "type": "integer" + }, + "modelCount": { + "type": "integer" + }, + "partCount": { + "type": "integer", + "description": "Thing-level aggregate count of parts across included models, computed by the app view." + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "viewer": { + "type": "ref", + "ref": "#viewerState" + } } }, "modelView": { "type": "object", - "required": ["uri", "cid", "author", "record", "indexedAt"], - "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string" }, - "author": { "type": "ref", "ref": "#actor" }, - "record": { "type": "unknown" }, - "indexedAt": { "type": "string", "format": "datetime" }, - "name": { "type": "string" }, - "summary": { "type": "string" }, - "cover": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "previews": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "partCount": { "type": "integer" }, - "viewer": { "type": "ref", "ref": "#viewerState" } + "required": [ + "uri", + "cid", + "author", + "record", + "indexedAt", + "name", + "partCount", + "viewer" + ], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "cid": { + "type": "string" + }, + "author": { + "type": "ref", + "ref": "#actor" + }, + "record": { + "type": "unknown" + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "name": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "cover": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "previews": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "partCount": { + "type": "integer" + }, + "viewer": { + "type": "ref", + "ref": "#viewerState" + } } }, "partView": { "type": "object", - "required": ["uri", "cid", "author", "record", "indexedAt"], - "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string" }, - "author": { "type": "ref", "ref": "#actor" }, - "record": { "type": "unknown" }, - "indexedAt": { "type": "string", "format": "datetime" }, - "name": { "type": "string" }, - "format": { "type": "string" }, - "file": { "type": "ref", "ref": "#file" }, - "previews": { "type": "array", "items": { "type": "ref", "ref": "#imageView" } }, - "viewer": { "type": "ref", "ref": "#viewerState" } + "required": [ + "uri", + "cid", + "author", + "record", + "indexedAt", + "name", + "file", + "viewer" + ], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "cid": { + "type": "string" + }, + "author": { + "type": "ref", + "ref": "#actor" + }, + "record": { + "type": "unknown" + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "name": { + "type": "string" + }, + "format": { + "type": "string" + }, + "file": { + "type": "ref", + "ref": "#file" + }, + "previews": { + "type": "array", + "items": { + "type": "ref", + "ref": "#imageView" + } + }, + "viewer": { + "type": "ref", + "ref": "#viewerState" + } } }, "feedItem": { "type": "object", "properties": { - "thing": { "type": "ref", "ref": "#thingViewBasic" } + "thing": { + "type": "ref", + "ref": "#thingViewBasic" + } }, - "required": ["thing"] + "required": [ + "thing" + ] }, "feedView": { "type": "object", "properties": { - "cursor": { "type": "string" }, - "items": { "type": "array", "items": { "type": "ref", "ref": "#feedItem" } } + "cursor": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "type": "ref", + "ref": "#feedItem" + } + } }, - "required": ["items"] + "required": [ + "items" + ] + }, + "actorViewDetailed": { + "type": "object", + "description": "Detailed hydrated actor/profile view for profile surfaces, modeled after app.bsky.actor profile view splits.", + "required": [ + "did", + "handle", + "record", + "indexedAt", + "viewer" + ], + "properties": { + "did": { + "type": "string", + "format": "did" + }, + "handle": { + "type": "string", + "format": "handle" + }, + "displayName": { + "type": "string" + }, + "description": { + "type": "string" + }, + "avatar": { + "type": "string", + "format": "uri", + "description": "Avatar image URL resolved by the app view (CDN)." + }, + "pronouns": { + "type": "string" + }, + "defaultLicense": { + "type": "string" + }, + "printers": { + "type": "array", + "items": { + "type": "string" + } + }, + "links": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + } + }, + "followerCount": { + "type": "integer" + }, + "followingCount": { + "type": "integer" + }, + "thingCount": { + "type": "integer", + "description": "Count of published Polymodel things by this actor." + }, + "record": { + "type": "unknown" + }, + "indexedAt": { + "type": "string", + "format": "datetime" + }, + "viewer": { + "type": "ref", + "ref": "#actorViewerState" + } + } }, "workMeta": { "type": "object", "description": "Reference-only shared field set; fields are inlined on thing/model.", "properties": { - "name": { "type": "string" }, - "summary": { "type": "string" }, - "instructions": { "type": "array", "items": { "type": "string" } }, - "license": { "type": "string" }, - "tags": { "type": "array", "items": { "type": "string" } }, - "cover": { "type": "array", "items": { "type": "ref", "ref": "#image" } }, - "previews": { "type": "array", "items": { "type": "ref", "ref": "#image" } }, - "derivedFrom": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, - "intendedToWorkWith": { "type": "array", "items": { "type": "ref", "ref": "com.atproto.repo.strongRef" } } + "name": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "instructions": { + "type": "array", + "items": { + "type": "string" + } + }, + "license": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "cover": { + "type": "array", + "items": { + "type": "ref", + "ref": "#image" + } + }, + "previews": { + "type": "array", + "items": { + "type": "ref", + "ref": "#image" + } + }, + "derivedFrom": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + }, + "intendedToWorkWith": { + "type": "array", + "items": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + } + } + } + }, + "actorViewerState": { + "type": "object", + "description": "Viewer-specific relationship state for an actor/profile.", + "properties": { + "following": { + "type": "string", + "format": "at-uri", + "description": "Follow record URI if the requester follows this actor." + }, + "followedBy": { + "type": "string", + "format": "at-uri", + "description": "Follow record URI if this actor follows the requester." + }, + "muted": { + "type": "boolean" + }, + "blockedBy": { + "type": "boolean" + }, + "blocking": { + "type": "string", + "format": "at-uri", + "description": "Block record URI if the requester blocks this actor." + } } } } diff --git a/migrations/001_projection_schema.sql b/migrations/001_projection_schema.sql index 95b12ce..14c19a2 100644 --- a/migrations/001_projection_schema.sql +++ b/migrations/001_projection_schema.sql @@ -20,7 +20,7 @@ CREATE TABLE things ( cid TEXT NOT NULL, name TEXT NOT NULL, summary TEXT, - license TEXT, + license TEXT NOT NULL, tags_json TEXT, tags_text TEXT, instructions_text TEXT, @@ -52,7 +52,7 @@ CREATE TABLE parts ( cid TEXT NOT NULL, name TEXT NOT NULL, format TEXT, - file_json TEXT, + file_json TEXT NOT NULL, created_at INTEGER NOT NULL, indexed_at INTEGER NOT NULL, PRIMARY KEY (did, rkey) diff --git a/src/appview/tests.rs b/src/appview/tests.rs index b051d56..237da5e 100644 --- a/src/appview/tests.rs +++ b/src/appview/tests.rs @@ -63,7 +63,7 @@ async fn seed_thing( sqlx::query( r#"INSERT INTO things (did, rkey, uri, cid, name, summary, license, tags_json, tags_text, instructions_text, cover_json, derived_from_uri, created_at, indexed_at, record_json) - VALUES (?, ?, ?, ?, ?, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)"#, + VALUES (?, ?, ?, ?, ?, NULL, 'CC-BY-4.0', NULL, NULL, NULL, NULL, NULL, ?, ?, ?)"#, ) .bind(did) .bind(rkey) @@ -141,16 +141,16 @@ async fn seed_part(pool: &SqlitePool, did: &str, rkey: &str, name: &str) -> Stri let now = chrono::Utc::now().timestamp_millis(); sqlx::query( r#"INSERT INTO parts (did, rkey, uri, cid, name, format, file_json, created_at, indexed_at, record_json) - VALUES (?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?)"#, + VALUES (?, ?, ?, ?, ?, NULL, ?, ?, ?, ?)"#, ) .bind(did) .bind(rkey) .bind(&uri) .bind("cid") .bind(name) + .bind(json!({"mimeType": "model/stl", "size": 1, "chunks": []}).to_string()) .bind(now) - .bind(now) - .bind(json!({"name": name}).to_string()) + .bind(json!({"name": name, "file": {"mimeType": "model/stl", "size": 1, "chunks": []}, "createdAt": "2024-01-01T00:00:00.000Z"}).to_string()) .execute(pool) .await .unwrap(); @@ -196,9 +196,9 @@ async fn get_thing_hydrates_thing_with_ordered_models_and_record() { let (view, models) = views::get_thing(&state, &thing, None).await.unwrap(); assert_eq!(view.uri.as_ref(), thing); - assert_eq!(view.name.as_ref().map(|s| s.as_str()), Some("Cube")); - assert_eq!(view.like_count, Some(3)); - assert_eq!(view.model_count, Some(2)); + assert_eq!(view.name.as_str(), "Cube"); + assert_eq!(view.like_count, 3); + assert_eq!(view.model_count, 2); // record must be populated from record_json (never null). assert!( serde_json::to_string(&view.record) @@ -210,10 +210,7 @@ async fn get_thing_hydrates_thing_with_ordered_models_and_record() { assert_eq!(models[0].uri.as_ref(), m2); assert_eq!(models[1].uri.as_ref(), m1); // Author handle comes from the identity projection. - assert_eq!( - view.author.handle.as_ref().map(|s| s.as_str()), - Some("alice.example") - ); + assert_eq!(view.author.handle.as_ref(), "alice.example"); } #[tokio::test] @@ -239,7 +236,7 @@ async fn get_model_hydrates_parts_and_parent_thing() { let detail = views::get_model(&state, &model, None).await.unwrap(); assert_eq!(detail.model.uri.as_ref(), model); - assert_eq!(detail.model.part_count, Some(2)); + assert_eq!(detail.model.part_count, 2); assert_eq!(detail.parts.len(), 2); assert_eq!(detail.parts[0].uri.as_ref(), p2); // ordered by position assert_eq!(detail.thing.as_ref().unwrap().uri.as_ref(), thing); @@ -255,20 +252,14 @@ async fn author_things_keyset_paginates_by_rkey() { let page1 = views::author_things(&state, DID_A, 2, None).await.unwrap(); assert_eq!(page1.items.len(), 2); - assert_eq!( - page1.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("t3") - ); + assert_eq!(page1.items[0].thing.name.as_str(), "t3"); let cursor = page1.cursor.expect("cursor present when more remain"); let page2 = views::author_things(&state, DID_A, 2, Some(cursor.as_ref())) .await .unwrap(); assert_eq!(page2.items.len(), 1); - assert_eq!( - page2.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("t1") - ); + assert_eq!(page2.items[0].thing.name.as_str(), "t1"); assert!(page2.cursor.is_none()); } @@ -288,10 +279,7 @@ async fn feed_hot_is_deterministic_with_tied_scores() { feed_again.items[0].thing.uri.as_ref() ); // Tied scores break by rkey DESC. - assert_eq!( - feed.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("b") - ); + assert_eq!(feed.items[0].thing.name.as_str(), "b"); } #[tokio::test] @@ -304,10 +292,7 @@ async fn search_things_uses_fts() { .await .unwrap(); assert_eq!(feed.items.len(), 1); - assert_eq!( - feed.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("Calibration Cube") - ); + assert_eq!(feed.items[0].thing.name.as_str(), "Calibration Cube"); } #[tokio::test] @@ -463,18 +448,12 @@ async fn feed_recent_paginates_by_rkey() { let page1 = views::feed_recent(&state, 2, None).await.unwrap(); assert_eq!(page1.items.len(), 2); - assert_eq!( - page1.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("t3") - ); + assert_eq!(page1.items[0].thing.name.as_str(), "t3"); let cursor = page1.cursor.expect("more remain"); let page2 = views::feed_recent(&state, 2, Some(cursor.as_ref())) .await .unwrap(); assert_eq!(page2.items.len(), 1); - assert_eq!( - page2.items[0].thing.name.as_ref().map(|s| s.as_str()), - Some("t1") - ); + assert_eq!(page2.items[0].thing.name.as_str(), "t1"); assert!(page2.cursor.is_none()); } diff --git a/src/appview/views.rs b/src/appview/views.rs index cb32ad1..c440434 100644 --- a/src/appview/views.rs +++ b/src/appview/views.rs @@ -20,10 +20,10 @@ use std::cmp::Ordering; use jacquard::identity::resolver::IdentityResolver; use jacquard_common::deps::smol_str::SmolStr; -use jacquard_common::types::string::{AtUri, Datetime, Did, UriValue}; +use jacquard_common::types::string::{AtUri, Datetime, Did, Handle, UriValue}; use jacquard_common::types::value::{Data, to_data}; use polymodel_api::space_polymodel::library::{ - Actor, FeedItem, FeedView, ModelView, PartView, ThingView, ThingViewBasic, ViewerState, + Actor, FeedItem, FeedView, File, ModelView, PartView, ThingView, ThingViewBasic, ViewerState, }; use sqlx::SqlitePool; @@ -45,7 +45,9 @@ fn at_uri(uri: &str) -> AppResult { fn did_of(did: &str) -> AppResult { Did::new_owned(did).map_err(|e| internal(format!("invalid did {did:?}: {e}"))) } - +fn handle_of(handle: String) -> AppResult { + Handle::new_owned(handle).map_err(|e| internal(format!("invalid handle: {e}"))) +} fn datetime_millis(millis: i64) -> Datetime { let dt = chrono::DateTime::::from_timestamp_millis(millis) .unwrap_or_else(chrono::Utc::now); @@ -60,6 +62,10 @@ fn record_data(record_json: Option<&str>) -> AppResult { to_data(&value).map_err(|e| internal(format!("record encode: {e}"))) } +fn file_data(file_json: Option<&str>) -> AppResult { + serde_json::from_str(file_json.ok_or_else(|| internal("part row missing file_json"))?) + .map_err(|e| internal(format!("file_json parse: {e}"))) +} fn smol_vec(json: Option<&str>) -> Option> { let arr: Vec = serde_json::from_str(json?).ok()?; let v: Vec = arr.into_iter().map(s).collect(); @@ -87,7 +93,7 @@ struct ThingRow { cid: String, name: String, summary: Option, - license: Option, + license: String, tags_json: Option, cover_json: Option, derived_from_uri: Option, @@ -97,8 +103,8 @@ struct ThingRow { like_count: i64, save_count: i64, model_count: i64, + part_count: i64, } - #[allow(dead_code)] // query-result row; mirrors projected columns #[derive(sqlx::FromRow)] struct ModelRow { @@ -123,7 +129,7 @@ struct PartRow { cid: String, name: String, format: Option, - file_json: Option, + file_json: String, created_at: i64, indexed_at: i64, record_json: Option, @@ -168,10 +174,18 @@ async fn actor_for_did(state: &AppState, did: &str) -> AppResult { None => (None, None), }; Ok(Actor { - did: Some(did_of(did)?), - handle: handle.map(s), + did: did_of(did)?, + handle: handle_of( + handle.ok_or_else(|| internal(format!("missing handle for actor {did}")))?, + )?, display_name: display_name.map(s), avatar: None, // blob→CDN resolution deferred; never synthesize a URL + description: None, + follower_count: None, + following_count: None, + pronouns: None, + thing_count: None, + viewer: None, extra_data: None, }) } @@ -180,9 +194,9 @@ async fn viewer_state( pool: &SqlitePool, viewer_did: Option<&str>, subject_uri: &str, -) -> AppResult> { +) -> AppResult { let Some(did) = viewer_did else { - return Ok(None); + return Ok(ViewerState::default()); }; #[derive(sqlx::FromRow)] struct IdRow { @@ -205,7 +219,7 @@ async fn viewer_state( .fetch_optional(pool) .await)?; if like.is_none() && save.is_none() { - return Ok(None); + return Ok(ViewerState::default()); } let like = like .map(|r| at_uri(&format!("at://{did}/space.polymodel.graph.like/{}", r.rkey))) @@ -213,11 +227,11 @@ async fn viewer_state( let save = save .map(|r| at_uri(&format!("at://{did}/space.polymodel.graph.save/{}", r.rkey))) .transpose()?; - Ok(Some(ViewerState { + Ok(ViewerState { like, save, extra_data: None, - })) + }) } // --------------------------------------------------------------------------- @@ -237,15 +251,15 @@ async fn thing_view( author, record: record_data(row.record_json.as_deref())?, indexed_at: datetime_millis(row.indexed_at), - name: Some(s(row.name)), + name: s(row.name), summary: row.summary.map(s), - license: row.license.map(s), + license: s(row.license), tags: smol_vec(row.tags_json.as_deref()), - like_count: Some(row.like_count), - save_count: Some(row.save_count), - model_count: Some(row.model_count), + like_count: row.like_count, + save_count: row.save_count, + model_count: row.model_count, + part_count: row.part_count, viewer, - // cover/previews/derivedFrom need blob→CDN resolution; deferred (no fake URLs). cover: None, previews: None, derived_from: None, @@ -257,15 +271,18 @@ async fn thing_view( async fn thing_basic_view(state: &AppState, row: ThingRow) -> AppResult { Ok(ThingViewBasic { uri: at_uri(&row.uri)?, - cid: Some(s(row.cid)), - name: Some(s(row.name)), - author: Some(actor_for_did(state, &row.did).await?), - indexed_at: Some(datetime_millis(row.indexed_at)), - like_count: Some(row.like_count), - save_count: Some(row.save_count), - model_count: Some(row.model_count), + cid: s(row.cid), + name: s(row.name), + author: actor_for_did(state, &row.did).await?, + indexed_at: datetime_millis(row.indexed_at), + like_count: row.like_count, + save_count: row.save_count, + model_count: row.model_count, + part_count: row.part_count, cover: None, previews: None, + tags: smol_vec(row.tags_json.as_deref()), + viewer: ViewerState::default(), extra_data: None, }) } @@ -283,9 +300,9 @@ async fn model_view( author, record: record_data(row.record_json.as_deref())?, indexed_at: datetime_millis(row.indexed_at), - name: Some(s(row.name)), + name: s(row.name), summary: row.summary.map(s), - part_count: Some(row.part_count), + part_count: row.part_count, viewer, cover: None, previews: None, @@ -306,9 +323,9 @@ async fn part_view( author, record: record_data(row.record_json.as_deref())?, indexed_at: datetime_millis(row.indexed_at), - name: Some(s(row.name)), + name: s(row.name), format: row.format.map(s), - file: None, // geometry-manifest (chunk/blob) hydration deferred + file: file_data(Some(row.file_json.as_str()))?, previews: None, viewer, extra_data: None, @@ -325,12 +342,13 @@ async fn fetch_thing_by_uri(state: &AppState, uri: &str) -> AppResult Element { #[component] fn Browse() -> Element { let viewer_model = demo_models()[0].id.to_string(); + let things = thing_card_fixtures(); rsx! { main { class: "browse-page product-shell", @@ -125,8 +128,10 @@ fn Browse() -> Element { } } - section { class: "state-card empty-state", aria_label: "Browse results placeholder", - span { class: "status-pill status-muted", "Empty" } + section { class: "browse-results-grid", aria_label: "Browse results", + for thing in things { + ThingCard { key: "{thing.uri}", thing } + } } } } diff --git a/src/thing_card.rs b/src/thing_card.rs new file mode 100644 index 0000000..6216be3 --- /dev/null +++ b/src/thing_card.rs @@ -0,0 +1,415 @@ +use dioxus::prelude::*; +use jacquard_common::types::{ + string::{AtUri, Datetime, Did, Handle}, + uri::UriValue, +}; +use polymodel_api::space_polymodel::library; + +const COMPLETE_PREVIEW_SVG: &str = "data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 640 480\"%3E%3Crect width=\"640\" height=\"480\" fill=\"%23f4efe4\"/%3E%3Cg stroke=\"%232a6f97\" stroke-width=\"2\" fill=\"none\"%3E%3Cpath d=\"M64 96h512v288H64zM160 144h320v192H160zM256 192h128v96H256z\"/%3E%3Cpath d=\"M64 384 160 336M576 384 480 336M160 144 64 96M480 144 576 96\"/%3E%3C/g%3E%3Cg fill=\"%2366767f\" font-family=\"monospace\" font-size=\"24\"%3E%3Ctext x=\"72\" y=\"438\"%3Eparametric enclosure preview%3C/text%3E%3C/g%3E%3C/svg%3E"; + +#[derive(Clone, Debug, PartialEq)] +pub struct ThingCardMedia { + pub url: String, + pub alt: String, +} + +pub fn thing_card_fixtures() -> Vec { + vec![ + library::ThingViewBasic { + author: actor( + "did:plc:ari", + "ari.model.tools", + Some("Ari Chen"), + Some("she/her"), + ), + cid: "bafyreicardcomplete".into(), + cover: Some(vec![library::ImageView { + alt: Some("Rendered preview of a parametric electronics enclosure".into()), + aspect_ratio: None, + fullsize: UriValue::new_owned(COMPLETE_PREVIEW_SVG).expect("fixture URI is valid"), + thumb: UriValue::new_owned(COMPLETE_PREVIEW_SVG).expect("fixture URI is valid"), + extra_data: None, + }]), + indexed_at: Datetime::try_from("2026-06-21T12:00:00Z".to_string()) + .expect("fixture datetime is valid"), + like_count: 42, + model_count: 3, + name: "Parametric enclosure kit".into(), + part_count: 18, + previews: None, + save_count: 12, + tags: Some(vec![ + "enclosure".into(), + "parametric".into(), + "print-in-place".into(), + ]), + uri: AtUri::new_owned("at://did:plc:ari/space.polymodel.library.thing/complete") + .expect("fixture AT URI is valid"), + viewer: library::ViewerState { + like: Some( + AtUri::new_owned("at://did:plc:viewer/space.polymodel.graph.like/one") + .expect("fixture AT URI is valid"), + ), + save: Some( + AtUri::new_owned("at://did:plc:viewer/space.polymodel.graph.save/one") + .expect("fixture AT URI is valid"), + ), + extra_data: None, + }, + extra_data: None, + }, + library::ThingViewBasic { + author: actor("did:plc:mira", "mira.tools", None, None), + cid: "bafyreicardsparse".into(), + cover: None, + indexed_at: Datetime::try_from("2026-06-21T12:05:00Z".to_string()) + .expect("fixture datetime is valid"), + like_count: 0, + model_count: 0, + name: "Untitled thing".into(), + part_count: 0, + previews: None, + save_count: 0, + tags: None, + uri: AtUri::new_owned("at://did:plc:mira/space.polymodel.library.thing/sparse") + .expect("fixture AT URI is valid"), + viewer: library::ViewerState::default(), + extra_data: None, + }, + library::ThingViewBasic { + author: actor( + "did:plc:foundry", + "foundrylab.tools", + Some("Foundry Lab"), + Some("they/them"), + ), + cid: "bafyreicardmissingmedia".into(), + cover: None, + indexed_at: Datetime::try_from("2026-06-21T12:10:00Z".to_string()) + .expect("fixture datetime is valid"), + like_count: 8, + model_count: 1, + name: "Modular calibration tower".into(), + part_count: 6, + previews: Some(vec![]), + save_count: 5, + tags: Some(vec!["calibration".into(), "fixture".into()]), + uri: AtUri::new_owned( + "at://did:plc:foundry/space.polymodel.library.thing/missing-media", + ) + .expect("fixture AT URI is valid"), + viewer: library::ViewerState { + like: None, + save: Some( + AtUri::new_owned("at://did:plc:viewer/space.polymodel.graph.save/two") + .expect("fixture AT URI is valid"), + ), + extra_data: None, + }, + extra_data: None, + }, + ] +} + +#[allow(clippy::useless_format)] +#[component] +pub fn ThingCard(thing: library::ThingViewBasic) -> Element { + let title = thing_title(&thing); + let creator = creator_label(&thing.author); + let media = select_card_media(thing.cover.as_deref(), thing.previews.as_deref(), title); + let stats = stats(&thing); + let like_label = if thing.viewer.like.is_some() { + "Liked" + } else { + "Like" + }; + let save_label = if thing.viewer.save.is_some() { + "Saved" + } else { + "Save" + }; + + rsx! { + article { class: "thing-card card-surface", aria_label: "Thing card for {title}", + div { class: "thing-card-media card-media", + if let Some(media) = &media { + img { src: "{media.url}", alt: "{media.alt}" } + } else { + div { class: "thing-card-placeholder blueprint-media", role: "img", aria_label: "Blueprint placeholder for missing preview media", + span { class: "status-pill status-muted", "No preview" } + span { class: "blueprint-axis blueprint-axis-x", "X" } + span { class: "blueprint-axis blueprint-axis-y", "Y" } + span { class: "blueprint-dimension", "preview pending" } + } + } + } + div { class: "thing-card-body card-body", + div { class: "thing-card-heading", + h2 { class: "card-title thing-card-title", "{title}" } + p { class: "thing-card-creator", "by {creator}" } + } + if let Some(tags) = hydrated_tags(&thing) { + div { class: "thing-card-chips", aria_label: "Hydrated display tags", + for tag in tags.iter().take(3) { + span { class: "status-pill status-muted", "#{tag}" } + } + } + } + dl { class: "thing-card-stats", aria_label: "Thing stats", + for (label, value) in stats { + div { + dt { "{label}" } + dd { "{value}" } + } + } + } + div { class: "thing-card-actions", aria_label: "Thing card saved and liked state", + span { class: "thing-card-action", aria_label: like_label, "♡ {like_label}" } + span { class: "thing-card-action", aria_label: save_label, "☆ {save_label}" } + } + } + } + } +} + +fn thing_title(thing: &library::ThingViewBasic) -> &str { + clean_text(Some(thing.name.as_ref())).unwrap_or("Untitled thing") +} + +fn clean_text(value: Option<&str>) -> Option<&str> { + value.map(str::trim).filter(|value| !value.is_empty()) +} + +fn creator_label(actor: &library::Actor) -> &str { + clean_text(actor.display_name.as_ref().map(AsRef::as_ref)) + .unwrap_or_else(|| actor.handle.as_ref()) +} + +fn hydrated_tags(thing: &library::ThingViewBasic) -> Option<&[jacquard_common::bos::DefaultStr]> { + thing.tags.as_deref().filter(|tags| { + tags.iter() + .any(|tag| clean_text(Some(tag.as_ref())).is_some()) + }) +} + +fn stats(thing: &library::ThingViewBasic) -> [(&'static str, String); 4] { + [ + ("Models", count_label(thing.model_count, "model")), + ("Parts", count_label(thing.part_count, "part")), + ("Likes", count_label(thing.like_count, "like")), + ("Saves", count_label(thing.save_count, "save")), + ] +} + +fn count_label(value: i64, noun: &str) -> String { + let suffix = if value == 1 { "" } else { "s" }; + format!("{value} {noun}{suffix}") +} + +fn select_card_media( + cover: Option<&[library::ImageView]>, + previews: Option<&[library::ImageView]>, + title: &str, +) -> Option { + first_usable_image(cover, title).or_else(|| first_usable_image(previews, title)) +} + +fn first_usable_image( + images: Option<&[library::ImageView]>, + title: &str, +) -> Option { + images?.iter().find_map(|image| { + let url = image.thumb.as_ref().to_string(); + if !url.starts_with("http://") + && !url.starts_with("https://") + && !url.starts_with('/') + && !url.starts_with("data:image/") + { + return None; + } + let alt = clean_text(image.alt.as_ref().map(AsRef::as_ref)) + .map(ToString::to_string) + .unwrap_or_else(|| format!("Preview image for {title}")); + Some(ThingCardMedia { url, alt }) + }) +} + +fn actor( + did: &str, + handle: &str, + display_name: Option<&str>, + pronouns: Option<&str>, +) -> library::Actor { + library::Actor { + avatar: None, + description: None, + did: Did::new_owned(did).expect("fixture DID is valid"), + display_name: display_name.map(Into::into), + follower_count: None, + following_count: None, + handle: Handle::new_owned(handle).expect("fixture handle is valid"), + pronouns: pronouns.map(Into::into), + thing_count: None, + viewer: None, + extra_data: None, + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn basic_view(overrides: impl FnOnce(&mut library::ThingViewBasic)) -> library::ThingViewBasic { + let mut view = library::ThingViewBasic { + author: actor( + "did:plc:maker", + "maker.tools", + Some("Maker Name"), + Some("he/him"), + ), + cid: "bafyreitest".into(), + cover: Some(vec![library::ImageView { + alt: Some("Cover alt".into()), + aspect_ratio: None, + fullsize: UriValue::new_owned(COMPLETE_PREVIEW_SVG).expect("fixture URI is valid"), + thumb: UriValue::new_owned(COMPLETE_PREVIEW_SVG).expect("fixture URI is valid"), + extra_data: None, + }]), + indexed_at: Datetime::try_from("2026-06-21T12:00:00Z".to_string()) + .expect("fixture datetime is valid"), + like_count: 2, + model_count: 1, + name: "Named thing".into(), + part_count: 4, + previews: Some(vec![library::ImageView { + alt: Some("Preview alt".into()), + aspect_ratio: None, + fullsize: UriValue::new_owned("/assets/preview.jpg").expect("fixture URI is valid"), + thumb: UriValue::new_owned("/assets/preview.jpg").expect("fixture URI is valid"), + extra_data: None, + }]), + save_count: 3, + tags: Some(vec!["hydrated".into()]), + uri: AtUri::new_owned("at://did:plc:maker/space.polymodel.library.thing/abc") + .expect("fixture AT URI is valid"), + viewer: library::ViewerState { + like: Some( + AtUri::new_owned("at://did:plc:viewer/space.polymodel.graph.like/one") + .expect("fixture AT URI is valid"), + ), + save: None, + extra_data: None, + }, + extra_data: None, + }; + overrides(&mut view); + view + } + + #[test] + fn basic_view_contract_has_required_author_handle_and_counts() { + let view = basic_view(|_| {}); + assert_eq!(view.author.handle.as_ref(), "maker.tools"); + assert_eq!(view.name.as_str(), "Named thing"); + assert_eq!(view.model_count, 1); + assert_eq!(view.part_count, 4); + assert_eq!(view.like_count, 2); + assert_eq!(view.save_count, 3); + assert!(view.viewer.like.is_some()); + } + + #[test] + fn presentation_prefers_display_name_and_cover_media() { + let view = basic_view(|_| {}); + let media = select_card_media( + view.cover.as_deref(), + view.previews.as_deref(), + thing_title(&view), + ) + .unwrap(); + assert_eq!(creator_label(&view.author), "Maker Name"); + assert_eq!(media.url, COMPLETE_PREVIEW_SVG); + assert_eq!(media.alt, "Cover alt"); + } + + #[test] + fn presentation_uses_required_handle_when_display_name_missing() { + let view = basic_view(|view| { + view.author.display_name = None; + view.name = " ".into(); + view.cover = None; + view.previews = None; + }); + + assert_eq!(thing_title(&view), "Untitled thing"); + assert_eq!(creator_label(&view.author), "maker.tools"); + assert!( + select_card_media( + view.cover.as_deref(), + view.previews.as_deref(), + thing_title(&view) + ) + .is_none() + ); + } + + #[test] + fn media_selection_skips_unusable_urls_and_falls_back_alt() { + let view = basic_view(|view| { + view.cover = Some(vec![library::ImageView { + alt: Some("bad".into()), + aspect_ratio: None, + fullsize: UriValue::new_owned("notaurl").expect("fixture URI is accepted as Any"), + thumb: UriValue::new_owned("notaurl").expect("fixture URI is accepted as Any"), + extra_data: None, + }]); + view.previews = Some(vec![library::ImageView { + alt: None, + aspect_ratio: None, + fullsize: UriValue::new_owned("https://cdn.example/preview.jpg") + .expect("fixture URI is valid"), + thumb: UriValue::new_owned("https://cdn.example/preview.jpg") + .expect("fixture URI is valid"), + extra_data: None, + }]); + view.name = "Fallback media".into(); + }); + + let media = select_card_media( + view.cover.as_deref(), + view.previews.as_deref(), + thing_title(&view), + ) + .unwrap(); + assert_eq!(media.url, "https://cdn.example/preview.jpg"); + assert_eq!(media.alt, "Preview image for Fallback media"); + } + + #[test] + fn stats_are_subordinate_display_labels() { + let view = basic_view(|view| { + view.model_count = 1; + view.part_count = 2; + view.like_count = 0; + view.save_count = 1; + }); + + assert_eq!( + stats(&view), + [ + ("Models", "1 model".to_string()), + ("Parts", "2 parts".to_string()), + ("Likes", "0 likes".to_string()), + ("Saves", "1 save".to_string()) + ] + ); + } + + #[test] + fn hydrated_tags_are_view_metadata() { + let view = basic_view(|view| view.tags = Some(vec!["external".into(), "community".into()])); + let tags = hydrated_tags(&view).unwrap(); + assert_eq!(tags[0].as_str(), "external"); + assert_eq!(tags[1].as_str(), "community"); + } +}