% Chapter 1 \chapter{code Example} % Main chapter title \label{codeexample} % For referencing the chapter elsewhere, use \ref{Chapter1} %---------------------------------------------------------------------------------------- \label{ActivityPubExample1} \begin{lstlisting}[language=XML, caption=ActivityPubExample1] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Person", "id": "https://social.example/alyssa/", "name": "Alyssa P. Hacker", "preferredUsername": "alyssa", "summary": "Lisp enthusiast hailing from MIT", "inbox": "https://social.example/alyssa/inbox/", "outbox": "https://social.example/alyssa/outbox/", "followers": "https://social.example/alyssa/followers/", "following": "https://social.example/alyssa/following/", "liked": "https://social.example/alyssa/liked/"} \end{lstlisting} \label{ActivityPubExample-ActivityStreams_object} \begin{lstlisting}[language=XML, caption=ActivityPub:ActivityStreams object] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Note", "to": ["https://chatty.example/ben/"], "attributedTo": "https://social.example/alyssa/", "content": "Say, did you finish reading that book I lent you?"} \end{lstlisting} \label{ActivityPubExample-Create_and_post} \begin{lstlisting}[language=XML, caption=ActivityPub:Create and Post] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "id": "https://social.example/alyssa/posts/a29a6843-9feb-4c74-a7f7-081b9c9201d3", "to": ["https://chatty.example/ben/"], "actor": "https://social.example/alyssa/", "object": {"type": "Note", "id": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19", "attributedTo": "https://social.example/alyssa/", "to": ["https://chatty.example/ben/"], "content": "Say, did you finish reading that book I lent you?"}} \end{lstlisting} \label{ActivityPubExample-Read_post} \begin{lstlisting}[language=XML, caption=ActivityPub:Read Post] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "id": "https://chatty.example/ben/p/51086", "to": ["https://social.example/alyssa/"], "actor": "https://chatty.example/ben/", "object": {"type": "Note", "id": "https://chatty.example/ben/p/51085", "attributedTo": "https://chatty.example/ben/", "to": ["https://social.example/alyssa/"], "inReplyTo": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19", "content": "
Argh, yeah, sorry, I'll get it back to you tomorrow.
I was reviewing the section on register machines, since it's been a while since I wrote one.
"} \end{lstlisting} \label{ActivityPubExample-Like_post} \begin{lstlisting}[language=XML, caption=ActivityPub:Like Post] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Like", "id": "https://social.example/alyssa/posts/5312e10e-5110-42e5-a09b-934882b3ecec", "to": ["https://chatty.example/ben/"], "actor": "https://social.example/alyssa/", "object": "https://chatty.example/ben/p/51086"} \end{lstlisting} \label{ActivityPubExample-readable_by_anyone} \begin{lstlisting}[language=XML, caption=ActivityPub:readable by anyone] {"@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "id": "https://social.example/alyssa/posts/9282e9cc-14d0-42b3-a758-d6aeca6c876b", "to": ["https://social.example/alyssa/followers/", "https://www.w3.org/ns/activitystreams#Public"], "actor": "https://social.example/alyssa/", "object": {"type": "Note", "id": "https://social.example/alyssa/posts/d18c55d4-8a63-4181-9745-4e6cf7938fa1", "attributedTo": "https://social.example/alyssa/", "to": ["https://social.example/alyssa/followers/", "https://www.w3.org/ns/activitystreams#Public"], "content": "Lending books to friends is nice. Getting them back is even nicer! :)"} \end{lstlisting}