A better Rust ATProto crate

test directories reworked a bit, prepping for crates.io release

Orual df48cd53 590fc90f

Changed files
+442 -1454
crates
jacquard
jacquard-api
jacquard-common
jacquard-derive
jacquard-lexicon
nix
modules
+20
Cargo.lock
···
]
[[package]]
+
name = "fastrand"
+
version = "2.3.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+
+
[[package]]
name = "find-msvc-tools"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
"serde_repr",
"serde_with",
"syn 2.0.106",
+
"tempfile",
"thiserror 2.0.17",
···
dependencies = [
"core-foundation-sys",
"libc",
+
]
+
+
[[package]]
+
name = "tempfile"
+
version = "3.23.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
+
dependencies = [
+
"fastrand",
+
"getrandom 0.3.3",
+
"once_cell",
+
"rustix",
+
"windows-sys 0.60.2",
[[package]]
+2 -2
Cargo.toml
···
keywords = ["atproto", "at protocol", "bluesky", "api", "client"]
categories = ["api-bindings", "web-programming::http-client"]
readme = "README.md"
-
documentation = "https://docs.rs/jacquard"
exclude = [".direnv"]
-
+
homepage = "https://tangled.org/@nonbinary.computer/jacquard"
+
license-file = "LICENSE"
description = "Simple and powerful AT Protocol client library for Rust"
+369 -17
LICENSE
···
-
MIT License
+
Mozilla Public License Version 2.0
+
==================================
+
+
1. Definitions
+
--------------
+
+
1.1. "Contributor"
+
means each individual or legal entity that creates, contributes to
+
the creation of, or owns Covered Software.
+
+
1.2. "Contributor Version"
+
means the combination of the Contributions of others (if any) used
+
by a Contributor and that particular Contributor's Contribution.
+
+
1.3. "Contribution"
+
means Covered Software of a particular Contributor.
+
+
1.4. "Covered Software"
+
means Source Code Form to which the initial Contributor has attached
+
the notice in Exhibit A, the Executable Form of such Source Code
+
Form, and Modifications of such Source Code Form, in each case
+
including portions thereof.
+
+
1.5. "Incompatible With Secondary Licenses"
+
means
+
+
(a) that the initial Contributor has attached the notice described
+
in Exhibit B to the Covered Software; or
+
+
(b) that the Covered Software was made available under the terms of
+
version 1.1 or earlier of the License, but not also under the
+
terms of a Secondary License.
+
+
1.6. "Executable Form"
+
means any form of the work other than Source Code Form.
+
+
1.7. "Larger Work"
+
means a work that combines Covered Software with other material, in
+
a separate file or files, that is not Covered Software.
+
+
1.8. "License"
+
means this document.
+
+
1.9. "Licensable"
+
means having the right to grant, to the maximum extent possible,
+
whether at the time of the initial grant or subsequently, any and
+
all of the rights conveyed by this License.
+
+
1.10. "Modifications"
+
means any of the following:
+
+
(a) any file in Source Code Form that results from an addition to,
+
deletion from, or modification of the contents of Covered
+
Software; or
+
+
(b) any new file in Source Code Form that contains any Covered
+
Software.
+
+
1.11. "Patent Claims" of a Contributor
+
means any patent claim(s), including without limitation, method,
+
process, and apparatus claims, in any patent Licensable by such
+
Contributor that would be infringed, but for the grant of the
+
License, by the making, using, selling, offering for sale, having
+
made, import, or transfer of either its Contributions or its
+
Contributor Version.
+
+
1.12. "Secondary License"
+
means either the GNU General Public License, Version 2.0, the GNU
+
Lesser General Public License, Version 2.1, the GNU Affero General
+
Public License, Version 3.0, or any later versions of those
+
licenses.
+
+
1.13. "Source Code Form"
+
means the form of the work preferred for making modifications.
+
+
1.14. "You" (or "Your")
+
means an individual or a legal entity exercising rights under this
+
License. For legal entities, "You" includes any entity that
+
controls, is controlled by, or is under common control with You. For
+
purposes of this definition, "control" means (a) the power, direct
+
or indirect, to cause the direction or management of such entity,
+
whether by contract or otherwise, or (b) ownership of more than
+
fifty percent (50%) of the outstanding shares or beneficial
+
ownership of such entity.
+
+
2. License Grants and Conditions
+
--------------------------------
+
+
2.1. Grants
+
+
Each Contributor hereby grants You a world-wide, royalty-free,
+
non-exclusive license:
+
+
(a) under intellectual property rights (other than patent or trademark)
+
Licensable by such Contributor to use, reproduce, make available,
+
modify, display, perform, distribute, and otherwise exploit its
+
Contributions, either on an unmodified basis, with Modifications, or
+
as part of a Larger Work; and
-
Copyright (c) 2023 Orual
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
+
for sale, have made, import, and otherwise transfer either its
+
Contributions or its Contributor Version.
-
Permission is hereby granted, free of charge, to any person obtaining a copy
-
of this software and associated documentation files (the "Software"), to deal
-
in the Software without restriction, including without limitation the rights
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-
copies of the Software, and to permit persons to whom the Software is
-
furnished to do so, subject to the following conditions:
+
2.2. Effective Date
-
The above copyright notice and this permission notice shall be included in all
-
copies or substantial portions of the Software.
+
The licenses granted in Section 2.1 with respect to any Contribution
+
become effective for each Contribution on the date the Contributor first
+
distributes such Contribution.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-
SOFTWARE.
+
2.3. Limitations on Grant Scope
+
+
The licenses granted in this Section 2 are the only rights granted under
+
this License. No additional rights or licenses will be implied from the
+
distribution or licensing of Covered Software under this License.
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
+
Contributor:
+
+
(a) for any code that a Contributor has removed from Covered Software;
+
or
+
+
(b) for infringements caused by: (i) Your and any other third party's
+
modifications of Covered Software, or (ii) the combination of its
+
Contributions with other software (except as part of its Contributor
+
Version); or
+
+
(c) under Patent Claims infringed by Covered Software in the absence of
+
its Contributions.
+
+
This License does not grant any rights in the trademarks, service marks,
+
or logos of any Contributor (except as may be necessary to comply with
+
the notice requirements in Section 3.4).
+
+
2.4. Subsequent Licenses
+
+
No Contributor makes additional grants as a result of Your choice to
+
distribute the Covered Software under a subsequent version of this
+
License (see Section 10.2) or under the terms of a Secondary License (if
+
permitted under the terms of Section 3.3).
+
+
2.5. Representation
+
+
Each Contributor represents that the Contributor believes its
+
Contributions are its original creation(s) or it has sufficient rights
+
to grant the rights to its Contributions conveyed by this License.
+
+
2.6. Fair Use
+
+
This License is not intended to limit any rights You have under
+
applicable copyright doctrines of fair use, fair dealing, or other
+
equivalents.
+
+
2.7. Conditions
+
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+
in Section 2.1.
+
+
3. Responsibilities
+
-------------------
+
+
3.1. Distribution of Source Form
+
+
All distribution of Covered Software in Source Code Form, including any
+
Modifications that You create or to which You contribute, must be under
+
the terms of this License. You must inform recipients that the Source
+
Code Form of the Covered Software is governed by the terms of this
+
License, and how they can obtain a copy of this License. You may not
+
attempt to alter or restrict the recipients' rights in the Source Code
+
Form.
+
+
3.2. Distribution of Executable Form
+
+
If You distribute Covered Software in Executable Form then:
+
+
(a) such Covered Software must also be made available in Source Code
+
Form, as described in Section 3.1, and You must inform recipients of
+
the Executable Form how they can obtain a copy of such Source Code
+
Form by reasonable means in a timely manner, at a charge no more
+
than the cost of distribution to the recipient; and
+
+
(b) You may distribute such Executable Form under the terms of this
+
License, or sublicense it under different terms, provided that the
+
license for the Executable Form does not attempt to limit or alter
+
the recipients' rights in the Source Code Form under this License.
+
+
3.3. Distribution of a Larger Work
+
+
You may create and distribute a Larger Work under terms of Your choice,
+
provided that You also comply with the requirements of this License for
+
the Covered Software. If the Larger Work is a combination of Covered
+
Software with a work governed by one or more Secondary Licenses, and the
+
Covered Software is not Incompatible With Secondary Licenses, this
+
License permits You to additionally distribute such Covered Software
+
under the terms of such Secondary License(s), so that the recipient of
+
the Larger Work may, at their option, further distribute the Covered
+
Software under the terms of either this License or such Secondary
+
License(s).
+
+
3.4. Notices
+
+
You may not remove or alter the substance of any license notices
+
(including copyright notices, patent notices, disclaimers of warranty,
+
or limitations of liability) contained within the Source Code Form of
+
the Covered Software, except that You may alter any license notices to
+
the extent required to remedy known factual inaccuracies.
+
+
3.5. Application of Additional Terms
+
+
You may choose to offer, and to charge a fee for, warranty, support,
+
indemnity or liability obligations to one or more recipients of Covered
+
Software. However, You may do so only on Your own behalf, and not on
+
behalf of any Contributor. You must make it absolutely clear that any
+
such warranty, support, indemnity, or liability obligation is offered by
+
You alone, and You hereby agree to indemnify every Contributor for any
+
liability incurred by such Contributor as a result of warranty, support,
+
indemnity or liability terms You offer. You may include additional
+
disclaimers of warranty and limitations of liability specific to any
+
jurisdiction.
+
+
4. Inability to Comply Due to Statute or Regulation
+
---------------------------------------------------
+
+
If it is impossible for You to comply with any of the terms of this
+
License with respect to some or all of the Covered Software due to
+
statute, judicial order, or regulation then You must: (a) comply with
+
the terms of this License to the maximum extent possible; and (b)
+
describe the limitations and the code they affect. Such description must
+
be placed in a text file included with all distributions of the Covered
+
Software under this License. Except to the extent prohibited by statute
+
or regulation, such description must be sufficiently detailed for a
+
recipient of ordinary skill to be able to understand it.
+
+
5. Termination
+
--------------
+
+
5.1. The rights granted under this License will terminate automatically
+
if You fail to comply with any of its terms. However, if You become
+
compliant, then the rights granted under this License from a particular
+
Contributor are reinstated (a) provisionally, unless and until such
+
Contributor explicitly and finally terminates Your grants, and (b) on an
+
ongoing basis, if such Contributor fails to notify You of the
+
non-compliance by some reasonable means prior to 60 days after You have
+
come back into compliance. Moreover, Your grants from a particular
+
Contributor are reinstated on an ongoing basis if such Contributor
+
notifies You of the non-compliance by some reasonable means, this is the
+
first time You have received notice of non-compliance with this License
+
from such Contributor, and You become compliant prior to 30 days after
+
Your receipt of the notice.
+
+
5.2. If You initiate litigation against any entity by asserting a patent
+
infringement claim (excluding declaratory judgment actions,
+
counter-claims, and cross-claims) alleging that a Contributor Version
+
directly or indirectly infringes any patent, then the rights granted to
+
You by any and all Contributors for the Covered Software under Section
+
2.1 of this License shall terminate.
+
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+
end user license agreements (excluding distributors and resellers) which
+
have been validly granted by You or Your distributors under this License
+
prior to termination shall survive termination.
+
+
************************************************************************
+
* *
+
* 6. Disclaimer of Warranty *
+
* ------------------------- *
+
* *
+
* Covered Software is provided under this License on an "as is" *
+
* basis, without warranty of any kind, either expressed, implied, or *
+
* statutory, including, without limitation, warranties that the *
+
* Covered Software is free of defects, merchantable, fit for a *
+
* particular purpose or non-infringing. The entire risk as to the *
+
* quality and performance of the Covered Software is with You. *
+
* Should any Covered Software prove defective in any respect, You *
+
* (not any Contributor) assume the cost of any necessary servicing, *
+
* repair, or correction. This disclaimer of warranty constitutes an *
+
* essential part of this License. No use of any Covered Software is *
+
* authorized under this License except under this disclaimer. *
+
* *
+
************************************************************************
+
+
************************************************************************
+
* *
+
* 7. Limitation of Liability *
+
* -------------------------- *
+
* *
+
* Under no circumstances and under no legal theory, whether tort *
+
* (including negligence), contract, or otherwise, shall any *
+
* Contributor, or anyone who distributes Covered Software as *
+
* permitted above, be liable to You for any direct, indirect, *
+
* special, incidental, or consequential damages of any character *
+
* including, without limitation, damages for lost profits, loss of *
+
* goodwill, work stoppage, computer failure or malfunction, or any *
+
* and all other commercial damages or losses, even if such party *
+
* shall have been informed of the possibility of such damages. This *
+
* limitation of liability shall not apply to liability for death or *
+
* personal injury resulting from such party's negligence to the *
+
* extent applicable law prohibits such limitation. Some *
+
* jurisdictions do not allow the exclusion or limitation of *
+
* incidental or consequential damages, so this exclusion and *
+
* limitation may not apply to You. *
+
* *
+
************************************************************************
+
+
8. Litigation
+
-------------
+
+
Any litigation relating to this License may be brought only in the
+
courts of a jurisdiction where the defendant maintains its principal
+
place of business and such litigation shall be governed by laws of that
+
jurisdiction, without reference to its conflict-of-law provisions.
+
Nothing in this Section shall prevent a party's ability to bring
+
cross-claims or counter-claims.
+
+
9. Miscellaneous
+
----------------
+
+
This License represents the complete agreement concerning the subject
+
matter hereof. If any provision of this License is held to be
+
unenforceable, such provision shall be reformed only to the extent
+
necessary to make it enforceable. Any law or regulation which provides
+
that the language of a contract shall be construed against the drafter
+
shall not be used to construe this License against a Contributor.
+
+
10. Versions of the License
+
---------------------------
+
+
10.1. New Versions
+
+
Mozilla Foundation is the license steward. Except as provided in Section
+
10.3, no one other than the license steward has the right to modify or
+
publish new versions of this License. Each version will be given a
+
distinguishing version number.
+
+
10.2. Effect of New Versions
+
+
You may distribute the Covered Software under the terms of the version
+
of the License under which You originally received the Covered Software,
+
or under the terms of any subsequent version published by the license
+
steward.
+
+
10.3. Modified Versions
+
+
If you create software not governed by this License, and you want to
+
create a new license for such software, you may create and use a
+
modified version of this License if you rename the license and remove
+
any references to the name of the license steward (except to note that
+
such modified license differs from this License).
+
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
+
Licenses
+
+
If You choose to distribute Source Code Form that is Incompatible With
+
Secondary Licenses under the terms of this version of the License, the
+
notice described in Exhibit B of this License must be attached.
+
+
Exhibit A - Source Code Form License Notice
+
-------------------------------------------
+
+
This Source Code Form is subject to the terms of the Mozilla Public
+
License, v. 2.0. If a copy of the MPL was not distributed with this
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
If it is not possible or desirable to put the notice in a particular
+
file, then You may include the notice in a location (such as a LICENSE
+
file in a relevant directory) where a recipient would be likely to look
+
for such a notice.
+
+
You may add additional accurate notices of copyright ownership.
+
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
+
---------------------------------------------------------
+
+
This Source Code Form is "Incompatible With Secondary Licenses", as
+
defined by the Mozilla Public License, v. 2.0.
+13 -11
README.md
···
A suite of Rust crates for the AT Protocol.
+
+
## Goals
+
+
- Validated, spec-compliant, easy to work with, and performant baseline types (including typed at:// uris)
+
- Batteries-included, but easily replaceable batteries.
+
- Easy to extend with custom lexicons
+
- lexicon Value type for working with unknown atproto data (dag-cbor or json)
+
- order of magnitude less boilerplate than some existing crates
+
- either the codegen produces code that's easy to work with, or there are good handwritten wrappers
+
- didDoc type with helper methods for getting handles, multikey, and PDS endpoint
+
- use as much or as little from the crates as you need
+
+
## Example
Dead simple api client. Logs in, prints the latest 5 posts from your timeline.
···
Ok(())
}
```
-
-
## Goals
-
-
- Validated, spec-compliant, easy to work with, and performant baseline types (including typed at:// uris)
-
- Batteries-included, but easily replaceable batteries.
-
- Easy to extend with custom lexicons
-
- lexicon Value type for working with unknown atproto data (dag-cbor or json)
-
- order of magnitude less boilerplate than some existing crates
-
- either the codegen produces code that's easy to work with, or there are good handwritten wrappers
-
- didDoc type with helper methods for getting handles, multikey, and PDS endpoint
-
- use as much or as little from the crates as you need
## Development
+3 -3
crates/jacquard-api/Cargo.toml
···
keywords.workspace = true
categories.workspace = true
readme.workspace = true
-
documentation = "https://docs.rs/jacquard-api"
exclude.workspace = true
+
license-file.workspace = true
[features]
default = [ "com_atproto"]
···
[dependencies]
bon = "3"
bytes = { workspace = true, features = ["serde"] }
-
jacquard-common = { path = "../jacquard-common" }
-
jacquard-derive = { path = "../jacquard-derive" }
+
jacquard-common = { version = "0.1.0", path = "../jacquard-common" }
+
jacquard-derive = { version = "0.1.0", path = "../jacquard-derive" }
miette.workspace = true
serde.workspace = true
thiserror.workspace = true
+1 -2
crates/jacquard-common/Cargo.toml
···
keywords.workspace = true
categories.workspace = true
readme.workspace = true
-
documentation = "https://docs.rs/jacquard-common"
exclude.workspace = true
-
+
license-file.workspace = true
[dependencies]
+2 -2
crates/jacquard-derive/Cargo.toml
···
keywords.workspace = true
categories.workspace = true
readme.workspace = true
-
documentation = "https://docs.rs/jacquard-derive"
exclude.workspace = true
+
license-file.workspace = true
[lib]
proc-macro = true
···
[dev-dependencies]
-
jacquard-common = { path = "../jacquard-common" }
+
jacquard-common = { version = "0.1.0", path = "../jacquard-common" }
+5 -2
crates/jacquard-lexicon/Cargo.toml
···
keywords.workspace = true
categories.workspace = true
readme.workspace = true
-
documentation.workspace = true
exclude.workspace = true
+
license-file.workspace = true
[[bin]]
name = "jacquard-codegen"
···
clap.workspace = true
heck.workspace = true
itertools.workspace = true
-
jacquard-common = { path = "../jacquard-common" }
+
jacquard-common = { version = "0.1.0", path = "../jacquard-common" }
miette = { workspace = true, features = ["fancy"] }
prettyplease.workspace = true
proc-macro2.workspace = true
···
serde_with.workspace = true
syn.workspace = true
thiserror.workspace = true
+
+
[dev-dependencies]
+
tempfile = { version = "3.23.0" }
+21 -35
crates/jacquard-lexicon/src/codegen.rs
···
let mut fields = Vec::new();
for (field_name, field_type) in &obj.properties {
let is_required = required.contains(field_name);
-
let field_tokens =
-
self.generate_field(nsid, parent_type_name, field_name, field_type, is_required, is_builder)?;
+
let field_tokens = self.generate_field(
+
nsid,
+
parent_type_name,
+
field_name,
+
field_type,
+
is_required,
+
is_builder,
+
)?;
fields.push(field_tokens);
}
···
LexXrpcParametersProperty::Integer(_) => (quote! { i64 }, false, false),
LexXrpcParametersProperty::String(s) => {
let is_cowstr = s.format.is_none(); // CowStr for plain strings
-
(self.string_to_rust_type(s), self.string_needs_lifetime(s), is_cowstr)
-
}
-
LexXrpcParametersProperty::Unknown(_) => {
-
(quote! { jacquard_common::types::value::Data<'a> }, true, false)
+
(
+
self.string_to_rust_type(s),
+
self.string_needs_lifetime(s),
+
is_cowstr,
+
)
+
LexXrpcParametersProperty::Unknown(_) => (
+
quote! { jacquard_common::types::value::Data<'a> },
+
true,
+
false,
+
),
LexXrpcParametersProperty::Array(arr) => {
let needs_lifetime = match &arr.items {
crate::lexicon::LexPrimitiveArrayItem::Boolean(_)
···
LexiconCorpus::load_from_dir("tests/fixtures/test_lexicons").expect("load corpus");
let codegen = CodeGenerator::new(&corpus, "test_generated");
-
let output_dir = std::path::PathBuf::from("target/test_codegen_output");
+
let tmp_dir =
+
tempfile::tempdir().expect("should be able to create temp directory for output");
+
let output_dir = std::path::PathBuf::from(tmp_dir.path());
// Clean up any previous test output
let _ = std::fs::remove_dir_all(&output_dir);
···
.expect("read post.rs");
assert!(post_content.contains("pub struct Post"));
assert!(post_content.contains("jacquard_common"));
-
}
-
-
#[test]
-
#[ignore] // run manually: cargo test test_generate_full_atproto -- --ignored
-
fn test_generate_full_atproto() {
-
let corpus = LexiconCorpus::load_from_dir("tests/fixtures/lexicons/atproto/lexicons")
-
.expect("load atproto corpus");
-
let codegen = CodeGenerator::new(&corpus, "crate");
-
-
let output_dir = std::path::PathBuf::from("../jacquard-api/src");
-
-
// Clean up existing generated code
-
if output_dir.exists() {
-
for entry in std::fs::read_dir(&output_dir).expect("read output dir") {
-
let entry = entry.expect("dir entry");
-
let path = entry.path();
-
if path.is_dir() {
-
std::fs::remove_dir_all(&path).ok();
-
} else if path.extension().map_or(false, |e| e == "rs") {
-
std::fs::remove_file(&path).ok();
-
}
-
}
-
}
-
-
// Generate and write
-
codegen.write_to_disk(&output_dir).expect("write to disk");
-
-
println!("\n✨ Generated full atproto API to {:?}", output_dir);
-8
crates/jacquard-lexicon/target/test_codegen_output/app_bsky.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod embed;
-
pub mod feed;
-
pub mod richtext;
-10
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod external;
-
pub mod images;
-
pub mod record;
-
pub mod record_with_media;
-
pub mod video;
-99
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed/external.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.embed.external
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct External<'a> {
-
#[serde(borrow)]
-
pub description: jacquard_common::CowStr<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub thumb: std::option::Option<jacquard_common::types::blob::Blob<'a>>,
-
#[serde(borrow)]
-
pub title: jacquard_common::CowStr<'a>,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::Uri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for External<'_> {
-
type Output = External<'static>;
-
fn into_static(self) -> Self::Output {
-
External {
-
description: self.description.into_static(),
-
thumb: self.thumb.into_static(),
-
title: self.title.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ExternalRecord<'a> {
-
#[serde(borrow)]
-
pub external: test_generated::app_bsky::embed::external::External<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ExternalRecord<'_> {
-
type Output = ExternalRecord<'static>;
-
fn into_static(self) -> Self::Output {
-
ExternalRecord {
-
external: self.external.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct View<'a> {
-
#[serde(borrow)]
-
pub external: test_generated::app_bsky::embed::external::ViewExternal<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for View<'_> {
-
type Output = View<'static>;
-
fn into_static(self) -> Self::Output {
-
View {
-
external: self.external.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewExternal<'a> {
-
#[serde(borrow)]
-
pub description: jacquard_common::CowStr<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub thumb: std::option::Option<jacquard_common::types::string::Uri<'a>>,
-
#[serde(borrow)]
-
pub title: jacquard_common::CowStr<'a>,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::Uri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewExternal<'_> {
-
type Output = ViewExternal<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewExternal {
-
description: self.description.into_static(),
-
thumb: self.thumb.into_static(),
-
title: self.title.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-99
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed/images.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.embed.images
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Image<'a> {
-
///Alt text description of the image, for accessibility.
-
#[serde(borrow)]
-
pub alt: jacquard_common::CowStr<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub aspect_ratio: std::option::Option<jacquard_common::types::value::Data<'a>>,
-
#[serde(borrow)]
-
pub image: jacquard_common::types::blob::Blob<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Image<'_> {
-
type Output = Image<'static>;
-
fn into_static(self) -> Self::Output {
-
Image {
-
alt: self.alt.into_static(),
-
aspect_ratio: self.aspect_ratio.into_static(),
-
image: self.image.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Images<'a> {
-
#[serde(borrow)]
-
pub images: Vec<test_generated::app_bsky::embed::images::Image<'a>>,
-
}
-
-
impl jacquard_common::IntoStatic for Images<'_> {
-
type Output = Images<'static>;
-
fn into_static(self) -> Self::Output {
-
Images {
-
images: self.images.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct View<'a> {
-
#[serde(borrow)]
-
pub images: Vec<test_generated::app_bsky::embed::images::ViewImage<'a>>,
-
}
-
-
impl jacquard_common::IntoStatic for View<'_> {
-
type Output = View<'static>;
-
fn into_static(self) -> Self::Output {
-
View {
-
images: self.images.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewImage<'a> {
-
///Alt text description of the image, for accessibility.
-
#[serde(borrow)]
-
pub alt: jacquard_common::CowStr<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub aspect_ratio: std::option::Option<jacquard_common::types::value::Data<'a>>,
-
///Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View.
-
#[serde(borrow)]
-
pub fullsize: jacquard_common::types::string::Uri<'a>,
-
///Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.
-
#[serde(borrow)]
-
pub thumb: jacquard_common::types::string::Uri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewImage<'_> {
-
type Output = ViewImage<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewImage {
-
alt: self.alt.into_static(),
-
aspect_ratio: self.aspect_ratio.into_static(),
-
fullsize: self.fullsize.into_static(),
-
thumb: self.thumb.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-169
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed/record.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.embed.record
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Record<'a> {
-
#[serde(borrow)]
-
pub record: test_generated::com_atproto::repo::strong_ref::StrongRef<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Record<'_> {
-
type Output = Record<'static>;
-
fn into_static(self) -> Self::Output {
-
Record {
-
record: self.record.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct View<'a> {
-
#[serde(borrow)]
-
pub record: ViewRecordRecord<'a>,
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(tag = "$type")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum ViewRecordRecord<'a> {}
-
impl jacquard_common::IntoStatic for ViewRecordRecord<'_> {
-
type Output = ViewRecordRecord<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
ViewRecordRecord::Unknown(v) => ViewRecordRecord::Unknown(v.into_static()),
-
}
-
}
-
}
-
-
impl jacquard_common::IntoStatic for View<'_> {
-
type Output = View<'static>;
-
fn into_static(self) -> Self::Output {
-
View {
-
record: self.record.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewBlocked<'a> {
-
#[serde(borrow)]
-
pub author: jacquard_common::types::value::Data<'a>,
-
pub blocked: bool,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::AtUri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewBlocked<'_> {
-
type Output = ViewBlocked<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewBlocked {
-
author: self.author.into_static(),
-
blocked: self.blocked.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewDetached<'a> {
-
pub detached: bool,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::AtUri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewDetached<'_> {
-
type Output = ViewDetached<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewDetached {
-
detached: self.detached.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewNotFound<'a> {
-
pub not_found: bool,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::AtUri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewNotFound<'_> {
-
type Output = ViewNotFound<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewNotFound {
-
not_found: self.not_found.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ViewRecord<'a> {
-
#[serde(borrow)]
-
pub author: jacquard_common::types::value::Data<'a>,
-
#[serde(borrow)]
-
pub cid: jacquard_common::types::string::Cid<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub embeds: std::option::Option<Vec<jacquard_common::types::value::Data<'a>>>,
-
pub indexed_at: jacquard_common::types::string::Datetime,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub labels: std::option::Option<Vec<test_generated::com_atproto::label::Label<'a>>>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub like_count: std::option::Option<i64>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub quote_count: std::option::Option<i64>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub reply_count: std::option::Option<i64>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub repost_count: std::option::Option<i64>,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::AtUri<'a>,
-
///The record data itself.
-
#[serde(borrow)]
-
pub value: jacquard_common::types::value::Data<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ViewRecord<'_> {
-
type Output = ViewRecord<'static>;
-
fn into_static(self) -> Self::Output {
-
ViewRecord {
-
author: self.author.into_static(),
-
cid: self.cid.into_static(),
-
embeds: self.embeds.into_static(),
-
indexed_at: self.indexed_at.into_static(),
-
labels: self.labels.into_static(),
-
like_count: self.like_count.into_static(),
-
quote_count: self.quote_count.into_static(),
-
reply_count: self.reply_count.into_static(),
-
repost_count: self.repost_count.into_static(),
-
uri: self.uri.into_static(),
-
value: self.value.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-110
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed/record_with_media.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.embed.recordWithMedia
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct RecordWithMedia<'a> {
-
#[serde(borrow)]
-
pub media: RecordWithMediaRecordMedia<'a>,
-
#[serde(borrow)]
-
pub record: test_generated::app_bsky::embed::record::Record<'a>,
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(tag = "$type")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum RecordWithMediaRecordMedia<'a> {
-
#[serde(rename = "app.bsky.embed.images")]
-
Images(Box<test_generated::app_bsky::embed::images::Images<'a>>),
-
#[serde(rename = "app.bsky.embed.video")]
-
Video(Box<test_generated::app_bsky::embed::video::Video<'a>>),
-
#[serde(rename = "app.bsky.embed.external")]
-
External(Box<test_generated::app_bsky::embed::external::ExternalRecord<'a>>),
-
}
-
-
impl jacquard_common::IntoStatic for RecordWithMediaRecordMedia<'_> {
-
type Output = RecordWithMediaRecordMedia<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
RecordWithMediaRecordMedia::Images(v) => {
-
RecordWithMediaRecordMedia::Images(v.into_static())
-
}
-
RecordWithMediaRecordMedia::Video(v) => {
-
RecordWithMediaRecordMedia::Video(v.into_static())
-
}
-
RecordWithMediaRecordMedia::External(v) => {
-
RecordWithMediaRecordMedia::External(v.into_static())
-
}
-
RecordWithMediaRecordMedia::Unknown(v) => {
-
RecordWithMediaRecordMedia::Unknown(v.into_static())
-
}
-
}
-
}
-
}
-
-
impl jacquard_common::IntoStatic for RecordWithMedia<'_> {
-
type Output = RecordWithMedia<'static>;
-
fn into_static(self) -> Self::Output {
-
RecordWithMedia {
-
media: self.media.into_static(),
-
record: self.record.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct View<'a> {
-
#[serde(borrow)]
-
pub media: ViewRecordMedia<'a>,
-
#[serde(borrow)]
-
pub record: test_generated::app_bsky::embed::record::View<'a>,
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(tag = "$type")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum ViewRecordMedia<'a> {
-
#[serde(rename = "app.bsky.embed.images#view")]
-
ImagesView(Box<test_generated::app_bsky::embed::images::View<'a>>),
-
#[serde(rename = "app.bsky.embed.video#view")]
-
VideoView(Box<test_generated::app_bsky::embed::video::View<'a>>),
-
#[serde(rename = "app.bsky.embed.external#view")]
-
ExternalView(Box<test_generated::app_bsky::embed::external::View<'a>>),
-
}
-
-
impl jacquard_common::IntoStatic for ViewRecordMedia<'_> {
-
type Output = ViewRecordMedia<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
ViewRecordMedia::ImagesView(v) => {
-
ViewRecordMedia::ImagesView(v.into_static())
-
}
-
ViewRecordMedia::VideoView(v) => ViewRecordMedia::VideoView(v.into_static()),
-
ViewRecordMedia::ExternalView(v) => {
-
ViewRecordMedia::ExternalView(v.into_static())
-
}
-
ViewRecordMedia::Unknown(v) => ViewRecordMedia::Unknown(v.into_static()),
-
}
-
}
-
}
-
-
impl jacquard_common::IntoStatic for View<'_> {
-
type Output = View<'static>;
-
fn into_static(self) -> Self::Output {
-
View {
-
media: self.media.into_static(),
-
record: self.record.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-93
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/embed/video.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.embed.video
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Caption<'a> {
-
#[serde(borrow)]
-
pub file: jacquard_common::types::blob::Blob<'a>,
-
pub lang: jacquard_common::types::string::Language,
-
}
-
-
impl jacquard_common::IntoStatic for Caption<'_> {
-
type Output = Caption<'static>;
-
fn into_static(self) -> Self::Output {
-
Caption {
-
file: self.file.into_static(),
-
lang: self.lang.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Video<'a> {
-
///Alt text description of the video, for accessibility.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub aspect_ratio: std::option::Option<jacquard_common::types::value::Data<'a>>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub captions: std::option::Option<
-
Vec<test_generated::app_bsky::embed::video::Caption<'a>>,
-
>,
-
///The mp4 video file. May be up to 100mb, formerly limited to 50mb.
-
#[serde(borrow)]
-
pub video: jacquard_common::types::blob::Blob<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Video<'_> {
-
type Output = Video<'static>;
-
fn into_static(self) -> Self::Output {
-
Video {
-
alt: self.alt.into_static(),
-
aspect_ratio: self.aspect_ratio.into_static(),
-
captions: self.captions.into_static(),
-
video: self.video.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct View<'a> {
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub aspect_ratio: std::option::Option<jacquard_common::types::value::Data<'a>>,
-
#[serde(borrow)]
-
pub cid: jacquard_common::types::string::Cid<'a>,
-
#[serde(borrow)]
-
pub playlist: jacquard_common::types::string::Uri<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub thumbnail: std::option::Option<jacquard_common::types::string::Uri<'a>>,
-
}
-
-
impl jacquard_common::IntoStatic for View<'_> {
-
type Output = View<'static>;
-
fn into_static(self) -> Self::Output {
-
View {
-
alt: self.alt.into_static(),
-
aspect_ratio: self.aspect_ratio.into_static(),
-
cid: self.cid.into_static(),
-
playlist: self.playlist.into_static(),
-
thumbnail: self.thumbnail.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-7
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/feed.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod get_author_feed;
-
pub mod post;
-128
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/feed/get_author_feed.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.feed.getAuthorFeed
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct GetAuthorFeed<'a> {
-
#[serde(borrow)]
-
pub actor: jacquard_common::types::ident::AtIdentifier<'a>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
-
///(default: "posts_with_replies")
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub filter: std::option::Option<jacquard_common::CowStr<'a>>,
-
///(default: false)
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub include_pins: std::option::Option<bool>,
-
///(default: 50, min: 1, max: 100)
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub limit: std::option::Option<i64>,
-
}
-
-
impl jacquard_common::IntoStatic for GetAuthorFeed<'_> {
-
type Output = GetAuthorFeed<'static>;
-
fn into_static(self) -> Self::Output {
-
GetAuthorFeed {
-
actor: self.actor.into_static(),
-
cursor: self.cursor.into_static(),
-
filter: self.filter.into_static(),
-
include_pins: self.include_pins.into_static(),
-
limit: self.limit.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct GetAuthorFeedOutput<'a> {
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
-
#[serde(borrow)]
-
pub feed: Vec<jacquard_common::types::value::Data<'a>>,
-
}
-
-
impl jacquard_common::IntoStatic for GetAuthorFeedOutput<'_> {
-
type Output = GetAuthorFeedOutput<'static>;
-
fn into_static(self) -> Self::Output {
-
GetAuthorFeedOutput {
-
cursor: self.cursor.into_static(),
-
feed: self.feed.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(
-
serde::Serialize,
-
serde::Deserialize,
-
Debug,
-
Clone,
-
PartialEq,
-
Eq,
-
thiserror::Error,
-
miette::Diagnostic
-
)]
-
#[serde(tag = "error", content = "message")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum GetAuthorFeedError<'a> {
-
#[serde(rename = "BlockedActor")]
-
BlockedActor(std::option::Option<String>),
-
#[serde(rename = "BlockedByActor")]
-
BlockedByActor(std::option::Option<String>),
-
}
-
-
impl std::fmt::Display for GetAuthorFeedError<'_> {
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-
match self {
-
Self::BlockedActor(msg) => {
-
write!(f, "BlockedActor")?;
-
if let Some(msg) = msg {
-
write!(f, ": {}", msg)?;
-
}
-
Ok(())
-
}
-
Self::BlockedByActor(msg) => {
-
write!(f, "BlockedByActor")?;
-
if let Some(msg) = msg {
-
write!(f, ": {}", msg)?;
-
}
-
Ok(())
-
}
-
Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
-
}
-
}
-
}
-
-
impl jacquard_common::IntoStatic for GetAuthorFeedError<'_> {
-
type Output = GetAuthorFeedError<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
GetAuthorFeedError::BlockedActor(v) => {
-
GetAuthorFeedError::BlockedActor(v.into_static())
-
}
-
GetAuthorFeedError::BlockedByActor(v) => {
-
GetAuthorFeedError::BlockedByActor(v.into_static())
-
}
-
GetAuthorFeedError::Unknown(v) => {
-
GetAuthorFeedError::Unknown(v.into_static())
-
}
-
}
-
}
-
}
-
-
impl jacquard_common::types::xrpc::XrpcRequest for GetAuthorFeed<'_> {
-
const NSID: &'static str = "app.bsky.feed.getAuthorFeed";
-
const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
-
const OUTPUT_ENCODING: &'static str = "application/json";
-
type Output<'de> = GetAuthorFeedOutput<'de>;
-
type Err<'de> = GetAuthorFeedError<'de>;
-
}
-192
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/feed/post.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.feed.post
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
///Deprecated: use facets instead.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Entity<'a> {
-
#[serde(borrow)]
-
pub index: test_generated::app_bsky::feed::post::TextSlice<'a>,
-
///Expected values are 'mention' and 'link'.
-
#[serde(borrow)]
-
pub r#type: jacquard_common::CowStr<'a>,
-
#[serde(borrow)]
-
pub value: jacquard_common::CowStr<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Entity<'_> {
-
type Output = Entity<'static>;
-
fn into_static(self) -> Self::Output {
-
Entity {
-
index: self.index.into_static(),
-
r#type: self.r#type.into_static(),
-
value: self.value.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Record containing a Bluesky post.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Post<'a> {
-
///Client-declared timestamp when this post was originally created.
-
pub created_at: jacquard_common::types::string::Datetime,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub embed: std::option::Option<PostRecordEmbed<'a>>,
-
///DEPRECATED: replaced by app.bsky.richtext.facet.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub entities: std::option::Option<
-
Vec<test_generated::app_bsky::feed::post::Entity<'a>>,
-
>,
-
///Annotations of text (mentions, URLs, hashtags, etc)
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub facets: std::option::Option<
-
Vec<test_generated::app_bsky::richtext::facet::Facet<'a>>,
-
>,
-
///Self-label values for this post. Effectively content warnings.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub labels: std::option::Option<PostRecordLabels<'a>>,
-
///Indicates human language of post primary text content.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub langs: std::option::Option<Vec<jacquard_common::types::string::Language>>,
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub reply: std::option::Option<test_generated::app_bsky::feed::post::ReplyRef<'a>>,
-
///Additional hashtags, in addition to any included in post text and facets.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
-
///The primary post content. May be an empty string, if there are embeds.
-
#[serde(borrow)]
-
pub text: jacquard_common::CowStr<'a>,
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(tag = "$type")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum PostRecordEmbed<'a> {
-
#[serde(rename = "app.bsky.embed.images")]
-
Images(Box<test_generated::app_bsky::embed::images::Images<'a>>),
-
#[serde(rename = "app.bsky.embed.video")]
-
Video(Box<test_generated::app_bsky::embed::video::Video<'a>>),
-
#[serde(rename = "app.bsky.embed.external")]
-
External(Box<test_generated::app_bsky::embed::external::ExternalRecord<'a>>),
-
#[serde(rename = "app.bsky.embed.record")]
-
Record(Box<test_generated::app_bsky::embed::record::Record<'a>>),
-
#[serde(rename = "app.bsky.embed.recordWithMedia")]
-
RecordWithMedia(
-
Box<test_generated::app_bsky::embed::record_with_media::RecordWithMedia<'a>>,
-
),
-
}
-
-
impl jacquard_common::IntoStatic for PostRecordEmbed<'_> {
-
type Output = PostRecordEmbed<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
PostRecordEmbed::Images(v) => PostRecordEmbed::Images(v.into_static()),
-
PostRecordEmbed::Video(v) => PostRecordEmbed::Video(v.into_static()),
-
PostRecordEmbed::External(v) => PostRecordEmbed::External(v.into_static()),
-
PostRecordEmbed::Record(v) => PostRecordEmbed::Record(v.into_static()),
-
PostRecordEmbed::RecordWithMedia(v) => {
-
PostRecordEmbed::RecordWithMedia(v.into_static())
-
}
-
PostRecordEmbed::Unknown(v) => PostRecordEmbed::Unknown(v.into_static()),
-
}
-
}
-
}
-
-
#[jacquard_derive::open_union]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(tag = "$type")]
-
#[serde(bound(deserialize = "'de: 'a"))]
-
pub enum PostRecordLabels<'a> {
-
#[serde(rename = "com.atproto.label.defs#selfLabels")]
-
DefsSelfLabels(Box<test_generated::com_atproto::label::SelfLabels<'a>>),
-
}
-
-
impl jacquard_common::IntoStatic for PostRecordLabels<'_> {
-
type Output = PostRecordLabels<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
PostRecordLabels::DefsSelfLabels(v) => {
-
PostRecordLabels::DefsSelfLabels(v.into_static())
-
}
-
PostRecordLabels::Unknown(v) => PostRecordLabels::Unknown(v.into_static()),
-
}
-
}
-
}
-
-
impl jacquard_common::types::collection::Collection for Post<'_> {
-
const NSID: &'static str = "app.bsky.feed.post";
-
}
-
-
impl jacquard_common::IntoStatic for Post<'_> {
-
type Output = Post<'static>;
-
fn into_static(self) -> Self::Output {
-
Post {
-
created_at: self.created_at.into_static(),
-
embed: self.embed.into_static(),
-
entities: self.entities.into_static(),
-
facets: self.facets.into_static(),
-
labels: self.labels.into_static(),
-
langs: self.langs.into_static(),
-
reply: self.reply.into_static(),
-
tags: self.tags.into_static(),
-
text: self.text.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ReplyRef<'a> {
-
#[serde(borrow)]
-
pub parent: test_generated::com_atproto::repo::strong_ref::StrongRef<'a>,
-
#[serde(borrow)]
-
pub root: test_generated::com_atproto::repo::strong_ref::StrongRef<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for ReplyRef<'_> {
-
type Output = ReplyRef<'static>;
-
fn into_static(self) -> Self::Output {
-
ReplyRef {
-
parent: self.parent.into_static(),
-
root: self.root.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct TextSlice<'a> {
-
pub end: i64,
-
pub start: i64,
-
}
-
-
impl jacquard_common::IntoStatic for TextSlice<'_> {
-
type Output = TextSlice<'static>;
-
fn into_static(self) -> Self::Output {
-
TextSlice {
-
end: self.end.into_static(),
-
start: self.start.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-6
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/richtext.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod facet;
-105
crates/jacquard-lexicon/target/test_codegen_output/app_bsky/richtext/facet.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: app.bsky.richtext.facet
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
///Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct ByteSlice<'a> {
-
pub byte_end: i64,
-
pub byte_start: i64,
-
}
-
-
impl jacquard_common::IntoStatic for ByteSlice<'_> {
-
type Output = ByteSlice<'static>;
-
fn into_static(self) -> Self::Output {
-
ByteSlice {
-
byte_end: self.byte_end.into_static(),
-
byte_start: self.byte_start.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Link<'a> {
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::Uri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Link<'_> {
-
type Output = Link<'static>;
-
fn into_static(self) -> Self::Output {
-
Link {
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Annotation of a sub-string within rich text.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Facet<'a> {
-
#[serde(borrow)]
-
pub features: Vec<jacquard_common::types::value::Data<'a>>,
-
#[serde(borrow)]
-
pub index: test_generated::app_bsky::richtext::facet::ByteSlice<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Facet<'_> {
-
type Output = Facet<'static>;
-
fn into_static(self) -> Self::Output {
-
Facet {
-
features: self.features.into_static(),
-
index: self.index.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Mention<'a> {
-
#[serde(borrow)]
-
pub did: jacquard_common::types::string::Did<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Mention<'_> {
-
type Output = Mention<'static>;
-
fn into_static(self) -> Self::Output {
-
Mention {
-
did: self.did.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Tag<'a> {
-
#[serde(borrow)]
-
pub tag: jacquard_common::CowStr<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for Tag<'_> {
-
type Output = Tag<'static>;
-
fn into_static(self) -> Self::Output {
-
Tag {
-
tag: self.tag.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-7
crates/jacquard-lexicon/target/test_codegen_output/com_atproto.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod label;
-
pub mod repo;
-287
crates/jacquard-lexicon/target/test_codegen_output/com_atproto/label.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: com.atproto.label.defs
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
///Metadata tag on an atproto resource (eg, repo or record).
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct Label<'a> {
-
///Optionally, CID specifying the specific version of 'uri' resource this label applies to.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
-
///Timestamp when this label was created.
-
pub cts: jacquard_common::types::string::Datetime,
-
///Timestamp at which this label expires (no longer applies).
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub exp: std::option::Option<jacquard_common::types::string::Datetime>,
-
///If true, this is a negation label, overwriting a previous label.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub neg: std::option::Option<bool>,
-
///Signature of dag-cbor encoded label.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub sig: std::option::Option<bytes::Bytes>,
-
///DID of the actor who created this label.
-
#[serde(borrow)]
-
pub src: jacquard_common::types::string::Did<'a>,
-
///AT URI of the record, repository (account), or other resource that this label applies to.
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::Uri<'a>,
-
///The short string name of the value or type of this label.
-
#[serde(borrow)]
-
pub val: jacquard_common::CowStr<'a>,
-
///The AT Protocol version of the label object.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub ver: std::option::Option<i64>,
-
}
-
-
impl jacquard_common::IntoStatic for Label<'_> {
-
type Output = Label<'static>;
-
fn into_static(self) -> Self::Output {
-
Label {
-
cid: self.cid.into_static(),
-
cts: self.cts.into_static(),
-
exp: self.exp.into_static(),
-
neg: self.neg.into_static(),
-
sig: self.sig.into_static(),
-
src: self.src.into_static(),
-
uri: self.uri.into_static(),
-
val: self.val.into_static(),
-
ver: self.ver.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
-
pub enum LabelValue<'a> {
-
Hide,
-
NoPromote,
-
Warn,
-
NoUnauthenticated,
-
DmcaViolation,
-
Doxxing,
-
Porn,
-
Sexual,
-
Nudity,
-
Nsfl,
-
Gore,
-
Other(jacquard_common::CowStr<'a>),
-
}
-
-
impl<'a> LabelValue<'a> {
-
pub fn as_str(&self) -> &str {
-
match self {
-
Self::Hide => "!hide",
-
Self::NoPromote => "!no-promote",
-
Self::Warn => "!warn",
-
Self::NoUnauthenticated => "!no-unauthenticated",
-
Self::DmcaViolation => "dmca-violation",
-
Self::Doxxing => "doxxing",
-
Self::Porn => "porn",
-
Self::Sexual => "sexual",
-
Self::Nudity => "nudity",
-
Self::Nsfl => "nsfl",
-
Self::Gore => "gore",
-
Self::Other(s) => s.as_ref(),
-
}
-
}
-
}
-
-
impl<'a> From<&'a str> for LabelValue<'a> {
-
fn from(s: &'a str) -> Self {
-
match s {
-
"!hide" => Self::Hide,
-
"!no-promote" => Self::NoPromote,
-
"!warn" => Self::Warn,
-
"!no-unauthenticated" => Self::NoUnauthenticated,
-
"dmca-violation" => Self::DmcaViolation,
-
"doxxing" => Self::Doxxing,
-
"porn" => Self::Porn,
-
"sexual" => Self::Sexual,
-
"nudity" => Self::Nudity,
-
"nsfl" => Self::Nsfl,
-
"gore" => Self::Gore,
-
_ => Self::Other(jacquard_common::CowStr::from(s)),
-
}
-
}
-
}
-
-
impl<'a> From<String> for LabelValue<'a> {
-
fn from(s: String) -> Self {
-
match s.as_str() {
-
"!hide" => Self::Hide,
-
"!no-promote" => Self::NoPromote,
-
"!warn" => Self::Warn,
-
"!no-unauthenticated" => Self::NoUnauthenticated,
-
"dmca-violation" => Self::DmcaViolation,
-
"doxxing" => Self::Doxxing,
-
"porn" => Self::Porn,
-
"sexual" => Self::Sexual,
-
"nudity" => Self::Nudity,
-
"nsfl" => Self::Nsfl,
-
"gore" => Self::Gore,
-
_ => Self::Other(jacquard_common::CowStr::from(s)),
-
}
-
}
-
}
-
-
impl<'a> AsRef<str> for LabelValue<'a> {
-
fn as_ref(&self) -> &str {
-
self.as_str()
-
}
-
}
-
-
impl<'a> serde::Serialize for LabelValue<'a> {
-
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
-
where
-
S: serde::Serializer,
-
{
-
serializer.serialize_str(self.as_str())
-
}
-
}
-
-
impl<'de, 'a> serde::Deserialize<'de> for LabelValue<'a>
-
where
-
'de: 'a,
-
{
-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-
where
-
D: serde::Deserializer<'de>,
-
{
-
let s = <&'de str>::deserialize(deserializer)?;
-
Ok(Self::from(s))
-
}
-
}
-
-
impl jacquard_common::IntoStatic for LabelValue<'_> {
-
type Output = LabelValue<'static>;
-
fn into_static(self) -> Self::Output {
-
match self {
-
LabelValue::Hide => LabelValue::Hide,
-
LabelValue::NoPromote => LabelValue::NoPromote,
-
LabelValue::Warn => LabelValue::Warn,
-
LabelValue::NoUnauthenticated => LabelValue::NoUnauthenticated,
-
LabelValue::DmcaViolation => LabelValue::DmcaViolation,
-
LabelValue::Doxxing => LabelValue::Doxxing,
-
LabelValue::Porn => LabelValue::Porn,
-
LabelValue::Sexual => LabelValue::Sexual,
-
LabelValue::Nudity => LabelValue::Nudity,
-
LabelValue::Nsfl => LabelValue::Nsfl,
-
LabelValue::Gore => LabelValue::Gore,
-
LabelValue::Other(v) => LabelValue::Other(v.into_static()),
-
}
-
}
-
}
-
-
///Declares a label value and its expected interpretations and behaviors.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct LabelValueDefinition<'a> {
-
///Does the user need to have adult content enabled in order to configure this label?
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
pub adult_only: std::option::Option<bool>,
-
///What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.
-
#[serde(borrow)]
-
pub blurs: jacquard_common::CowStr<'a>,
-
///The default setting for this label.
-
#[serde(skip_serializing_if = "std::option::Option::is_none")]
-
#[serde(borrow)]
-
pub default_setting: std::option::Option<jacquard_common::CowStr<'a>>,
-
///The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).
-
#[serde(borrow)]
-
pub identifier: jacquard_common::CowStr<'a>,
-
#[serde(borrow)]
-
pub locales: Vec<
-
test_generated::com_atproto::label::LabelValueDefinitionStrings<'a>,
-
>,
-
///How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.
-
#[serde(borrow)]
-
pub severity: jacquard_common::CowStr<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for LabelValueDefinition<'_> {
-
type Output = LabelValueDefinition<'static>;
-
fn into_static(self) -> Self::Output {
-
LabelValueDefinition {
-
adult_only: self.adult_only.into_static(),
-
blurs: self.blurs.into_static(),
-
default_setting: self.default_setting.into_static(),
-
identifier: self.identifier.into_static(),
-
locales: self.locales.into_static(),
-
severity: self.severity.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Strings which describe the label in the UI, localized into a specific language.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct LabelValueDefinitionStrings<'a> {
-
///A longer description of what the label means and why it might be applied.
-
#[serde(borrow)]
-
pub description: jacquard_common::CowStr<'a>,
-
///The code of the language these strings are written in.
-
pub lang: jacquard_common::types::string::Language,
-
///A short human-readable name for the label.
-
#[serde(borrow)]
-
pub name: jacquard_common::CowStr<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for LabelValueDefinitionStrings<'_> {
-
type Output = LabelValueDefinitionStrings<'static>;
-
fn into_static(self) -> Self::Output {
-
LabelValueDefinitionStrings {
-
description: self.description.into_static(),
-
lang: self.lang.into_static(),
-
name: self.name.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct SelfLabel<'a> {
-
///The short string name of the value or type of this label.
-
#[serde(borrow)]
-
pub val: jacquard_common::CowStr<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for SelfLabel<'_> {
-
type Output = SelfLabel<'static>;
-
fn into_static(self) -> Self::Output {
-
SelfLabel {
-
val: self.val.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-
-
///Metadata tags on an atproto record, published by the author within the record.
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct SelfLabels<'a> {
-
#[serde(borrow)]
-
pub values: Vec<test_generated::com_atproto::label::SelfLabel<'a>>,
-
}
-
-
impl jacquard_common::IntoStatic for SelfLabels<'_> {
-
type Output = SelfLabels<'static>;
-
fn into_static(self) -> Self::Output {
-
SelfLabels {
-
values: self.values.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-6
crates/jacquard-lexicon/target/test_codegen_output/com_atproto/repo.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod strong_ref;
-27
crates/jacquard-lexicon/target/test_codegen_output/com_atproto/repo/strong_ref.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// Lexicon: com.atproto.repo.strongRef
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
#[jacquard_derive::lexicon]
-
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
-
#[serde(rename_all = "camelCase")]
-
pub struct StrongRef<'a> {
-
#[serde(borrow)]
-
pub cid: jacquard_common::types::string::Cid<'a>,
-
#[serde(borrow)]
-
pub uri: jacquard_common::types::string::AtUri<'a>,
-
}
-
-
impl jacquard_common::IntoStatic for StrongRef<'_> {
-
type Output = StrongRef<'static>;
-
fn into_static(self) -> Self::Output {
-
StrongRef {
-
cid: self.cid.into_static(),
-
uri: self.uri.into_static(),
-
extra_data: self.extra_data.into_static(),
-
}
-
}
-
}
-7
crates/jacquard-lexicon/target/test_codegen_output/lib.rs
···
-
// @generated by jacquard-lexicon. DO NOT EDIT.
-
//
-
// This file was automatically generated from Lexicon schemas.
-
// Any manual changes will be overwritten on the next regeneration.
-
-
pub mod app_bsky;
-
pub mod com_atproto;
-15
crates/jacquard-lexicon/tests/regen_api.rs
···
-
use jacquard_lexicon::codegen::CodeGenerator;
-
use jacquard_lexicon::corpus::LexiconCorpus;
-
-
#[test]
-
#[ignore] // Run with: cargo test --test regen_api -- --ignored
-
fn regenerate_api() {
-
let corpus = LexiconCorpus::load_from_dir("tests/fixtures/lexicons/atproto/lexicons").expect("load corpus");
-
let codegen = CodeGenerator::new(&corpus, "crate");
-
-
codegen
-
.write_to_disk(std::path::Path::new("../jacquard-api/src"))
-
.expect("write to disk");
-
-
println!("Generated {} lexicons", corpus.len());
-
}
+4 -4
crates/jacquard/Cargo.toml
···
keywords.workspace = true
categories.workspace = true
readme.workspace = true
-
documentation.workspace = true
exclude.workspace = true
+
license-file.workspace = true
[features]
default = ["api_all"]
···
bytes.workspace = true
clap.workspace = true
http.workspace = true
-
jacquard-api = { path = "../jacquard-api" }
-
jacquard-common = { path = "../jacquard-common" }
-
jacquard-derive = { path = "../jacquard-derive", optional = true }
+
jacquard-api = { version = "0.1.0", path = "../jacquard-api" }
+
jacquard-common = { version = "0.1.0", path = "../jacquard-common" }
+
jacquard-derive = { version = "0.1.0", path = "../jacquard-derive", optional = true }
miette.workspace = true
reqwest = { workspace = true, features = ["charset", "http2", "json", "system-proxy", "gzip", "rustls-tls"] }
serde.workspace = true
+1
nix/modules/devshell.nix
···
nixd # Nix language server
bacon
rust-analyzer
+
cargo-release
];
};
};
+1 -1
rust-toolchain.toml
···
[toolchain]
channel = "stable"
-
profile = "complete"
+
profile = "default"