mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-15 15:21:19 +00:00
Fix example, docs for activitystreams-ext
This commit is contained in:
parent
394bf499f9
commit
7dad81d2f3
6 changed files with 39 additions and 21 deletions
16
CHANGELOG.md
Normal file
16
CHANGELOG.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Unreleased
|
||||||
|
|
||||||
|
# 0.7.0-alpha.3
|
||||||
|
- Add `.into_parts()` for some types where it makes sense
|
||||||
|
- All activity subtypes
|
||||||
|
- ApActor
|
||||||
|
- ApObject
|
||||||
|
|
||||||
|
# 0.7.0-alpha.2
|
||||||
|
- Add `.iter()`, `.iter_mut()` and `.into_iter()` for `OneOrMany<T>`
|
||||||
|
|
||||||
|
# 0.7.0-alpha.1
|
||||||
|
- The `items` methods for collections now deal in options
|
||||||
|
|
||||||
|
# 0.7.0-alpha.0
|
||||||
|
- Complete rewrite from 0.6.x, [check the docs](https://docs.rs/activitystreams)
|
10
activitystreams-ext/CHANGELOG.md
Normal file
10
activitystreams-ext/CHANGELOG.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Unreleased
|
||||||
|
|
||||||
|
# 0.1.0-alpha.2
|
||||||
|
Fix docs
|
||||||
|
|
||||||
|
# 0.1.0-alpha.1
|
||||||
|
Add `.into_parts()` for ext types
|
||||||
|
|
||||||
|
# 0.1.0-alpha.0
|
||||||
|
Initial release
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitystreams-ext"
|
name = "activitystreams-ext"
|
||||||
description = "Extension types for the ActivityStreams crate"
|
description = "Extension types for the ActivityStreams crate"
|
||||||
version = "0.1.0-alpha.1"
|
version = "0.1.0-alpha.2"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||||
|
|
|
@ -12,7 +12,7 @@ First, add ActivityStreams to your dependencies
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
activitystreams = "0.7.0-alpha.3"
|
activitystreams = "0.7.0-alpha.3"
|
||||||
activitystreams-ext = "0.1.0-alpha.1"
|
activitystreams-ext = "0.1.0-alpha.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
|
For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use activitystreams_ext::{Ext1, UnparsedExtension};
|
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
actor::{ApActor, Person},
|
actor::{ApActor, Person},
|
||||||
context,
|
context,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::XsdAnyUri,
|
|
||||||
security,
|
security,
|
||||||
unparsed::UnparsedMutExt,
|
unparsed::UnparsedMutExt,
|
||||||
|
url::Url,
|
||||||
};
|
};
|
||||||
|
use activitystreams_ext::{Ext1, UnparsedExtension};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
|
@ -17,8 +17,8 @@ pub struct PublicKey {
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PublicKeyInner {
|
pub struct PublicKeyInner {
|
||||||
id: XsdAnyUri,
|
id: Url,
|
||||||
owner: XsdAnyUri,
|
owner: Url,
|
||||||
public_key_pem: String,
|
public_key_pem: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,7 @@ where
|
||||||
pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
||||||
|
|
||||||
fn main() -> Result<(), anyhow::Error> {
|
fn main() -> Result<(), anyhow::Error> {
|
||||||
let actor = ApActor::new(
|
let actor = ApActor::new("http://in.box".parse()?, Person::new());
|
||||||
"http://in.box".parse()?,
|
|
||||||
"http://out.box".parse()?,
|
|
||||||
Person::new(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut person = Ext1::new(
|
let mut person = Ext1::new(
|
||||||
actor,
|
actor,
|
||||||
|
|
|
@ -12,20 +12,20 @@
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [dependencies]
|
//! [dependencies]
|
||||||
//! activitystreams = "0.7.0-alpha.3"
|
//! activitystreams = "0.7.0-alpha.3"
|
||||||
//! activitystreams-ext = "0.1.0-alpha.1"
|
//! activitystreams-ext = "0.1.0-alpha.2"
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
|
//! For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams_ext::{Ext1, UnparsedExtension};
|
|
||||||
//! use activitystreams::{
|
//! use activitystreams::{
|
||||||
//! actor::{ApActor, Person},
|
//! actor::{ApActor, Person},
|
||||||
//! context,
|
//! context,
|
||||||
//! prelude::*,
|
//! prelude::*,
|
||||||
//! primitives::XsdAnyUri,
|
|
||||||
//! security,
|
//! security,
|
||||||
//! unparsed::UnparsedMutExt,
|
//! unparsed::UnparsedMutExt,
|
||||||
|
//! url::Url,
|
||||||
//! };
|
//! };
|
||||||
|
//! use activitystreams_ext::{Ext1, UnparsedExtension};
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
//! #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
//! #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
//! #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! pub struct PublicKeyInner {
|
//! pub struct PublicKeyInner {
|
||||||
//! id: XsdAnyUri,
|
//! id: Url,
|
||||||
//! owner: XsdAnyUri,
|
//! owner: Url,
|
||||||
//! public_key_pem: String,
|
//! public_key_pem: String,
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
|
@ -62,11 +62,7 @@
|
||||||
//! pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
//! pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> Result<(), anyhow::Error> {
|
//! fn main() -> Result<(), anyhow::Error> {
|
||||||
//! let actor = ApActor::new(
|
//! let actor = ApActor::new("http://in.box".parse()?, Person::new());
|
||||||
//! "http://in.box".parse()?,
|
|
||||||
//! "http://out.box".parse()?,
|
|
||||||
//! Person::new(),
|
|
||||||
//! );
|
|
||||||
//!
|
//!
|
||||||
//! let mut person = Ext1::new(
|
//! let mut person = Ext1::new(
|
||||||
//! actor,
|
//! actor,
|
||||||
|
|
Loading…
Reference in a new issue