feat: initial commit
This commit is contained in:
commit
a161b86c9a
705 changed files with 288162 additions and 0 deletions
13
vendor/sourcery.dny.nu/pana/.gitattributes
vendored
Normal file
13
vendor/sourcery.dny.nu/pana/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
*.go diff=golang
|
||||
|
||||
go.sum linguist-generated merge=ours
|
||||
/vendor/ linguist-vendored
|
||||
|
||||
*.md linguist-documentation text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
|
||||
|
||||
/.github export-ignore
|
||||
/.woodpecker linguist-vendored export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
4
vendor/sourcery.dny.nu/pana/.gitignore
vendored
Normal file
4
vendor/sourcery.dny.nu/pana/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
*.test
|
||||
*.out
|
||||
vendor/
|
||||
.vscode/
|
||||
373
vendor/sourcery.dny.nu/pana/LICENSE
vendored
Normal file
373
vendor/sourcery.dny.nu/pana/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,373 @@
|
|||
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
|
||||
|
||||
(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.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
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.
|
||||
|
||||
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 https://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.
|
||||
32
vendor/sourcery.dny.nu/pana/README.md
vendored
Normal file
32
vendor/sourcery.dny.nu/pana/README.md
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Pana
|
||||
|
||||
A Go library for building on the Fediverse.
|
||||
|
||||
Pana provides everything you need to process and create [ActivityStreams][as] messages. These are the kinds of messages that are exchanged between clients and servers on the Fediverse.
|
||||
|
||||
[as]: https://www.w3.org/TR/activitystreams-core/
|
||||
|
||||
The API Pana provides is tailored towards social media style applications. The underlying library, [longdistance][ld], can be used for anything that use JSON-LD.
|
||||
|
||||
[ld]: https://codeberg.org/daenney/longdistance
|
||||
|
||||
## Usage
|
||||
|
||||
The [Go documentation][godoc] includes a [few examples][godocex].
|
||||
|
||||
[godoc]: https://pkg.go.dev/sourcery.dny.nu/pana
|
||||
[godocex]: https://pkg.go.dev/sourcery.dny.nu/pana#pkg-examples
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs are very welcome for:
|
||||
* Completing current ActivityStreams types.
|
||||
* Fixes to existing types.
|
||||
* Adding new object types that are in use on the Fediverse.
|
||||
* Documentation improvements.
|
||||
|
||||
If you run into a bug, feel free to open up an issue.
|
||||
|
||||
## License
|
||||
|
||||
This library is licensed under the Mozilla Public License Version 2.0.
|
||||
268
vendor/sourcery.dny.nu/pana/activity.go
vendored
Normal file
268
vendor/sourcery.dny.nu/pana/activity.go
vendored
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/litepub"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// IntransitiveActivity is the ActivityStreams Intransitive Activity type.
|
||||
//
|
||||
// It's aliassed to [Object] because that's basically what it is. In practice
|
||||
// this is rarely if ever used. Polls are modelled as Create Question, even
|
||||
// though Question is intransitive.
|
||||
type IntransitiveActivity = Object
|
||||
|
||||
// Activity is the ActivityStreams Activity type.
|
||||
//
|
||||
// This is a more limited view of [Object] with property getters and setters for
|
||||
// the properties that are commonly set on the toplevel activity.
|
||||
type Activity Object
|
||||
|
||||
// NewActivity initialises a new activity.
|
||||
//
|
||||
// It's initialised with [as.TypeCreate]. Use [Activity.SetType] to override it.
|
||||
func NewActivity() *Activity {
|
||||
return &Activity{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeCreate},
|
||||
}
|
||||
}
|
||||
|
||||
// Accept is the Accept activity.
|
||||
type Accept = Activity
|
||||
|
||||
// NewAccept initialises a new Accept activity with [as.TypeAccept].
|
||||
func NewAccept() *Accept {
|
||||
return (*Accept)(NewActivity().SetType(as.TypeAccept))
|
||||
}
|
||||
|
||||
type Add = Activity
|
||||
|
||||
// NewAdd initialises a new Add activity with [as.TypeAdd].
|
||||
func NewAdd() *Add {
|
||||
return (*Add)(NewActivity().SetType(as.TypeAdd))
|
||||
}
|
||||
|
||||
type Announce = Activity
|
||||
|
||||
// NewAnnounce initialises a new Announce activity with [as.TypeAnnounce].
|
||||
func NewAnnounce() *Announce {
|
||||
return (*Announce)(NewActivity().SetType(as.TypeAnnounce))
|
||||
}
|
||||
|
||||
type Block = Activity
|
||||
|
||||
// NewBlock initialises a new Block activity with [as.TypeBlock].
|
||||
func NewBlock() *Block {
|
||||
return (*Block)(NewActivity().SetType(as.TypeBlock))
|
||||
}
|
||||
|
||||
type Create = Activity
|
||||
|
||||
// NewCreate initialises a new Create activity with [as.TypeCreate].
|
||||
func NewCreate() *Create {
|
||||
return NewActivity()
|
||||
}
|
||||
|
||||
type Delete = Activity
|
||||
|
||||
// NewDelete initialises a new Delete activity with [as.TypeDelete].
|
||||
func NewDelete() *Delete {
|
||||
return (*Delete)(NewActivity().SetType(as.TypeDelete))
|
||||
}
|
||||
|
||||
type EmojiReact = Activity
|
||||
|
||||
// NewEmojiReact initialises a new EmojiReact activity with
|
||||
// [litepub.TypeEmojiReact].
|
||||
func NewEmojiReact() *EmojiReact {
|
||||
return (*EmojiReact)(NewActivity().SetType(litepub.TypeEmojiReact))
|
||||
}
|
||||
|
||||
type Follow = Activity
|
||||
|
||||
// NewFollow initialises a new Follow activity with [as.TypeFollow].
|
||||
func NewFollow() *Follow {
|
||||
return (*Follow)(NewActivity().SetType(as.TypeFollow))
|
||||
}
|
||||
|
||||
type Like = Activity
|
||||
|
||||
// NewLike initialises a new Like activity with [as.TypeLike].
|
||||
func NewLike() *Like {
|
||||
return (*Like)(NewActivity().SetType(as.TypeLike))
|
||||
}
|
||||
|
||||
type Move = Activity
|
||||
|
||||
// NewMove initialises a new Move activity with [as.TypeMove].
|
||||
func NewMove() *Move {
|
||||
return (*Move)(NewActivity().SetType(as.TypeMove))
|
||||
}
|
||||
|
||||
type Remove = Activity
|
||||
|
||||
// NewRemove initialises a new Remove activity with [as.TypeRemove].
|
||||
func NewRemove() *Remove {
|
||||
return (*Remove)(NewActivity().SetType(as.TypeRemove))
|
||||
}
|
||||
|
||||
type Undo = Activity
|
||||
|
||||
// NewUndo initialises a new Undo activity with [as.TypeUndo].
|
||||
func NewUndo() *Undo {
|
||||
return (*Undo)(NewActivity().SetType(as.TypeUndo))
|
||||
}
|
||||
|
||||
type Update = Activity
|
||||
|
||||
// NewUpdate initialises a new Update activity with [as.TypeUpdate].
|
||||
func NewUpdate() *Update {
|
||||
return (*Update)(NewActivity().SetType(as.TypeUpdate))
|
||||
}
|
||||
|
||||
// Build finalises the Activity.
|
||||
func (a *Activity) Build() Activity {
|
||||
return *a
|
||||
}
|
||||
|
||||
// IsIntransitive returns true if the activity has no object.
|
||||
func (a *Activity) IsIntransitive() bool {
|
||||
return !Has(a, as.Object)
|
||||
}
|
||||
|
||||
// See [Object.GetID].
|
||||
func (a *Activity) GetID() string {
|
||||
return (*Object)(a).GetID()
|
||||
}
|
||||
|
||||
// See [Object.SetID].
|
||||
func (a *Activity) SetID(id string) *Activity {
|
||||
(*Object)(a).SetID(id)
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (a *Activity) GetType() string {
|
||||
return (*Object)(a).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (a *Activity) SetType(typ string) *Activity {
|
||||
(*Object)(a).SetType(typ)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetActor returns the actor IDs from [as.Actor].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor.
|
||||
func (a *Activity) GetActor() iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, n := range (*ld.Node)(a).GetNodes(as.Actor) {
|
||||
if !yield(n.ID) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddActor appends actor IDs to [as.Actor].
|
||||
func (a *Activity) AddActor(ids ...string) *Activity {
|
||||
(*ld.Node)(a).AddNodes(as.Actor, toReference(ids...)...)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetInstrument returns the instrument in [as.Instrument].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-instrument.
|
||||
func (a *Activity) GetInstrument() *Instrument {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Instrument); len(nodes) == 1 {
|
||||
return (*Instrument)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetInstrument sets the instrument in [as.Instrument].
|
||||
func (a *Activity) SetInstrument(in Instrument) *Activity {
|
||||
(*ld.Node)(a).SetNodes(as.Instrument, ld.Node(in))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetObject returns the object in [as.Object].
|
||||
//
|
||||
// This returns [as.Any] because it can be of many different types. If the
|
||||
// [Any.GetType] doesn't match any known type you can cast it to [Object].
|
||||
//
|
||||
// https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object.
|
||||
func (a *Activity) GetObject() *Any {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Object); len(nodes) == 1 {
|
||||
return (*Any)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetObject sets the object in [as.Object].
|
||||
//
|
||||
// It is possible to have more than one object. However, except for JSON-LD
|
||||
// aware processors, nobody understands this. If you want to send multiple
|
||||
// objects, send multiple activities instead.
|
||||
func (a *Activity) SetObject(obj Any) *Activity {
|
||||
(*ld.Node)(a).SetNodes(as.Object, ld.Node(obj))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetTarget returns the ID in [as.Target].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target.
|
||||
func (a *Activity) GetTarget() string {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Target); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetTarget sets the ID in [as.Target].
|
||||
func (a *Activity) SetTarget(id string) *Activity {
|
||||
(*ld.Node)(a).SetNodes(as.Target, ld.Node{ID: id})
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetCc].
|
||||
func (a *Activity) GetCc() iter.Seq[string] {
|
||||
return (*Object)(a).GetCc()
|
||||
}
|
||||
|
||||
// See [Object.AddCc].
|
||||
func (a *Activity) AddCc(ids ...string) *Activity {
|
||||
(*Object)(a).AddCc(ids...)
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetTo].
|
||||
func (a *Activity) GetTo() iter.Seq[string] {
|
||||
return (*Object)(a).GetTo()
|
||||
}
|
||||
|
||||
// See [Object.AddTo].
|
||||
func (a *Activity) AddTo(ids ...string) *Activity {
|
||||
(*Object)(a).AddTo(ids...)
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetPublished].
|
||||
func (a *Activity) GetPublished() json.RawMessage {
|
||||
return (*Object)(a).GetPublished()
|
||||
}
|
||||
|
||||
// See [Object.SetPublished].
|
||||
func (a *Activity) SetPublished(v json.RawMessage) *Activity {
|
||||
(*Object)(a).SetPublished(v)
|
||||
return a
|
||||
}
|
||||
383
vendor/sourcery.dny.nu/pana/actor.go
vendored
Normal file
383
vendor/sourcery.dny.nu/pana/actor.go
vendored
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/mastodon"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
ldp "sourcery.dny.nu/pana/vocab/w3/ldp"
|
||||
secv1 "sourcery.dny.nu/pana/vocab/w3id/securityv1"
|
||||
)
|
||||
|
||||
// Actor is the ActivityStreams Actor type.
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#actor-objects.
|
||||
type Actor Object
|
||||
|
||||
type Application = Actor
|
||||
type Group = Actor
|
||||
type Organisation = Actor
|
||||
type Organization = Organisation
|
||||
type Person = Actor
|
||||
type Service = Actor
|
||||
|
||||
// NewActor initialises a new Actor.
|
||||
func NewActor() *Actor {
|
||||
return &Actor{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypePerson},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Actor.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (a *Actor) Build() Any {
|
||||
return Any(*a)
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (a *Actor) GetType() string {
|
||||
return (*Object)(a).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (a *Actor) SetType(typ string) *Actor {
|
||||
(*Object)(a).SetType(typ)
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (a *Actor) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(a).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (a *Actor) AddName(ls ...Localised) *Actor {
|
||||
(*Object)(a).AddName(ls...)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetMemorial returns the value in [mastodon.Memorial].
|
||||
//
|
||||
// It returns false if the property was absent.
|
||||
func (a *Actor) GetMemorial() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(mastodon.Memorial); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return json.RawMessage(`false`)
|
||||
}
|
||||
|
||||
// SetMemorial sets the value in [mastodon.Memorial].
|
||||
func (a *Actor) SetMemorial(v json.RawMessage) *Actor {
|
||||
(*ld.Node)(a).SetNodes(mastodon.Memorial, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetSummary].
|
||||
func (a *Actor) GetSummary() iter.Seq[*Localised] {
|
||||
return (*Object)(a).GetSummary()
|
||||
}
|
||||
|
||||
// See [Object.AddSummary].
|
||||
func (a *Actor) AddSummary(ls ...Localised) *Actor {
|
||||
(*Object)(a).AddSummary(ls...)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetIcon returns the [Image] in [as.Icon].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon.
|
||||
func (a *Actor) GetIcon() *Image {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Icon); len(nodes) == 1 {
|
||||
return (*Image)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetIcon sets the [Image] in [as.Icon].
|
||||
func (a *Actor) SetIcon(img Image) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Icon, ld.Node(img))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetImage returns the [Image] in [as.Image].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image.
|
||||
func (a *Actor) GetImage() *Image {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Image); len(nodes) == 1 {
|
||||
return (*Image)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetImage sets the [Image] in [as.Image].
|
||||
func (a *Actor) SetImage(img Image) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Image, ld.Node(img))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetDiscoverable returns the value in [mastodon.Discoverable].
|
||||
//
|
||||
// When discoverable is absent this returns false. We treat discoverable as
|
||||
// opt-in, not opt-out.
|
||||
//
|
||||
// See https://docs.joinmastodon.org/spec/activitypub/#toot.
|
||||
func (a *Actor) GetDiscoverable() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(mastodon.Discoverable); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return json.RawMessage(`false`)
|
||||
}
|
||||
|
||||
// SetDiscoverable sets the value in [mastodon.Discoverable].
|
||||
func (a *Actor) SetDiscoverable(v json.RawMessage) *Actor {
|
||||
(*ld.Node)(a).SetNodes(mastodon.Discoverable, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetFeatured returns the [Collection] stored in [mastodon.Featured].
|
||||
//
|
||||
// See https://docs.joinmastodon.org/spec/activitypub/#toot.
|
||||
func (a *Actor) GetFeatured() *Collection {
|
||||
if nodes := (*ld.Node)(a).GetNodes(mastodon.Featured); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFeatured sets the [Collection] in [mastodon.Featured].
|
||||
func (a *Actor) SetFeatured(c Collection) *Actor {
|
||||
(*ld.Node)(a).SetNodes(mastodon.Featured, ld.Node(c))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetFeaturedTags returns the [Collection] stored in [mastodon.FeaturedTags].
|
||||
//
|
||||
// See https://docs.joinmastodon.org/spec/activitypub/#toot.
|
||||
func (a *Actor) GetFeaturedTags() *Collection {
|
||||
if nodes := (*ld.Node)(a).GetNodes(mastodon.FeaturedTags); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFeaturedTags sets the [Collection] in [mastodon.FeaturedTags].
|
||||
func (a *Actor) SetFeaturedTags(c Collection) *Actor {
|
||||
(*ld.Node)(a).SetNodes(mastodon.FeaturedTags, ld.Node(c))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetFollowers returns the [Collection] stored in [as.Followers].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#followers.
|
||||
func (a *Actor) GetFollowers() *Collection {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Followers); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFollowers sets the [Collection] in [as.Followers].
|
||||
func (a *Actor) SetFollowers(c Collection) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Followers, ld.Node(c))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetFollowing returns the [Collection] stored in [as.Following].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#following.
|
||||
func (a *Actor) GetFollowing() *Collection {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Following); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFollowing sets the [Collection] in [as.Following].
|
||||
func (a *Actor) SetFollowing(c Collection) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Following, ld.Node(c))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetLiked returns the [Collection] stored in [as.Liked].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#liked.
|
||||
func (a *Actor) GetLiked() *Collection {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Liked); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetLiked sets the [Collection] in [as.Liked].
|
||||
func (a *Actor) SetLiked(c Collection) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Liked, ld.Node(c))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetEndpoints returns the [Endpoints] from [as.Endpoints].
|
||||
func (a *Actor) GetEndpoints() *Endpoints {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Endpoints); len(nodes) == 1 {
|
||||
return (*Endpoints)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetEndpoints sets the [Endpoints] in [as.Endpoints].
|
||||
func (a *Actor) SetEndpoints(ep Endpoints) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Endpoints, ld.Node(ep))
|
||||
return a
|
||||
}
|
||||
|
||||
// GetIndox returns the URL in [ldp.Inbox].
|
||||
func (a *Actor) GetInbox() string {
|
||||
if nodes := (*ld.Node)(a).GetNodes(ldp.Inbox); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetInbox sets the URL in [ldp.Inbox].
|
||||
func (a *Actor) SetInbox(url string) *Actor {
|
||||
(*ld.Node)(a).SetNodes(ldp.Inbox, ld.Node{ID: url})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetIndox returns the URL in [as.Outbox].
|
||||
func (a *Actor) GetOutbox() string {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Outbox); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetOutbox sets the URL in [as.Outbox].
|
||||
func (a *Actor) SetOutbox(url string) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.Outbox, ld.Node{ID: url})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetIndexable returns the value in [mastodon.Indexable].
|
||||
//
|
||||
// When discoverable is absent this returns false. We treat indexable as
|
||||
// opt-in, not opt-out.
|
||||
//
|
||||
// See https://docs.joinmastodon.org/spec/activitypub/#toot.
|
||||
func (a *Actor) GetIndexable() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(mastodon.Indexable); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return json.RawMessage(`false`)
|
||||
}
|
||||
|
||||
// SetIndexable sets the value in [mastodon.Indexable].
|
||||
func (a *Actor) SetIndexable(v json.RawMessage) *Actor {
|
||||
(*ld.Node)(a).SetNodes(mastodon.Indexable, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetManuallyApprovesFollowers returns the value in
|
||||
// [as.ManuallyApprovesFollowers].
|
||||
//
|
||||
// See https://swicg.github.io/miscellany/#manuallyApprovesFollowers.
|
||||
func (a *Actor) GetManuallyApprovesFollowers() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.ManuallyApprovesFollowers); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return json.RawMessage(`false`)
|
||||
}
|
||||
|
||||
// SetManuallyApprovesFollowers sets the value in
|
||||
// [as.ManuallyApprovesFollowers].
|
||||
func (a *Actor) SetManuallyApprovesFollowers(v json.RawMessage) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.ManuallyApprovesFollowers, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetMovedTo returns the URL from [as.MovedTo].
|
||||
//
|
||||
// See https://swicg.github.io/miscellany/#movedTo.
|
||||
func (a *Actor) GetMovedTo() string {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.MovedTo); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetMovedTo sets the URL in [as.MovedTo].
|
||||
func (a *Actor) SetMovedTo(url string) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.MovedTo, ld.Node{ID: url})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetPreferredUsername returns the value in [as.PreferredUsername].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#actor-objects.
|
||||
func (a *Actor) GetPreferredUsername() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.PreferredUsername); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPreferredUsername sets the value in [as.PreferredUsername].
|
||||
func (a *Actor) SetPreferredUsername(v json.RawMessage) *Actor {
|
||||
(*ld.Node)(a).SetNodes(as.PreferredUsername, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetPublished].
|
||||
func (a *Actor) GetPublished() json.RawMessage {
|
||||
return (*Object)(a).GetPublished()
|
||||
}
|
||||
|
||||
// See [Object.SetPublished].
|
||||
func (a *Actor) SetPublished(v json.RawMessage) *Actor {
|
||||
(*Object)(a).SetPublished(v)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetPublickKey returns the [PublicKey] stored in [secv1.PublicKey].
|
||||
func (a *Actor) GetPublicKey() *PublicKey {
|
||||
if nodes := (*ld.Node)(a).GetNodes(secv1.PublicKey); len(nodes) == 1 {
|
||||
return (*PublicKey)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPublicKey sets the [PublicKey] in [secv1.PublicKey].
|
||||
func (a *Actor) SetPublicKey(pk PublicKey) *Actor {
|
||||
(*ld.Node)(a).SetNodes(secv1.PublicKey, ld.Node(pk))
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (a *Actor) GetURL() string {
|
||||
return (*Object)(a).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (a *Actor) SetURL(url string) *Actor {
|
||||
(*Object)(a).SetURL(url)
|
||||
return a
|
||||
}
|
||||
13
vendor/sourcery.dny.nu/pana/any.go
vendored
Normal file
13
vendor/sourcery.dny.nu/pana/any.go
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package pana
|
||||
|
||||
import ld "sourcery.dny.nu/longdistance"
|
||||
|
||||
// Any is returned when a property can return [Link] or [Object].
|
||||
//
|
||||
// You can use [Any.GetType] to determine what to cast it to.
|
||||
type Any ld.Node
|
||||
|
||||
// See [Object.GetType].
|
||||
func (a *Any) GetType() string {
|
||||
return (*Object)(a).GetType()
|
||||
}
|
||||
24
vendor/sourcery.dny.nu/pana/article.go
vendored
Normal file
24
vendor/sourcery.dny.nu/pana/article.go
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Article is the ActivityStreams Article type.
|
||||
type Article Object
|
||||
|
||||
// NewArticle initialises a new Article.
|
||||
func NewArticle() *Article {
|
||||
return &Article{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeArticle},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Article.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (a *Article) Build() Any {
|
||||
return Any(*a)
|
||||
}
|
||||
90
vendor/sourcery.dny.nu/pana/audio.go
vendored
Normal file
90
vendor/sourcery.dny.nu/pana/audio.go
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Audio is the ActivityStreams Audio type.
|
||||
//
|
||||
// It is a [Document] without width/height but with duration.
|
||||
type Audio Document
|
||||
|
||||
// NewAudio initialises a new Audio.
|
||||
func NewAudio() *Audio {
|
||||
return &Audio{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeAudio},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Audio.
|
||||
func (a *Audio) Build() Audio {
|
||||
return *a
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (a *Audio) GetType() string {
|
||||
return (*Object)(a).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (a *Audio) SetType(typ string) *Audio {
|
||||
(*Object)(a).SetType(typ)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetDuration returns the value in [as.Duration].
|
||||
func (a *Audio) GetDuration() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.Duration); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetDuration sets the value in [as.Duration].
|
||||
func (a *Audio) SetDuration(v json.RawMessage) *Audio {
|
||||
(*ld.Node)(a).SetNodes(as.Duration, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// GetMediaType returns the value in [as.MediaType].
|
||||
func (a *Audio) GetMediaType() json.RawMessage {
|
||||
if nodes := (*ld.Node)(a).GetNodes(as.MediaType); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetMediaType sets the value in [as.MediaType].
|
||||
func (a *Audio) SetMediaType(v json.RawMessage) *Audio {
|
||||
(*ld.Node)(a).SetNodes(as.MediaType, ld.Node{Value: v})
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (a *Audio) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(a).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (a *Audio) AddName(ls ...Localised) *Audio {
|
||||
(*Object)(a).AddName(ls...)
|
||||
return a
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (a *Audio) GetURL() string {
|
||||
return (*Object)(a).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (a *Audio) SetURL(url string) *Audio {
|
||||
(*Object)(a).SetURL(url)
|
||||
return a
|
||||
}
|
||||
162
vendor/sourcery.dny.nu/pana/collection.go
vendored
Normal file
162
vendor/sourcery.dny.nu/pana/collection.go
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Collection is the ActivityStreams Collection type.
|
||||
//
|
||||
// It is also used for the OrderedCollection. Use [Collection.IsOrdered] to see,
|
||||
// or [Collection.GetType].
|
||||
type Collection Object
|
||||
|
||||
// NewCollection initialises a new Collection.
|
||||
func NewCollection() *Collection {
|
||||
return &Collection{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeCollection},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Collection.
|
||||
func (c *Collection) Build() Collection {
|
||||
return *c
|
||||
}
|
||||
|
||||
// See [Object.GetID].
|
||||
func (c *Collection) GetID() string {
|
||||
return (*Object)(c).GetID()
|
||||
}
|
||||
|
||||
// See [Object.SetID].
|
||||
func (c *Collection) SetID(id string) *Collection {
|
||||
(*Object)(c).SetID(id)
|
||||
return c
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (c *Collection) GetType() string {
|
||||
return (*Object)(c).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (c *Collection) SetType(typ string) *Collection {
|
||||
(*Object)(c).SetType(typ)
|
||||
return c
|
||||
}
|
||||
|
||||
// GetFirst returns the [CollectionPage] in [as.First].
|
||||
func (c *Collection) GetFirst() *CollectionPage {
|
||||
if nodes := (*ld.Node)(c).GetNodes(as.First); len(nodes) == 1 {
|
||||
return (*CollectionPage)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFirst sets the [CollectionPage] in [as.First].
|
||||
func (c *Collection) SetFirst(p CollectionPage) *Collection {
|
||||
(*ld.Node)(c).SetNodes(as.First, ld.Node(p))
|
||||
return c
|
||||
}
|
||||
|
||||
// GetTotalItems returns the value from [as.TotalItems]
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-totalitems.
|
||||
func (c *Collection) GetTotalItems() json.RawMessage {
|
||||
if nodes := (*ld.Node)(c).GetNodes(as.TotalItems); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTotalItems sets the value in [as.TotalItems].
|
||||
func (c *Collection) SetTotalItems(v json.RawMessage) *Collection {
|
||||
(*ld.Node)(c).SetNodes(as.TotalItems, ld.Node{Value: v})
|
||||
return c
|
||||
}
|
||||
|
||||
// CollectionPage is the ActivityStreams CollectionPage type.
|
||||
//
|
||||
// It is also used for the OrderedCollectionPage. Use [CollectionPage.IsOrdered]
|
||||
// to see, or [CollectionPage.GetType].
|
||||
type CollectionPage Object
|
||||
|
||||
// NewCollectionPage initialises a new CollectionPage.
|
||||
func NewCollectionPage() *CollectionPage {
|
||||
return &CollectionPage{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeCollectionPage},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the CollectionPage.
|
||||
func (p *CollectionPage) Build() CollectionPage {
|
||||
return *p
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (p *CollectionPage) GetType() string {
|
||||
return (*Object)(p).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (p *CollectionPage) SetType(typ string) *CollectionPage {
|
||||
(*Object)(p).SetType(typ)
|
||||
return p
|
||||
}
|
||||
|
||||
// GetNext returns the URL stored in [as.Next].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-next.
|
||||
func (p *CollectionPage) GetNext() string {
|
||||
if nodes := (*ld.Node)(p).GetNodes(as.Next); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetNext sets the URL in [as.Next].
|
||||
func (p *CollectionPage) SetNext(url string) *CollectionPage {
|
||||
(*ld.Node)(p).SetNodes(as.Next, ld.Node{ID: url})
|
||||
return p
|
||||
}
|
||||
|
||||
// GetPartOf returns the URL stored in [as.PartOf].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-partof.
|
||||
func (p *CollectionPage) GetPartOf() string {
|
||||
if nodes := (*ld.Node)(p).GetNodes(as.PartOf); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetPartOf sets the URL in [as.PartOf].
|
||||
func (p *CollectionPage) SetPartOf(url string) *CollectionPage {
|
||||
(*ld.Node)(p).SetNodes(as.PartOf, ld.Node{ID: url})
|
||||
return p
|
||||
}
|
||||
|
||||
// GetPrev returns the URL stored in [as.Prev].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-prev.
|
||||
func (p *CollectionPage) GetPrev() string {
|
||||
if nodes := (*ld.Node)(p).GetNodes(as.Prev); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetPrev sets the URL in [as.Prev].
|
||||
func (p *CollectionPage) SetPrev(url string) *CollectionPage {
|
||||
(*ld.Node)(p).SetNodes(as.Prev, ld.Node{ID: url})
|
||||
return p
|
||||
}
|
||||
86
vendor/sourcery.dny.nu/pana/doc.go
vendored
Normal file
86
vendor/sourcery.dny.nu/pana/doc.go
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
// Package pana can be used to process [ActivityStreams] messages.
|
||||
//
|
||||
// This library is meant to help with implementing fediverse ([ActivityPub])
|
||||
// clients and servers.
|
||||
//
|
||||
// # Usage
|
||||
//
|
||||
// An application starts with creating a [Processor] using [NewProcessor]. This
|
||||
// processor should exist for the lifetime of the application, and not a single
|
||||
// request.
|
||||
//
|
||||
// Incoming messages can then be processed by calling [Processor.Unmarshal].
|
||||
// This will return an [Activity] that you can inspect and drill into.
|
||||
//
|
||||
// Call [Activity.GetType] to figure out what type of activity it is. With that
|
||||
// information you can then cast the activity to a more specific type which will
|
||||
// add new getters and setters for the properties that are set on that activity.
|
||||
// You can use [Properties] to get a set of all properties set on the activity.
|
||||
// This lets you handle any property you're interested in.
|
||||
//
|
||||
// If an activity has an [Object], you can do the same thing. Use
|
||||
// [Activity.GetObject] to get the object. An object may be a reference, or a
|
||||
// full object. You can check this with [Object.IsReference]. Once you have a
|
||||
// full object, you can use [Object.GetType] to determine the type and cast it
|
||||
// to a more specific type. And you can use [Properties] to determine the
|
||||
// properties set on the object.
|
||||
//
|
||||
// Once you've created an [Object] you wrap it in an [Activity] and call
|
||||
// [Processor.Marshal]. You can then exchange the resulting JSON using the
|
||||
// client-to-server or server-to-server APIs.
|
||||
//
|
||||
// If you're going to store ActivityStreams messages, ensure you always store
|
||||
// the original you received. Should an implementation bug in Unmarshal result
|
||||
// in a problem, you can then always reprocess messages after that's been fixed.
|
||||
// But if you store a potentially incorrectly unmarshalled document you may not
|
||||
// be able to return to its original form even if you retain the context.
|
||||
//
|
||||
// # JSON-LD
|
||||
//
|
||||
// ActivityStreams uses JSON-LD for its JSON serialisatoin format. Pana doesn't
|
||||
// hide this from you, but aims to provide an API that makes working with this
|
||||
// simple enough so that you don't have to think about it.
|
||||
//
|
||||
// Pana's Unmarshal converts a document to JSON-LD Expanded Document Form. The
|
||||
// Marshal method does the opposite, converting to JSON-LD Compacted Document
|
||||
// Form.
|
||||
//
|
||||
// In JSON-LD all properties, with the exception of 'id' / '@id', are arrays.
|
||||
// But if an array only has a single etnry it's typically reduced to its member.
|
||||
// This distinction is removed in expanded document form, but it makes the
|
||||
// resulting [Object] a bit verbose to handle.
|
||||
//
|
||||
// # API
|
||||
//
|
||||
// The API Pana exposes is meant to do the right thing for you in 99.9% of
|
||||
// cases. Its API is based on what properties are used in practice across the
|
||||
// fediverse, and what their values are. This is a more restrictive subset of
|
||||
// what the ActivityStreams specification allows for. Pana does this on purpose
|
||||
// to guide you towards maximal interoperability with other, potentially JSON-LD
|
||||
// unaware, implementations.
|
||||
//
|
||||
// For any proprety, you'll either have:
|
||||
// - GetXXX and SetXXX for single-valued properties. These will accept and
|
||||
// return strings or [encoding/json.RawMessage].
|
||||
// - GetXXX and AddXXX for multi-valued properties. Get will return an
|
||||
// [iter.Seq], and Add will be variadic. Add appends so can be called
|
||||
// multiple times too.
|
||||
//
|
||||
// Most value properties return [encoding/json.RawMessage]. You can look at the
|
||||
// JSON-LD context definition to determine what the type of the value should be.
|
||||
// This will also be part of the vocabulary documentation for the property
|
||||
// you're retrieving. However, remember that this is not enforced, so even if a
|
||||
// property is defined as a number it can hold a boolean.
|
||||
//
|
||||
// All types in Pana are a [sourcery.dny.nu/longdistance.Node]. This struct type
|
||||
// has exported fields for every JSON-LD keyword, as well as a catch-all
|
||||
// Properties field for all other properties. You can directly manipulate any of
|
||||
// these, but at that point you're responsible for ensuring you create valid
|
||||
// JSON-LD nodes that will compact to a representation non-JSON-LD aware
|
||||
// processors will understand. In order to Get, Add or Set properties you need
|
||||
// to use the IRI a property maps to. This is part of what the JSON-LD context
|
||||
// defines. The [sourcery.dny.nu/pana/vocab] packages provide the necessary consts.
|
||||
//
|
||||
// [ActivityStreams]: https://www.w3.org/TR/activitystreams-core/
|
||||
// [ActivityPub]: https://www.w3.org/TR/activitypub/
|
||||
package pana
|
||||
155
vendor/sourcery.dny.nu/pana/document.go
vendored
Normal file
155
vendor/sourcery.dny.nu/pana/document.go
vendored
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/mastodon"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Document is the ActivityStreams Document type.
|
||||
//
|
||||
// It shares all properties with [Link].
|
||||
type Document Object
|
||||
|
||||
// NewDocument initialises a new Document.
|
||||
func NewDocument() *Document {
|
||||
return &Document{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeDocument},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Document.
|
||||
func (d *Document) Build() Document {
|
||||
return *d
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (d *Document) GetType() string {
|
||||
return (*Object)(d).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (d *Document) SetType(typ string) *Document {
|
||||
(*Object)(d).SetType(typ)
|
||||
return d
|
||||
}
|
||||
|
||||
// GetBlurhash returns the value in [mastodon.Blurhash].
|
||||
func (d *Document) GetBlurhash() json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(mastodon.Blurhash); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetBlurhash sets the value in [mastodon.Blurhash].
|
||||
func (d *Document) SetBlurhash(v json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(mastodon.Blurhash, ld.Node{Value: v})
|
||||
return d
|
||||
}
|
||||
|
||||
// GetDuration returns the value in [as.Duration].
|
||||
func (d *Document) GetDuration() json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(as.Duration); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetDuration sets the value in [as.Duration].
|
||||
func (d *Document) SetDuration(v json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(as.Duration, ld.Node{Value: v})
|
||||
return d
|
||||
}
|
||||
|
||||
// GetFocalPoint returns the value in [mastodon.FocalPoint].
|
||||
func (d *Document) GetFocalPoint() []json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(mastodon.FocalPoint); len(nodes) == 1 && len(nodes[0].List) == 2 {
|
||||
x := nodes[0].List[0].Value
|
||||
y := nodes[0].List[1].Value
|
||||
return []json.RawMessage{x, y}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetFocalPoint sets the value in [mastodon.FocalPoint].
|
||||
func (d *Document) SetFocalPoint(x, y json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(mastodon.FocalPoint, ld.Node{
|
||||
List: []ld.Node{{Value: x}, {Value: y}},
|
||||
})
|
||||
return d
|
||||
}
|
||||
|
||||
// GetHeight returns the value in [as.Height].
|
||||
func (d *Document) GetHeight() json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(as.Height); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetHeight sets the value in [as.Height].
|
||||
func (d *Document) SetHeight(v json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(as.Height, ld.Node{Value: v})
|
||||
return d
|
||||
}
|
||||
|
||||
// GetMediaType returns the value in [as.MediaType].
|
||||
func (d *Document) GetMediaType() json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(as.MediaType); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetMediaType sets the value in [as.MediaType].
|
||||
func (d *Document) SetMediaType(v json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(as.MediaType, ld.Node{Value: v})
|
||||
return d
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (d *Document) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(d).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (d *Document) AddName(ls ...Localised) *Document {
|
||||
(*Object)(d).AddName(ls...)
|
||||
return d
|
||||
}
|
||||
|
||||
// GetWidth returns the value in [as.Width].
|
||||
func (d *Document) GetWidth() json.RawMessage {
|
||||
if nodes := (*ld.Node)(d).GetNodes(as.Width); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetWidth sets the value in [as.Width].
|
||||
func (d *Document) SetWidth(v json.RawMessage) *Document {
|
||||
(*ld.Node)(d).SetNodes(as.Width, ld.Node{Value: v})
|
||||
return d
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (d *Document) GetURL() string {
|
||||
return (*Object)(d).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (d *Document) SetURL(url string) *Document {
|
||||
(*Object)(d).SetURL(url)
|
||||
return d
|
||||
}
|
||||
89
vendor/sourcery.dny.nu/pana/emoji.go
vendored
Normal file
89
vendor/sourcery.dny.nu/pana/emoji.go
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/mastodon"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
type Emoji Object
|
||||
|
||||
// NewEmoji initialises a new Emoji.
|
||||
func NewEmoji() *Emoji {
|
||||
return &Emoji{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{mastodon.TypeEmoji},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Emoji.
|
||||
func (e *Emoji) Build() Emoji {
|
||||
return *e
|
||||
}
|
||||
|
||||
// See [Object.GetID].
|
||||
//
|
||||
// Beware that Emoji's might not have an ID. This is used for instance-local
|
||||
// emoji.
|
||||
func (e *Emoji) GetID() string {
|
||||
return (*Object)(e).GetID()
|
||||
}
|
||||
|
||||
// See [Object.SetID].
|
||||
func (e *Emoji) SetID(id string) *Emoji {
|
||||
(*Object)(e).SetID(id)
|
||||
return e
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (e *Emoji) GetType() string {
|
||||
return (*Object)(e).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (e *Emoji) SetType() *Emoji {
|
||||
(*Object)(e).SetType(mastodon.TypeEmoji)
|
||||
return e
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (e *Emoji) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(e).GetName()
|
||||
}
|
||||
|
||||
// See [Object.SetName].
|
||||
func (e *Emoji) AddName(ls ...Localised) *Emoji {
|
||||
(*Object)(e).AddName(ls...)
|
||||
return e
|
||||
}
|
||||
|
||||
// See [Object.GetUpdated].
|
||||
func (e *Emoji) GetUpdated() json.RawMessage {
|
||||
return (*Object)(e).GetUpdated()
|
||||
}
|
||||
|
||||
// See [Object.SetUpdated].
|
||||
func (e *Emoji) SetUpdated(v json.RawMessage) *Emoji {
|
||||
(*Object)(e).SetUpdated(v)
|
||||
return e
|
||||
}
|
||||
|
||||
// GetIcon returns the [Image] in [as.Icon].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon.
|
||||
func (e *Emoji) GetIcon() *Icon {
|
||||
if nodes := (*ld.Node)(e).GetNodes(as.Icon); len(nodes) == 1 {
|
||||
return (*Icon)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetIcon sets the [Image] in [as.Icon].
|
||||
func (e *Emoji) SetIcon(img Icon) *Emoji {
|
||||
(*ld.Node)(e).SetNodes(as.Icon, ld.Node(img))
|
||||
return e
|
||||
}
|
||||
85
vendor/sourcery.dny.nu/pana/endpoint.go
vendored
Normal file
85
vendor/sourcery.dny.nu/pana/endpoint.go
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Endpoints from ActivityPub.
|
||||
//
|
||||
// Endpoints does not include support for [as.ProvideClientKey] or
|
||||
// [as.SignClientKey] because Linked Data Signatures are a menace and should not
|
||||
// be used. Use HTTP Signatures instead.
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#actor-objects.
|
||||
type Endpoints ld.Node
|
||||
|
||||
// NewEndpoints initialises a new Endpoints.
|
||||
func NewEndpoints() *Endpoints {
|
||||
return &Endpoints{
|
||||
Properties: make(ld.Properties, 4),
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Endpoints.
|
||||
func (ep *Endpoints) Build() Endpoints {
|
||||
return *ep
|
||||
}
|
||||
|
||||
// GetProxyURL returns the URL in [as.ProxyURL].
|
||||
func (ep *Endpoints) GetProxyURL() string {
|
||||
if nodes := (*ld.Node)(ep).GetNodes(as.ProxyURL); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetProxyURL sets the URL in [as.ProxyURL].
|
||||
func (ep *Endpoints) SetProxyURL(url string) *Endpoints {
|
||||
(*ld.Node)(ep).SetNodes(as.ProxyURL, ld.Node{ID: url})
|
||||
return ep
|
||||
}
|
||||
|
||||
// GetOauthAuthzEndpoint returns the URL in [as.OauthAuthzEndpoint].
|
||||
func (ep *Endpoints) GetOauthAuthzEndpoint() string {
|
||||
if nodes := (*ld.Node)(ep).GetNodes(as.OauthAuthzEndpoint); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetOauthAuthzEndpoint sets the URL in [as.OauthAuthzEndpoint].
|
||||
func (ep *Endpoints) SetOauthAuthzEndpoint(url string) *Endpoints {
|
||||
(*ld.Node)(ep).SetNodes(as.OauthAuthzEndpoint, ld.Node{ID: url})
|
||||
return ep
|
||||
}
|
||||
|
||||
// GetOauthTokenEndpoint returns the URL in [as.OauthTokenEndpoint].
|
||||
func (ep *Endpoints) GetOauthTokenEndpoint() string {
|
||||
if nodes := (*ld.Node)(ep).GetNodes(as.OauthTokenEndpoint); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetOauthTokenEndpoint sets the URL in [as.OauthTokenEndpoint].
|
||||
func (ep *Endpoints) SetOauthTokenEndpoint(url string) *Endpoints {
|
||||
(*ld.Node)(ep).SetNodes(as.OauthTokenEndpoint, ld.Node{ID: url})
|
||||
return ep
|
||||
}
|
||||
|
||||
// GetSharedInbox returns the URL in [as.SharedInbox].
|
||||
func (ep *Endpoints) GetSharedInbox() string {
|
||||
if nodes := (*ld.Node)(ep).GetNodes(as.SharedInbox); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetSharedInbox sets the URL in [as.SharedInbox].
|
||||
func (ep *Endpoints) SetSharedInbox(url string) *Endpoints {
|
||||
(*ld.Node)(ep).SetNodes(as.SharedInbox, ld.Node{ID: url})
|
||||
return ep
|
||||
}
|
||||
24
vendor/sourcery.dny.nu/pana/event.go
vendored
Normal file
24
vendor/sourcery.dny.nu/pana/event.go
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Event is the Activitystreams Event type.
|
||||
type Event Object
|
||||
|
||||
// NewEvent initialises a new Event.
|
||||
func NewEvent() *Event {
|
||||
return &Event{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeEvent},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Event.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (e *Event) Build() Any {
|
||||
return Any(*e)
|
||||
}
|
||||
13
vendor/sourcery.dny.nu/pana/hashtag.go
vendored
Normal file
13
vendor/sourcery.dny.nu/pana/hashtag.go
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Hashtag is the ActivityStreams Hashtag.
|
||||
type Hashtag = LinkTag
|
||||
|
||||
// NewHashtag initialises a new Hashtag.
|
||||
func NewHashtag() *Hashtag {
|
||||
return (*Hashtag)(NewLinkTag().SetType(as.TypeHashtag))
|
||||
}
|
||||
29
vendor/sourcery.dny.nu/pana/helpers.go
vendored
Normal file
29
vendor/sourcery.dny.nu/pana/helpers.go
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package pana
|
||||
|
||||
import ld "sourcery.dny.nu/longdistance"
|
||||
|
||||
func toReference(ids ...string) []ld.Node {
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
res := make([]ld.Node, 0, len(ids))
|
||||
for _, id := range ids {
|
||||
res = append(res, ld.Node{ID: id})
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func toLDNodes[T ld.Internal](ins ...T) []ld.Node {
|
||||
if len(ins) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
res := make([]ld.Node, 0, len(ins))
|
||||
for _, in := range ins {
|
||||
res = append(res, ld.Node(in))
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
57
vendor/sourcery.dny.nu/pana/icon.go
vendored
Normal file
57
vendor/sourcery.dny.nu/pana/icon.go
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Icon is a more constrained version of [Image] used with [as.Icon].
|
||||
type Icon Image
|
||||
|
||||
// NewIcon initialises a new Icon.
|
||||
func NewIcon() *Icon {
|
||||
return &Icon{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeImage},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Icon.
|
||||
func (i *Icon) Build() Icon {
|
||||
return *i
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (i *Icon) GetType() string {
|
||||
return (*Image)(i).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (i *Icon) SetType() *Icon {
|
||||
(*Image)(i).SetType(as.TypeImage)
|
||||
return i
|
||||
}
|
||||
|
||||
// GetMediaType returns the value in [as.MediaType].
|
||||
func (i *Icon) GetMediaType() json.RawMessage {
|
||||
return (*Image)(i).GetMediaType()
|
||||
}
|
||||
|
||||
// SetMediaType sets the value in [as.MediaType].
|
||||
func (i *Icon) SetMediaType(v json.RawMessage) *Icon {
|
||||
(*Image)(i).SetMediaType(v)
|
||||
return i
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (i *Icon) GetURL() string {
|
||||
return (*Image)(i).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (i *Icon) SetURL(url string) *Icon {
|
||||
(*Image)(i).SetURL(url)
|
||||
return i
|
||||
}
|
||||
14
vendor/sourcery.dny.nu/pana/image.go
vendored
Normal file
14
vendor/sourcery.dny.nu/pana/image.go
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Image is the ActivityStreams Image type.
|
||||
//
|
||||
// It shares all properties with [Document].
|
||||
type Image = Document
|
||||
|
||||
func NewImage() *Image {
|
||||
return (*Image)(NewDocument().SetType(as.TypeImage))
|
||||
}
|
||||
57
vendor/sourcery.dny.nu/pana/instrument.go
vendored
Normal file
57
vendor/sourcery.dny.nu/pana/instrument.go
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Instrument is the ActivityStreams instrument object.
|
||||
type Instrument Object
|
||||
|
||||
// NewInstrument initialises a new Instrument.
|
||||
func NewInstrument() *Instrument {
|
||||
return &Instrument{
|
||||
Properties: make(ld.Properties, 2),
|
||||
Type: []string{as.TypeService},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Instrument.
|
||||
func (i *Instrument) Build() Instrument {
|
||||
return *i
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (i *Instrument) GetType() string {
|
||||
return (*Object)(i).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (i *Instrument) SetType(typ string) *Instrument {
|
||||
(*Object)(i).SetType(typ)
|
||||
return i
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (i *Instrument) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(i).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (i *Instrument) AddName(ls ...Localised) *Instrument {
|
||||
(*Object)(i).AddName(ls...)
|
||||
return i
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (i *Instrument) GetURL() string {
|
||||
return (*Object)(i).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (i *Instrument) SetURL(url string) *Instrument {
|
||||
(*Object)(i).SetURL(url)
|
||||
return i
|
||||
}
|
||||
21
vendor/sourcery.dny.nu/pana/internal/json/json.go
vendored
Normal file
21
vendor/sourcery.dny.nu/pana/internal/json/json.go
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package json
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type RawMessage = json.RawMessage
|
||||
|
||||
func GetContextDocument(doc RawMessage) (RawMessage, error) {
|
||||
var check struct {
|
||||
Context RawMessage `json:"@context,omitempty"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(doc, &check); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if check.Context != nil {
|
||||
return check.Context, nil
|
||||
}
|
||||
|
||||
return doc, nil
|
||||
}
|
||||
97
vendor/sourcery.dny.nu/pana/internal/loader/loader.go
vendored
Normal file
97
vendor/sourcery.dny.nu/pana/internal/loader/loader.go
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
package loader
|
||||
|
||||
import (
|
||||
"context"
|
||||
"maps"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/internal/json"
|
||||
"sourcery.dny.nu/pana/vocab/geojson"
|
||||
gts "sourcery.dny.nu/pana/vocab/gotosocial"
|
||||
"sourcery.dny.nu/pana/vocab/litepub"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
credv1 "sourcery.dny.nu/pana/vocab/w3id/credentialsv1"
|
||||
idv1 "sourcery.dny.nu/pana/vocab/w3id/identityv1"
|
||||
secv1 "sourcery.dny.nu/pana/vocab/w3id/securityv1"
|
||||
)
|
||||
|
||||
// Builtin is a remote context cache.
|
||||
type Builtin struct {
|
||||
domains map[string]ld.Document
|
||||
paths map[string]ld.Document
|
||||
pathKeys []string
|
||||
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
func New() *Builtin {
|
||||
b := &Builtin{
|
||||
domains: make(map[string]ld.Document, 8),
|
||||
paths: make(map[string]ld.Document, 2),
|
||||
}
|
||||
b.RegisterContextURL(as.IRI, as.ContextDocument)
|
||||
b.RegisterContextURL(gts.IRI, gts.ContextDocument)
|
||||
b.RegisterContextURL(credv1.IRI, credv1.ContextDocument)
|
||||
b.RegisterContextURL(idv1.IRI, idv1.ContextDocument)
|
||||
b.RegisterContextURL(secv1.IRI, secv1.ContextDocument)
|
||||
b.RegisterContextURL(litepub.IRI, litepub.ContextDocument)
|
||||
b.RegisterContextURL(geojson.IRI, geojson.ContextDocument)
|
||||
b.RegisterContextPath("/litepub-0.1.jsonld", litepub.ContextDocument1dot0)
|
||||
return b
|
||||
}
|
||||
|
||||
// Get is an [ld.RemoteContextLoaderFunc].
|
||||
func (b *Builtin) Get(_ context.Context, url string) (ld.Document, error) {
|
||||
b.lock.RLock()
|
||||
defer b.lock.RUnlock()
|
||||
|
||||
if doc, ok := b.domains[url]; ok {
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
for _, path := range b.pathKeys {
|
||||
if strings.HasSuffix(url, path) {
|
||||
doc := b.paths[path]
|
||||
doc.URL = url
|
||||
return doc, nil
|
||||
}
|
||||
}
|
||||
|
||||
return ld.Document{}, ld.ErrLoadingRemoteContext
|
||||
}
|
||||
|
||||
// RegisterContextURL adds or overrides a context document for the specified
|
||||
// remote context URL in the loader.
|
||||
func (b *Builtin) RegisterContextURL(url string, doc json.RawMessage) error {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
ctx, err := json.GetContextDocument(doc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
b.domains[url] = ld.Document{URL: url, Context: ctx}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterContextPath adds or overrides a context document for the specified
|
||||
// remote path in the loader.
|
||||
//
|
||||
// Paths are always matches as URL suffixes.
|
||||
func (b *Builtin) RegisterContextPath(path string, doc json.RawMessage) error {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
ctx, err := json.GetContextDocument(doc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
b.paths[path] = ld.Document{URL: "", Context: ctx}
|
||||
b.pathKeys = slices.Collect(maps.Keys(b.paths))
|
||||
return nil
|
||||
}
|
||||
198
vendor/sourcery.dny.nu/pana/link.go
vendored
Normal file
198
vendor/sourcery.dny.nu/pana/link.go
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Link is the ActivityStreams Link type.
|
||||
//
|
||||
// Though Link can have an ID, this never happens in practice because the target
|
||||
// of a link is stored in [as.Href] instead.
|
||||
type Link ld.Node
|
||||
|
||||
// NewLink initialises a new Link.
|
||||
func NewLink() *Link {
|
||||
return &Link{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeLink},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Link.
|
||||
func (l *Link) Build() Link {
|
||||
return *l
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
//
|
||||
// This will most commonly be one of:
|
||||
// - [as.TypeLink]
|
||||
// - [as.TypeDocument]
|
||||
// - [as.TypeImage]
|
||||
// - [as.TypeAudio]
|
||||
// - [as.TypeVideo]
|
||||
// - [as.TypeMention]
|
||||
// - [as.TypeHashtag]
|
||||
//
|
||||
// You'll probably want to use [LinkTag] for Mention and Hashtag.
|
||||
func (l *Link) GetType() string {
|
||||
if l.Type == nil {
|
||||
return ""
|
||||
}
|
||||
return l.Type[0]
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (l *Link) SetType(t string) *Link {
|
||||
l.Type = []string{t}
|
||||
return l
|
||||
}
|
||||
|
||||
// GetHref returns the value from [as.Href].
|
||||
func (l *Link) GetHref() string {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.Href); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetHref sets a URL in [as.Href].
|
||||
func (l *Link) SetHref(url string) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.Href, ld.Node{ID: url})
|
||||
return l
|
||||
}
|
||||
|
||||
// GetName returns the value from [as.Name].
|
||||
func (l *Link) GetName() iter.Seq[*Localised] {
|
||||
return func(yield func(*Localised) bool) {
|
||||
for _, n := range (*ld.Node)(l).GetNodes(as.Name) {
|
||||
if !yield((*Localised)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetName sets a value in [as.Name].
|
||||
func (l *Link) AddName(ls ...Localised) *Link {
|
||||
(*ld.Node)(l).AddNodes(as.Name, toLDNodes(ls...)...)
|
||||
return l
|
||||
}
|
||||
|
||||
// GetHreflang returns the value from [as.Hreflang].
|
||||
func (l *Link) GetHreflang() json.RawMessage {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.Hreflang); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetHreflang sets a value in [as.Hreflang].
|
||||
func (l *Link) SetHreflang(hreflang json.RawMessage) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.Hreflang, ld.Node{Value: hreflang})
|
||||
return l
|
||||
}
|
||||
|
||||
// GetMediaType returns the value from [as.MediaType].
|
||||
func (l *Link) GetMediaType() json.RawMessage {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.MediaType); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetMediaType sets a value in [as.MediaType].
|
||||
func (l *Link) SetMediaType(mediaType json.RawMessage) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.MediaType, ld.Node{Value: mediaType})
|
||||
return l
|
||||
}
|
||||
|
||||
// GetRel returns the value from [as.Rel].
|
||||
func (l *Link) GetRel() json.RawMessage {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.Rel); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetRel sets a value in [as.Rel].
|
||||
func (l *Link) SetRel(rel json.RawMessage) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.Rel, ld.Node{Value: rel})
|
||||
return l
|
||||
}
|
||||
|
||||
// GetHeight returns the value from [as.Height].
|
||||
func (l *Link) GetHeight() json.RawMessage {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.Height); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetHeight sets a value in [as.Height].
|
||||
func (l *Link) SetHeight(height json.RawMessage) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.Height, ld.Node{Value: height})
|
||||
return l
|
||||
}
|
||||
|
||||
// GetWidth returns the value from [as.Width].
|
||||
func (l *Link) GetWidth() json.RawMessage {
|
||||
if nodes := (*ld.Node)(l).GetNodes(as.Width); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetWidth sets a value in [as.Width].
|
||||
func (l *Link) SetWidth(width json.RawMessage) *Link {
|
||||
(*ld.Node)(l).SetNodes(as.Width, ld.Node{Value: width})
|
||||
return l
|
||||
}
|
||||
|
||||
// LinkTag is a more constrained version of [Link] that is used in [as.Tag].
|
||||
//
|
||||
// It's usually used to represent hashtags and mentions.
|
||||
type LinkTag Link
|
||||
|
||||
func NewLinkTag() *LinkTag {
|
||||
return &LinkTag{
|
||||
Properties: make(ld.Properties, 2),
|
||||
}
|
||||
}
|
||||
|
||||
// See [Link.GetType].
|
||||
func (l *LinkTag) GetType() string {
|
||||
return (*Link)(l).GetType()
|
||||
}
|
||||
|
||||
// See [Link.SetType].
|
||||
func (l *LinkTag) SetType(t string) *LinkTag {
|
||||
(*Link)(l).SetType(t)
|
||||
return l
|
||||
}
|
||||
|
||||
// See [Link.GetHref]
|
||||
func (l *LinkTag) GetHref() string {
|
||||
return (*Link)(l).GetHref()
|
||||
}
|
||||
|
||||
// See [Link.SetHref].
|
||||
func (l *LinkTag) SetHref(url string) *LinkTag {
|
||||
(*Link)(l).SetHref(url)
|
||||
return l
|
||||
}
|
||||
|
||||
// See [Link.GetName].
|
||||
func (l *LinkTag) GetName() iter.Seq[*Localised] {
|
||||
return (*Link)(l).GetName()
|
||||
}
|
||||
|
||||
// See [Link.AddName].
|
||||
func (l *LinkTag) AddName(ls ...Localised) *LinkTag {
|
||||
(*Link)(l).AddName(ls...)
|
||||
return l
|
||||
}
|
||||
49
vendor/sourcery.dny.nu/pana/localised.go
vendored
Normal file
49
vendor/sourcery.dny.nu/pana/localised.go
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
)
|
||||
|
||||
// Localised represents a value with an optional language tag and direction.
|
||||
//
|
||||
// It mirrors a language-mapped attribute in JSON-LD.
|
||||
type Localised ld.Node
|
||||
type Localized = Localised
|
||||
|
||||
// NewLocalised initialises a new Localised.
|
||||
func NewLocalised() *Localised {
|
||||
return &Localised{}
|
||||
}
|
||||
|
||||
// Build finalises the Localised.
|
||||
func (l *Localised) Build() Localised {
|
||||
return *l
|
||||
}
|
||||
|
||||
// GetLanguage returns a normalised to lower-case BCP-47 language tag.
|
||||
//
|
||||
// The empty string indicates that the language is unknown, not English.
|
||||
func (l *Localised) GetLanguage() string {
|
||||
return l.Language
|
||||
}
|
||||
|
||||
// SetLanguage sets the language tag for the value.
|
||||
//
|
||||
// This must be a valid BCP-47 language tag and may be normalised to lower-case.
|
||||
func (l *Localised) SetLanguage(lang string) *Localised {
|
||||
l.Language = lang
|
||||
return l
|
||||
}
|
||||
|
||||
// GetValue returns the value.
|
||||
func (l *Localised) GetValue() json.RawMessage {
|
||||
return l.Value
|
||||
}
|
||||
|
||||
// SetValue sets the value.
|
||||
func (l *Localised) SetValue(value json.RawMessage) *Localised {
|
||||
l.Value = value
|
||||
return l
|
||||
}
|
||||
11
vendor/sourcery.dny.nu/pana/mention.go
vendored
Normal file
11
vendor/sourcery.dny.nu/pana/mention.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package pana
|
||||
|
||||
import as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
|
||||
// Mention is the ActivityStreams Mention.
|
||||
type Mention = LinkTag
|
||||
|
||||
// NewMention initialises a new Mention.
|
||||
func NewMention() *Mention {
|
||||
return (*Mention)(NewLinkTag().SetType(as.TypeMention))
|
||||
}
|
||||
286
vendor/sourcery.dny.nu/pana/note.go
vendored
Normal file
286
vendor/sourcery.dny.nu/pana/note.go
vendored
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/litepub"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Note is the ActivityStreams Note type.
|
||||
type Note Object
|
||||
|
||||
// NewNote initialises a new Note.
|
||||
func NewNote() *Note {
|
||||
return &Note{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeNote},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Note.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (n *Note) Build() Any {
|
||||
return Any(*n)
|
||||
}
|
||||
|
||||
// See [Object.GetID].
|
||||
func (n *Note) GetID() string {
|
||||
return (*Object)(n).GetID()
|
||||
}
|
||||
|
||||
// See [Object.SetID].
|
||||
func (n *Note) SetID(id string) *Note {
|
||||
(*Object)(n).SetID(id)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (n *Note) GetType() string {
|
||||
return (*Object)(n).GetType()
|
||||
}
|
||||
|
||||
// SetType sets the type to [as.Note].
|
||||
func (n *Note) SetType() {
|
||||
n.Type = []string{as.TypeNote}
|
||||
}
|
||||
|
||||
// See [Activity.GetActor].
|
||||
func (n *Note) GetActor() iter.Seq[string] {
|
||||
return (*Activity)(n).GetActor()
|
||||
}
|
||||
|
||||
// See [Activity.AddActor].
|
||||
func (n *Note) AddActor(ids ...string) *Note {
|
||||
(*Activity)(n).AddActor(ids...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetAtomURI].
|
||||
func (n *Note) GetAtomURI() string {
|
||||
return (*Object)(n).GetAtomURI()
|
||||
}
|
||||
|
||||
// See [Object.SetAtomURI].
|
||||
func (n *Note) SetAtomURI(uri string) *Note {
|
||||
(*Object)(n).SetAtomURI(uri)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetAttachment].
|
||||
func (n *Note) GetAttachment() iter.Seq[*Any] {
|
||||
return (*Object)(n).GetAttachment()
|
||||
}
|
||||
|
||||
// See [Object.AddAttachment].
|
||||
func (n *Note) AddAttachment(atch ...Any) *Note {
|
||||
(*Object)(n).AddAttachment(atch...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetAttributedTo].
|
||||
func (n *Note) GetAttributedTo() iter.Seq[string] {
|
||||
return (*Object)(n).GetAttributedTo()
|
||||
}
|
||||
|
||||
// See [Object.AddAttributedTo].
|
||||
func (n *Note) AddAttributedTo(ids ...string) *Note {
|
||||
(*Object)(n).AddAttributedTo(ids...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetCc].
|
||||
func (n *Note) GetCc() iter.Seq[string] {
|
||||
return (*Object)(n).GetCc()
|
||||
}
|
||||
|
||||
// See [Object.AddCc].
|
||||
func (n *Note) AddCc(ids ...string) *Note {
|
||||
(*Object)(n).AddCc(ids...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetContent].
|
||||
func (n *Note) GetContent() iter.Seq[*Localised] {
|
||||
return (*Object)(n).GetContent()
|
||||
}
|
||||
|
||||
// See [Object.AddContent].
|
||||
func (n *Note) AddContent(ls ...Localised) *Note {
|
||||
(*Object)(n).AddContent(ls...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetContext].
|
||||
func (n *Note) GetContext() string {
|
||||
return (*Object)(n).GetContext()
|
||||
}
|
||||
|
||||
// See [Object.SetContext].
|
||||
func (n *Note) SetContext(id string) *Note {
|
||||
(*Object)(n).SetContext(id)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetConversation].
|
||||
func (n *Note) GetConversation() string {
|
||||
return (*Object)(n).GetConversation()
|
||||
}
|
||||
|
||||
// See [Object.SetConversation].
|
||||
func (n *Note) SetConversation(id string) *Note {
|
||||
(*Object)(n).SetConversation(id)
|
||||
return n
|
||||
}
|
||||
|
||||
// GetDirectMessage returns the value in [litepub.DirectMessage].
|
||||
//
|
||||
// It returns false if the value is absent.
|
||||
func (n *Note) GetDirectMessage() json.RawMessage {
|
||||
if nodes := (*ld.Node)(n).GetNodes(litepub.DirectMessage); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return json.RawMessage(`false`)
|
||||
}
|
||||
|
||||
// SetDirectMessage sets the value in [litepub.DirectMessage].
|
||||
func (n *Note) SetDirectMessage(v json.RawMessage) *Note {
|
||||
(*ld.Node)(n).SetNodes(litepub.DirectMessage, ld.Node{Value: v})
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetInReplyTo].
|
||||
func (n *Note) GetInReplyTo() string {
|
||||
return (*Object)(n).GetInReplyTo()
|
||||
}
|
||||
|
||||
// See [Object.SetInReplyTo].
|
||||
func (n *Note) SetInReplyTo(id string) *Note {
|
||||
(*Object)(n).SetInReplyTo(id)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetInReplyToAtomURI].
|
||||
func (n *Note) GetInReplyToAtomURI() string {
|
||||
return (*Object)(n).GetInReplyToAtomURI()
|
||||
}
|
||||
|
||||
// See [Object.SetInReplyToAtomURI].
|
||||
func (n *Note) SetInReplyToAtomURI(id string) *Note {
|
||||
(*Object)(n).SetInReplyToAtomURI(id)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetLikes].
|
||||
func (n *Note) GetLikes() *Collection {
|
||||
return (*Object)(n).GetLikes()
|
||||
}
|
||||
|
||||
// See [Object.SetLikes].
|
||||
func (n *Note) SetLikes(c Collection) *Note {
|
||||
(*Object)(n).SetLikes(c)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetPublished].
|
||||
func (n *Note) GetPublished() json.RawMessage {
|
||||
return (*Object)(n).GetPublished()
|
||||
}
|
||||
|
||||
// See [Object.SetPublished].
|
||||
func (n *Note) SetPublished(v json.RawMessage) *Note {
|
||||
(*Object)(n).SetPublished(v)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetReplies].
|
||||
func (n *Note) GetReplies() *Collection {
|
||||
return (*Object)(n).GetReplies()
|
||||
}
|
||||
|
||||
// See [Object.SetReplies].
|
||||
func (n *Note) SetReplies(c Collection) *Note {
|
||||
(*Object)(n).SetReplies(c)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetSensitive].
|
||||
func (n *Note) GetSensitive() json.RawMessage {
|
||||
return (*Object)(n).GetSensitive()
|
||||
}
|
||||
|
||||
// See [Object.SetSensitive].
|
||||
func (n *Note) SetSensitive(v json.RawMessage) *Note {
|
||||
(*Object)(n).SetSensitive(v)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetShares].
|
||||
func (n *Note) GetShares() *Collection {
|
||||
return (*Object)(n).GetShares()
|
||||
}
|
||||
|
||||
// See [Object.SetShares].
|
||||
func (n *Note) SetShares(c Collection) *Note {
|
||||
(*Object)(n).SetShares(c)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetSummary].
|
||||
func (n *Note) GetSummary() iter.Seq[*Localised] {
|
||||
return (*Object)(n).GetSummary()
|
||||
}
|
||||
|
||||
// See [Object.AddSummary].
|
||||
func (n *Note) AddSummary(ls ...Localised) *Note {
|
||||
(*Object)(n).AddSummary(ls...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetTag].
|
||||
func (n *Note) GetTag() iter.Seq[*Any] {
|
||||
return (*Object)(n).GetTag()
|
||||
}
|
||||
|
||||
// See [Object.AddTag].
|
||||
func (n *Note) AddTag(tags ...Any) *Note {
|
||||
(*Object)(n).AddTag(tags...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetTo].
|
||||
func (n *Note) GetTo() iter.Seq[string] {
|
||||
return (*Object)(n).GetTo()
|
||||
}
|
||||
|
||||
// See [Object.AddTo].
|
||||
func (n *Note) AddTo(ids ...string) *Note {
|
||||
(*Object)(n).AddTo(ids...)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetUpdated].
|
||||
func (n *Note) GetUpdated() json.RawMessage {
|
||||
return (*Object)(n).GetUpdated()
|
||||
}
|
||||
|
||||
// See [Object.SetUpdated].
|
||||
func (n *Note) SetUpdated(v json.RawMessage) *Note {
|
||||
(*Object)(n).SetUpdated(v)
|
||||
return n
|
||||
}
|
||||
|
||||
// See [Object.GetURL].
|
||||
func (n *Note) GetURL() string {
|
||||
return (*Object)(n).GetURL()
|
||||
}
|
||||
|
||||
// See [Object.SetURL].
|
||||
func (n *Note) SetURL(id string) *Note {
|
||||
(*Object)(n).SetURL(id)
|
||||
return n
|
||||
}
|
||||
431
vendor/sourcery.dny.nu/pana/object.go
vendored
Normal file
431
vendor/sourcery.dny.nu/pana/object.go
vendored
Normal file
|
|
@ -0,0 +1,431 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/ostatus"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Object is the ActivityStreams Object type.
|
||||
type Object ld.Node
|
||||
|
||||
// NewObject initialises a new Object.
|
||||
func NewObject() *Object {
|
||||
return &Object{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeObject},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Object.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (o *Object) Build() Any {
|
||||
return Any(*o)
|
||||
}
|
||||
|
||||
// GetID returns the object ID from [ld.Node.ID].
|
||||
//
|
||||
// This is equivalent to the 'id' property in compacted form JSON or the '@id'
|
||||
// property in expanded form.
|
||||
//
|
||||
// If an object doesn't have an ID but does have other properties it is an
|
||||
// anonymous object (a blank node). This represents something that exists but is
|
||||
// not named or referencable.
|
||||
func (o *Object) GetID() string {
|
||||
return o.ID
|
||||
}
|
||||
|
||||
// SetID sets the object ID in [ld.Node.ID].
|
||||
func (o *Object) SetID(id string) *Object {
|
||||
o.ID = id
|
||||
return o
|
||||
}
|
||||
|
||||
// GetType returns the first type from [ld.Node.Type].
|
||||
//
|
||||
// This is equivalent to the 'type' property in compacted form JSON or the
|
||||
// '@type' property in expanded form.
|
||||
//
|
||||
// It will return the empty string if the object has no type.
|
||||
//
|
||||
// An object can have multiple types, but this is so uncommon on the fediverse
|
||||
// that this method only returns the first type. You can check the size of
|
||||
// [ld.Node.Type] if you'd like.
|
||||
func (o *Object) GetType() string {
|
||||
if o.Type == nil {
|
||||
return ""
|
||||
}
|
||||
return o.Type[0]
|
||||
}
|
||||
|
||||
// SetType sets the type in [ld.Node.Type].
|
||||
func (o *Object) SetType(t string) *Object {
|
||||
o.Type = []string{t}
|
||||
return o
|
||||
}
|
||||
|
||||
// GetCc returns the audience IDs from [as.Cc].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-cc.
|
||||
func (o *Object) GetCc() iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Cc) {
|
||||
if !yield(n.ID) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddCc appends audience IDs to [as.Cc].
|
||||
func (o *Object) AddCc(ids ...string) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Cc, toReference(ids...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetContent returns the localised values in [as.Content].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-content.
|
||||
func (o *Object) GetContent() iter.Seq[*Localised] {
|
||||
return func(yield func(*Localised) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Content) {
|
||||
if !yield((*Localised)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddContent adds values to [as.Content].
|
||||
func (o *Object) AddContent(ls ...Localised) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Content, toLDNodes(ls...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetContext returns the ID in [as.Context].
|
||||
//
|
||||
// This is not the JSON-LD [ld.KeywordContext].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-context.
|
||||
func (o *Object) GetContext() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Context); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetContext sets the ID in [as.Context].
|
||||
func (o *Object) SetContext(id string) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Context, ld.Node{ID: id})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetTo returns the audience IDs from [as.To].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-to.
|
||||
func (o *Object) GetTo() iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.To) {
|
||||
if !yield(n.ID) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddTo appends audience IDs to [as.To].
|
||||
func (o *Object) AddTo(ids ...string) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.To, toReference(ids...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetPublished retrieves the value from [as.Published].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-published.
|
||||
func (o *Object) GetPublished() json.RawMessage {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Published); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPublished sets the value in [as.Published].
|
||||
func (o *Object) SetPublished(value json.RawMessage) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Published, ld.Node{Value: value})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetAttributedTo returns the actor IDs from [as.AttributedTo].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto.
|
||||
func (o *Object) GetAttributedTo() iter.Seq[string] {
|
||||
return func(yield func(string) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.AttributedTo) {
|
||||
if !yield(n.ID) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddAttributedTo appends actor IDs to [as.AttributedTo].
|
||||
func (o *Object) AddAttributedTo(ids ...string) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.To, toReference(ids...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetReplies returns the [Collection] stored in [as.Replies].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-replies.
|
||||
func (o *Object) GetReplies() *Collection {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Replies); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetReplies sets the [Collection] in [as.Replies].
|
||||
func (o *Object) SetReplies(c Collection) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Replies, ld.Node(c))
|
||||
return o
|
||||
}
|
||||
|
||||
// GetURL returns the URL in [as.URL].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-url.
|
||||
func (o *Object) GetURL() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.URL); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetURL sets the URL in [as.URL].
|
||||
func (o *Object) SetURL(url string) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.URL, toReference(url)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetConversation returns the URI in [ostatus.Conversation].
|
||||
//
|
||||
// This is a [tag URI].
|
||||
//
|
||||
// [tag URI]: https://datatracker.ietf.org/doc/html/rfc4151
|
||||
func (o *Object) GetConversation() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(ostatus.Conversation); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetConversation sets the URI in [ostatus.Conversation].
|
||||
func (o *Object) SetConversation(uri string) *Object {
|
||||
(*ld.Node)(o).SetNodes(ostatus.Conversation, ld.Node{ID: uri})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetAtomUri returns the URI in [ostatus.AtomURI].
|
||||
//
|
||||
// [tag URI]: https://datatracker.ietf.org/doc/html/rfc4151
|
||||
func (o *Object) GetAtomURI() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(ostatus.AtomURI); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetAtomUri sets the URI in [ostatus.AtomURI].
|
||||
func (o *Object) SetAtomURI(uri string) *Object {
|
||||
(*ld.Node)(o).SetNodes(ostatus.AtomURI, ld.Node{ID: uri})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetSummary returns the localised values in [as.Summary].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-summary.
|
||||
func (o *Object) GetSummary() iter.Seq[*Localised] {
|
||||
return func(yield func(*Localised) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Summary) {
|
||||
if !yield((*Localised)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddSummary adds values to [as.Summary].
|
||||
func (o *Object) AddSummary(ls ...Localised) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Summary, toLDNodes(ls...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetTag returns the values in [as.Tag].
|
||||
//
|
||||
// This returns Any because it can be an Emoji, a Hashtag, combinations of the
|
||||
// two or more.
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tag.
|
||||
func (o *Object) GetTag() iter.Seq[*Any] {
|
||||
return func(yield func(*Any) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Tag) {
|
||||
if !yield((*Any)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddTag appends a tag to [as.Tag].
|
||||
func (o *Object) AddTag(tag ...Any) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Tag, toLDNodes(tag...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetInReplyTo returns the URL in [as.InReplyTo].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-inreplyto.
|
||||
func (o *Object) GetInReplyTo() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.InReplyTo); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetInReplyTo sets the URL in [as.InReplyTo].
|
||||
func (o *Object) SetInReplyTo(url string) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.InReplyTo, ld.Node{ID: url})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetAttachment returns the attachments in [as.Attachment].
|
||||
//
|
||||
// This returns [Any] because is can be a Document, PropertyValue, a combination
|
||||
// of both and more.
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attachment.
|
||||
func (o *Object) GetAttachment() iter.Seq[*Any] {
|
||||
return func(yield func(*Any) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Attachment) {
|
||||
if !yield((*Any)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddAttachment appends attachments to [as.Attachment].
|
||||
func (o *Object) AddAttachment(atch ...Any) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Attachment, toLDNodes(atch...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetSensitive returns the value from [as.Sensitive].
|
||||
//
|
||||
// See https://swicg.github.io/miscellany/#sensitive.
|
||||
func (o *Object) GetSensitive() json.RawMessage {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Sensitive); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSensitive sets the value in [as.Sensitive].
|
||||
func (o *Object) SetSensitive(v json.RawMessage) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Sensitive, ld.Node{Value: v})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetInReplyToAtomURI returns the URI in [ostatus.InReplyToAtomUri].
|
||||
func (o *Object) GetInReplyToAtomURI() string {
|
||||
if nodes := (*ld.Node)(o).GetNodes(ostatus.InReplyToAtomURI); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetInReplyToAtomURI sets the URI in [ostatus.InReplyToAtomUri].
|
||||
func (o *Object) SetInReplyToAtomURI(uri string) *Object {
|
||||
(*ld.Node)(o).SetNodes(ostatus.InReplyToAtomURI, ld.Node{ID: uri})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetUpdated returns the value in [as.Updated].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-endtime.
|
||||
func (o *Object) GetUpdated() json.RawMessage {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Updated); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetUpdated sets the value in [as.Updated].
|
||||
func (o *Object) SetUpdated(v json.RawMessage) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Updated, ld.Node{Value: v})
|
||||
return o
|
||||
}
|
||||
|
||||
// GetName returns the localised values in [as.Name].
|
||||
func (o *Object) GetName() iter.Seq[*Localised] {
|
||||
return func(yield func(*Localised) bool) {
|
||||
for _, n := range (*ld.Node)(o).GetNodes(as.Name) {
|
||||
if !yield((*Localised)(&n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddName appends localised values to [as.Name].
|
||||
func (o *Object) AddName(ls ...Localised) *Object {
|
||||
(*ld.Node)(o).AddNodes(as.Name, toLDNodes(ls...)...)
|
||||
return o
|
||||
}
|
||||
|
||||
// GetLikes returns the [Collection] stored in [as.Likes].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#likes.
|
||||
func (o *Object) GetLikes() *Collection {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Likes); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetLikes sets the [Collection] in [as.Likes].
|
||||
func (o *Object) SetLikes(c Collection) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Likes, ld.Node(c))
|
||||
return o
|
||||
}
|
||||
|
||||
// GetShares returns the [Collection] stored in [as.Shares].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitypub/#shares.
|
||||
func (o *Object) GetShares() *Collection {
|
||||
if nodes := (*ld.Node)(o).GetNodes(as.Shares); len(nodes) == 1 {
|
||||
return (*Collection)(&nodes[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetShares sets the [Collection] in [as.Shares].
|
||||
func (o *Object) SetShares(c Collection) *Object {
|
||||
(*ld.Node)(o).SetNodes(as.Shares, ld.Node(c))
|
||||
return o
|
||||
}
|
||||
24
vendor/sourcery.dny.nu/pana/page.go
vendored
Normal file
24
vendor/sourcery.dny.nu/pana/page.go
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Page is the ActivityStreams Page type.
|
||||
type Page Object
|
||||
|
||||
// NewPage initialises a new Page.
|
||||
func NewPage() *Page {
|
||||
return &Page{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypePage},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Page.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (p *Page) Build() Any {
|
||||
return Any(*p)
|
||||
}
|
||||
58
vendor/sourcery.dny.nu/pana/pana.go
vendored
Normal file
58
vendor/sourcery.dny.nu/pana/pana.go
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
)
|
||||
|
||||
// Has checks if an object has a specific property set.
|
||||
//
|
||||
// It handles JSON-LD keyword aliasses for id and type.
|
||||
func Has[T ld.Internal](in *T, property string) bool {
|
||||
if property == "id" {
|
||||
property = ld.KeywordID
|
||||
}
|
||||
|
||||
if property == "type" {
|
||||
property = ld.KeywordType
|
||||
}
|
||||
|
||||
return (*ld.Node)(unsafe.Pointer(in)).Has(property)
|
||||
}
|
||||
|
||||
// IsReference indicates if this object is a reference.
|
||||
//
|
||||
// This means it only has the ID, and optionally a Type, set. You'll need to
|
||||
// retrieve the object using the ID to get additional properties.
|
||||
func IsReference[T ld.Internal](in *T) bool {
|
||||
return (*ld.Node)(unsafe.Pointer(in)).IsSubjectReference()
|
||||
}
|
||||
|
||||
// IsObject indicates if this object is a (partially) complete object.
|
||||
//
|
||||
// This means it has an ID, optionally a Type and at least one other
|
||||
// property. It doesn't mean the object representation is complete, and you may
|
||||
// need to retrieve the object using the ID to get additional properties.
|
||||
func IsObjec[T ld.Internal](in *T) bool {
|
||||
return (*ld.Node)(unsafe.Pointer(in)).IsSubject()
|
||||
}
|
||||
|
||||
// Properties returns a set with an entry for each property set on an object.
|
||||
//
|
||||
// It handles JSON-LD keyword aliasses for id and type.
|
||||
func Properties[T ld.Internal](in *T) map[string]struct{} {
|
||||
s := (*ld.Node)(unsafe.Pointer(in)).PropertySet()
|
||||
|
||||
if _, ok := s[ld.KeywordID]; ok {
|
||||
delete(s, ld.KeywordID)
|
||||
s["id"] = struct{}{}
|
||||
}
|
||||
|
||||
if _, ok := s[ld.KeywordType]; ok {
|
||||
delete(s, ld.KeywordType)
|
||||
s["type"] = struct{}{}
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
22
vendor/sourcery.dny.nu/pana/place.go
vendored
Normal file
22
vendor/sourcery.dny.nu/pana/place.go
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Place is the ActivityStreams Place type.
|
||||
type Place Object
|
||||
|
||||
// NewPlace initialises a new Place.
|
||||
func NewPlace() *Place {
|
||||
return &Place{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypePlace},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Place.
|
||||
func (p *Place) Build() Place {
|
||||
return *p
|
||||
}
|
||||
115
vendor/sourcery.dny.nu/pana/processor.go
vendored
Normal file
115
vendor/sourcery.dny.nu/pana/processor.go
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/internal/json"
|
||||
"sourcery.dny.nu/pana/internal/loader"
|
||||
"sourcery.dny.nu/pana/vocab/schema"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Processor is used to process incoming messages and prepare outgoing messages.
|
||||
//
|
||||
// Your application only needs a single processor instance.
|
||||
type Processor struct {
|
||||
ldproc *ld.Processor
|
||||
l *loader.Builtin
|
||||
}
|
||||
|
||||
// NewProcessor initialised a new [Processor] suitable for dealing with
|
||||
// ActivityStreams messages.
|
||||
//
|
||||
// It uses [loader.Builtin] to retrieve contexts and does not retrieve them over
|
||||
// the network.
|
||||
func NewProcessor(
|
||||
logger *slog.Logger,
|
||||
) *Processor {
|
||||
if logger == nil {
|
||||
logger = slog.New(slog.DiscardHandler)
|
||||
}
|
||||
|
||||
loader := loader.New()
|
||||
return &Processor{
|
||||
l: loader,
|
||||
ldproc: ld.NewProcessor(
|
||||
ld.WithLogger(logger),
|
||||
ld.WithCompactArrays(true),
|
||||
ld.WithCompactToRelative(false), // Avoids compacting to relative IRIs
|
||||
ld.With10Processing(false), // Misskey seems to do some JSON-LD 1.1
|
||||
ld.WithRemoteContextLoader(loader.Get),
|
||||
ld.WithExcludeIRIsFromCompaction(as.PublicCollection),
|
||||
ld.WithRemapPrefixIRIs("http://schema.org#", schema.Namespace),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// Marshal takes an [Activity] and returns JSON-LD in compacted document form.
|
||||
//
|
||||
// This is the shape of JSON you want to exchange with other servers and
|
||||
// clients.
|
||||
//
|
||||
// The compaction context is a JSON document representing the JSON-LD context
|
||||
// that should be used for compaction.
|
||||
func (p *Processor) Marshal(
|
||||
compactionContext json.RawMessage,
|
||||
activity Activity,
|
||||
) (json.RawMessage, error) {
|
||||
if compactionContext[0] == '{' {
|
||||
ctx, err := json.GetContextDocument(compactionContext)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
compactionContext = ctx
|
||||
}
|
||||
|
||||
return p.ldproc.Compact(
|
||||
compactionContext,
|
||||
[]ld.Node{ld.Node(activity)},
|
||||
"",
|
||||
)
|
||||
}
|
||||
|
||||
// Unmarshal takes a JSON document and returns an [Activity] that represents it
|
||||
// using JSON-LD expanded document form.
|
||||
//
|
||||
// In JSON-LD the result of expanding a document is always a list. But in the
|
||||
// case of ActivityPub we only ever send out a single document at a time, so it
|
||||
// returns [Activity]. If the result happens to have more than one object an
|
||||
// error is raised so it doesn't go unnoticed.
|
||||
func (p *Processor) Unmarshal(
|
||||
document json.RawMessage,
|
||||
) (*Activity, error) {
|
||||
res, err := p.ldproc.Expand(document, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if lres := len(res); lres != 1 {
|
||||
return nil, fmt.Errorf("expected a single document, got: %d", lres)
|
||||
}
|
||||
|
||||
return (*Activity)(&res[0]), nil
|
||||
}
|
||||
|
||||
// RegisterContextURL adds or overrides a context document for the specified
|
||||
// remote context URL in the loader.
|
||||
func (p *Processor) RegisterContextURL(
|
||||
url string,
|
||||
doc json.RawMessage,
|
||||
) error {
|
||||
return p.l.RegisterContextURL(url, doc)
|
||||
}
|
||||
|
||||
// RegisterContextPath adds or overrides a context document for the specified
|
||||
// remote path in the loader.
|
||||
//
|
||||
// Paths are always matches as URL suffixes.
|
||||
func (p *Processor) RegisterContextPath(
|
||||
path string,
|
||||
doc json.RawMessage,
|
||||
) error {
|
||||
return p.l.RegisterContextPath(path, doc)
|
||||
}
|
||||
24
vendor/sourcery.dny.nu/pana/profile.go
vendored
Normal file
24
vendor/sourcery.dny.nu/pana/profile.go
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Profile is the ActivityStreams Profile type.
|
||||
type Profile Object
|
||||
|
||||
// NewProfile initialises a new Profile.
|
||||
func NewProfile() *Profile {
|
||||
return &Profile{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeProfile},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Profile.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (p *Profile) Build() Any {
|
||||
return Any(*p)
|
||||
}
|
||||
76
vendor/sourcery.dny.nu/pana/public_key.go
vendored
Normal file
76
vendor/sourcery.dny.nu/pana/public_key.go
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
secv1 "sourcery.dny.nu/pana/vocab/w3id/securityv1"
|
||||
)
|
||||
|
||||
// PublicKey is the W3ID Security v1 Public Key.
|
||||
type PublicKey ld.Node
|
||||
|
||||
// NewPublicKey initialises a new PublicKey.
|
||||
func NewPublicKey() *PublicKey {
|
||||
return &PublicKey{
|
||||
Properties: make(ld.Properties, 2),
|
||||
Type: []string{secv1.PublicKey},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the PublicKey.
|
||||
func (pk *PublicKey) Build() PublicKey {
|
||||
return *pk
|
||||
}
|
||||
|
||||
// GetID returns the ID in [ld.Node].
|
||||
func (pk *PublicKey) GetID() string {
|
||||
return pk.ID
|
||||
}
|
||||
|
||||
// SetID sets the ID in [ld.Node].
|
||||
func (pk *PublicKey) SetID(id string) *PublicKey {
|
||||
pk.ID = id
|
||||
return pk
|
||||
}
|
||||
|
||||
// GetType returns the first type on the [ld.Node].
|
||||
func (pk *PublicKey) GetType() string {
|
||||
return pk.Type[0]
|
||||
}
|
||||
|
||||
// SetType sets the type on the [ld.Node].
|
||||
func (pk *PublicKey) SetType(id string) *PublicKey {
|
||||
pk.Type = []string{id}
|
||||
return pk
|
||||
}
|
||||
|
||||
// GetOwner returns the ID in [secv1.Owner].
|
||||
func (pk *PublicKey) GetOwner() string {
|
||||
if nodes := (*ld.Node)(pk).GetNodes(secv1.Owner); len(nodes) == 1 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetOwner sets the ID in [secv1.Owner].
|
||||
func (pk *PublicKey) SetOwner(id string) *PublicKey {
|
||||
(*ld.Node)(pk).SetNodes(secv1.Owner, ld.Node{ID: id})
|
||||
return pk
|
||||
}
|
||||
|
||||
// GetPublicKeyPEM returns the value in [secv1.PublicKeyPem].
|
||||
func (pk *PublicKey) GetPublicKeyPEM() json.RawMessage {
|
||||
if nodes := (*ld.Node)(pk).GetNodes(secv1.PublicKeyPem); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPublicKeyPEM sets the value in [secv1.PublicKeyPem].
|
||||
func (pk *PublicKey) SetPublicKeyPEM(v json.RawMessage) *PublicKey {
|
||||
(*ld.Node)(pk).SetNodes(secv1.PublicKeyPem, ld.Node{Value: v})
|
||||
return pk
|
||||
}
|
||||
207
vendor/sourcery.dny.nu/pana/question.go
vendored
Normal file
207
vendor/sourcery.dny.nu/pana/question.go
vendored
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"iter"
|
||||
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
"sourcery.dny.nu/pana/vocab/mastodon"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Question is the ActivityStreams Question object.
|
||||
type Question IntransitiveActivity
|
||||
|
||||
// NewQuestion initialises a new Question.
|
||||
func NewQuestion() *Question {
|
||||
return &Question{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeQuestion},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Question.
|
||||
//
|
||||
// This returns [Any] since that's what [Activity.SetObject] expects.
|
||||
func (q *Question) Build() Any {
|
||||
return Any(*q)
|
||||
}
|
||||
|
||||
// IsMultipleChoice checks if this is a multiple-choice question.
|
||||
func (q *Question) IsMultipleChoice() bool {
|
||||
if q == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return Has((*Any)(q), as.AnyOf)
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (q *Question) GetType() string {
|
||||
return (*Object)(q).GetType()
|
||||
}
|
||||
|
||||
// SetType sets the type to [as.TypeQuestion].
|
||||
func (q *Question) SetType() {
|
||||
q.Type = []string{as.TypeQuestion}
|
||||
}
|
||||
|
||||
// GetVotersCount returns the value in [mastodon.VotersCount].
|
||||
//
|
||||
// See https://docs.joinmastodon.org/spec/activitypub/#toot.
|
||||
func (q *Question) GetVotersCount() json.RawMessage {
|
||||
if nodes := (*ld.Node)(q).GetNodes(mastodon.VotersCount); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetVotersCount sets the value in [mastodon.VotersCount].
|
||||
func (q *Question) SetVotersCount(v json.RawMessage) *Question {
|
||||
(*ld.Node)(q).SetNodes(mastodon.VotersCount, ld.Node{Value: v})
|
||||
return q
|
||||
}
|
||||
|
||||
// GetEndTime returns the value in [as.EndTime].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-endtime.
|
||||
func (q *Question) GetEndTime() json.RawMessage {
|
||||
if nodes := (*ld.Node)(q).GetNodes(as.EndTime); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetEndTime sets the value in [as.EndTime].
|
||||
func (q *Question) SetEndTime(v json.RawMessage) *Question {
|
||||
(*ld.Node)(q).SetNodes(as.EndTime, ld.Node{Value: v})
|
||||
return q
|
||||
}
|
||||
|
||||
// See [Object.GetSensitive].
|
||||
func (q *Question) GetSensitive() json.RawMessage {
|
||||
return (*Object)(q).GetSensitive()
|
||||
}
|
||||
|
||||
// See [Object.SetSensitive].
|
||||
func (q *Question) SetSensitive(v json.RawMessage) *Question {
|
||||
(*Object)(q).SetSensitive(v)
|
||||
return q
|
||||
}
|
||||
|
||||
// See [Object.GetUpdated].
|
||||
func (q *Question) GetUpdated() json.RawMessage {
|
||||
return (*Object)(q).GetUpdated()
|
||||
}
|
||||
|
||||
// See [Object.SetUpdated].
|
||||
func (q *Question) SetUpdated(v json.RawMessage) *Question {
|
||||
(*Object)(q).SetUpdated(v)
|
||||
return q
|
||||
}
|
||||
|
||||
// GetAnyOf gets the [Choice] in [as.AnyOf].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-oneof.
|
||||
func (q *Question) GetAnyOf() iter.Seq[Choice] {
|
||||
return func(yield func(Choice) bool) {
|
||||
for _, n := range (*ld.Node)(q).GetNodes(as.AnyOf) {
|
||||
if !yield(Choice(n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddAnyOf appends [Choice] to [as.AnyOf].
|
||||
func (q *Question) AddAnyOf(chs ...Choice) *Question {
|
||||
(*ld.Node)(q).AddNodes(as.AnyOf, toLDNodes(chs...)...)
|
||||
return q
|
||||
}
|
||||
|
||||
// GetOneOf gets the [Choice] in [as.OneOf].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-oneof.
|
||||
func (q *Question) GetOneOf() iter.Seq[Choice] {
|
||||
return func(yield func(Choice) bool) {
|
||||
for _, n := range (*ld.Node)(q).GetNodes(as.OneOf) {
|
||||
if !yield(Choice(n)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddOneOf appends [Choice] to [as.OneOf].
|
||||
func (q *Question) AddOneOf(chs ...Choice) *Question {
|
||||
(*ld.Node)(q).AddNodes(as.OneOf, toLDNodes(chs...)...)
|
||||
return q
|
||||
}
|
||||
|
||||
// GetClosed returns the value in [as.Closed].
|
||||
//
|
||||
// See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-closed.
|
||||
func (q *Question) GetClosed() json.RawMessage {
|
||||
if nodes := (*ld.Node)(q).GetNodes(as.Closed); len(nodes) == 1 {
|
||||
return nodes[0].Value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetClosed sets the value in [as.Closed].
|
||||
func (q *Question) SetClosed(v json.RawMessage) *Question {
|
||||
(*ld.Node)(q).SetNodes(as.Closed, ld.Node{Value: v})
|
||||
return q
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (q *Question) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(q).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (q *Question) AddName(ls ...Localised) *Question {
|
||||
(*Object)(q).AddName(ls...)
|
||||
return q
|
||||
}
|
||||
|
||||
// Choice represents a choice in a poll. It is a much more limited [Note].
|
||||
type Choice Note
|
||||
|
||||
// NewChoice initialises a new Choice.
|
||||
func NewChoice() *Choice {
|
||||
return &Choice{
|
||||
Properties: make(ld.Properties),
|
||||
Type: []string{as.TypeNote},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Choice.
|
||||
func (c *Choice) Build() Choice {
|
||||
return *c
|
||||
}
|
||||
|
||||
// See [Object.GetName].
|
||||
func (c *Choice) GetName() iter.Seq[*Localised] {
|
||||
return (*Object)(c).GetName()
|
||||
}
|
||||
|
||||
// See [Object.AddName].
|
||||
func (c *Choice) AddName(ls ...Localised) *Choice {
|
||||
(*Object)(c).AddName(ls...)
|
||||
return c
|
||||
}
|
||||
|
||||
// See [Object.GetReplies].
|
||||
func (c *Choice) GetReplies() *Collection {
|
||||
return (*Object)(c).GetReplies()
|
||||
}
|
||||
|
||||
// See [Object.SetReplies].
|
||||
func (c *Choice) SetReplies(cl Collection) *Choice {
|
||||
(*Object)(c).SetReplies(cl)
|
||||
return c
|
||||
}
|
||||
18
vendor/sourcery.dny.nu/pana/relationship.go
vendored
Normal file
18
vendor/sourcery.dny.nu/pana/relationship.go
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package pana
|
||||
|
||||
import ld "sourcery.dny.nu/longdistance"
|
||||
|
||||
// Relationship is the ActivityStreams Relationship type.
|
||||
type Relationship Object
|
||||
|
||||
// NewRelationship initialises a new Relationship.
|
||||
func NewRelationship() *Relationship {
|
||||
return &Relationship{
|
||||
Properties: make(ld.Properties),
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Relationship.
|
||||
func (r *Relationship) Build() Relationship {
|
||||
return *r
|
||||
}
|
||||
59
vendor/sourcery.dny.nu/pana/tombstone.go
vendored
Normal file
59
vendor/sourcery.dny.nu/pana/tombstone.go
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
ld "sourcery.dny.nu/longdistance"
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Tombstone is the ActivityStreams Tombstone type.
|
||||
type Tombstone Object
|
||||
|
||||
// NewTombstone initialises a new Tombstone.
|
||||
func NewTombstone() *Tombstone {
|
||||
return &Tombstone{
|
||||
Properties: make(ld.Properties, 1),
|
||||
Type: []string{as.TypeTombstone},
|
||||
}
|
||||
}
|
||||
|
||||
// Build finalises the Tombstone.
|
||||
func (t *Tombstone) Build() Tombstone {
|
||||
return *t
|
||||
}
|
||||
|
||||
// See [Object.GetID].
|
||||
func (t *Tombstone) GetID() string {
|
||||
return (*Object)(t).GetID()
|
||||
}
|
||||
|
||||
// See [Object.SetID].
|
||||
func (t *Tombstone) SetID(id string) *Tombstone {
|
||||
(*Object)(t).SetID(id)
|
||||
return t
|
||||
}
|
||||
|
||||
// See [Object.GetType].
|
||||
func (t *Tombstone) GetType() string {
|
||||
return (*Object)(t).GetType()
|
||||
}
|
||||
|
||||
// See [Object.SetType].
|
||||
func (t *Tombstone) SetType(id string) *Tombstone {
|
||||
(*Object)(t).SetType(id)
|
||||
return t
|
||||
}
|
||||
|
||||
// Returns the type in [as.FormerType].
|
||||
func (t *Tombstone) GetFormerType() string {
|
||||
if nodes := (*ld.Node)(t).GetNodes(as.FormerType); len(nodes) != 0 {
|
||||
return nodes[0].ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Sets the type in [as.FormerType].
|
||||
func (t *Tombstone) SetFormerType(id string) *Tombstone {
|
||||
(*ld.Node)(t).SetNodes(as.FormerType, ld.Node{ID: id})
|
||||
return t
|
||||
}
|
||||
15
vendor/sourcery.dny.nu/pana/video.go
vendored
Normal file
15
vendor/sourcery.dny.nu/pana/video.go
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package pana
|
||||
|
||||
import (
|
||||
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
|
||||
)
|
||||
|
||||
// Video is the ActivityStreams Video type.
|
||||
//
|
||||
// It is the same as [Audio].
|
||||
type Video = Audio
|
||||
|
||||
// NewVideo initialises a new Video.
|
||||
func NewVideo() *Video {
|
||||
return (*Video)(NewAudio().SetType(as.TypeVideo))
|
||||
}
|
||||
46
vendor/sourcery.dny.nu/pana/vocab/geojson/context.go
vendored
Normal file
46
vendor/sourcery.dny.nu/pana/vocab/geojson/context.go
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package geojson
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://geojson.org/geojson-ld/geojson-context.jsonld"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this context that don't
|
||||
// map to a different namespace.
|
||||
const Namespace = "https://purl.org/geojson/vocab#"
|
||||
|
||||
const (
|
||||
// Bbox is a string.
|
||||
Bbox = Namespace + "bbox"
|
||||
// Coordinates is a string.
|
||||
Coordinates = Namespace + "coordinates"
|
||||
// Features is a string.
|
||||
Features = Namespace + "features"
|
||||
// Geometry is a string.
|
||||
Geometry = Namespace + "geometry"
|
||||
// Properties is a string.
|
||||
Properties = Namespace + "properties"
|
||||
// TypeFeature is a possible value for the type property.
|
||||
TypeFeature = Namespace + "Feature"
|
||||
// TypeFeatureCollection is a possible value for the type property.
|
||||
TypeFeatureCollection = Namespace + "FeatureCollection"
|
||||
// TypeGeometryCollection is a possible value for the type property.
|
||||
TypeGeometryCollection = Namespace + "GeometryCollection"
|
||||
// TypeLineString is a possible value for the type property.
|
||||
TypeLineString = Namespace + "LineString"
|
||||
// TypeMultiLineString is a possible value for the type property.
|
||||
TypeMultiLineString = Namespace + "MultiLineString"
|
||||
// TypeMultiPoint is a possible value for the type property.
|
||||
TypeMultiPoint = Namespace + "MultiPoint"
|
||||
// TypeMultiPolygon is a possible value for the type property.
|
||||
TypeMultiPolygon = Namespace + "MultiPolygon"
|
||||
// TypePoint is a possible value for the type property.
|
||||
TypePoint = Namespace + "Point"
|
||||
// TypePolygon is a possible value for the type property.
|
||||
TypePolygon = Namespace + "Polygon"
|
||||
)
|
||||
34
vendor/sourcery.dny.nu/pana/vocab/geojson/context.jsonld
vendored
Normal file
34
vendor/sourcery.dny.nu/pana/vocab/geojson/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"@context": {
|
||||
"@version": 1.1,
|
||||
"geojson": "https://purl.org/geojson/vocab#",
|
||||
"Feature": "geojson:Feature",
|
||||
"FeatureCollection": "geojson:FeatureCollection",
|
||||
"GeometryCollection": "geojson:GeometryCollection",
|
||||
"LineString": "geojson:LineString",
|
||||
"MultiLineString": "geojson:MultiLineString",
|
||||
"MultiPoint": "geojson:MultiPoint",
|
||||
"MultiPolygon": "geojson:MultiPolygon",
|
||||
"Point": "geojson:Point",
|
||||
"Polygon": "geojson:Polygon",
|
||||
"bbox": {
|
||||
"@container": "@list",
|
||||
"@id": "geojson:bbox"
|
||||
},
|
||||
"coordinates": {
|
||||
"@container": "@list",
|
||||
"@id": "geojson:coordinates"
|
||||
},
|
||||
"features": {
|
||||
"@container": "@set",
|
||||
"@id": "geojson:features"
|
||||
},
|
||||
"geometry": "geojson:geometry",
|
||||
"id": "@id",
|
||||
"properties": "geojson:properties",
|
||||
"type": "@type",
|
||||
"description": "http://purl.org/dc/terms/description",
|
||||
"title": "http://purl.org/dc/terms/title"
|
||||
}
|
||||
}
|
||||
|
||||
45
vendor/sourcery.dny.nu/pana/vocab/gotosocial/context.go
vendored
Normal file
45
vendor/sourcery.dny.nu/pana/vocab/gotosocial/context.go
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// Package gotosocial contains terms for the GoToSocial namespace.
|
||||
package gotosocial
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://gotosocial.org/ns"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = IRI + "#"
|
||||
|
||||
const (
|
||||
// Always is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Always = Namespace + "always"
|
||||
// ApprovalRequired is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
ApprovalRequired = Namespace + "approvalRequired"
|
||||
// ApprovedBy is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
ApprovedBy = Namespace + "approvedBy"
|
||||
// CanAnnounce is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
CanAnnounce = Namespace + "canAnnounce"
|
||||
// CanLike is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
CanLike = Namespace + "canLike"
|
||||
// CanReply is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
CanReply = Namespace + "canReply"
|
||||
// InteractionPolicy is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
InteractionPolicy = Namespace + "interactionPolicy"
|
||||
// TypeAnnounceApproval is a possible value for the type property.
|
||||
TypeAnnounceApproval = Namespace + "AnnounceApproval"
|
||||
// TypeLikeApproval is a possible value for the type property.
|
||||
TypeLikeApproval = Namespace + "LikeApproval"
|
||||
// TypeReplyApproval is a possible value for the type property.
|
||||
TypeReplyApproval = Namespace + "ReplyApproval"
|
||||
)
|
||||
36
vendor/sourcery.dny.nu/pana/vocab/gotosocial/context.jsonld
vendored
Normal file
36
vendor/sourcery.dny.nu/pana/vocab/gotosocial/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"@context": {
|
||||
"gts": "https://gotosocial.org/ns#",
|
||||
"LikeApproval": "gts:LikeApproval",
|
||||
"ReplyApproval": "gts:ReplyApproval",
|
||||
"AnnounceApproval": "gts:AnnounceApproval",
|
||||
"interactionPolicy": {
|
||||
"@id": "gts:interactionPolicy",
|
||||
"@type": "@id"
|
||||
},
|
||||
"canLike": {
|
||||
"@id": "gts:canLike",
|
||||
"@type": "@id"
|
||||
},
|
||||
"canReply": {
|
||||
"@id": "gts:canReply",
|
||||
"@type": "@id"
|
||||
},
|
||||
"canAnnounce": {
|
||||
"@id": "gts:canAnnounce",
|
||||
"@type": "@id"
|
||||
},
|
||||
"always": {
|
||||
"@id": "gts:always",
|
||||
"@type": "@id"
|
||||
},
|
||||
"approvalRequired": {
|
||||
"@id": "gts:approvalRequired",
|
||||
"@type": "@id"
|
||||
},
|
||||
"approvedBy": {
|
||||
"@id": "gts:approvedBy",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
}
|
||||
29
vendor/sourcery.dny.nu/pana/vocab/litepub/context.go
vendored
Normal file
29
vendor/sourcery.dny.nu/pana/vocab/litepub/context.go
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Package litepub contains terms for the Litepub namespace.
|
||||
package litepub
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
//go:embed litepub-0.1.jsonld
|
||||
var ContextDocument1dot0 []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://litepub.social/litepub/context.jsonld"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "http://litepub.social/ns#"
|
||||
|
||||
const (
|
||||
Capabilities = Namespace + "capabilities"
|
||||
DirectMessage = Namespace + "directMessage"
|
||||
FormerRepresentations = Namespace + "formerRepresentations"
|
||||
Invisible = Namespace + "invisible"
|
||||
ListMessage = Namespace + "listMessage"
|
||||
OauthRegistrationEndpoint = Namespace + "oauthRegistrationEndpoint"
|
||||
TypeChatMessage = Namespace + "ChatMessage"
|
||||
TypeEmojiReact = Namespace + "EmojiReact"
|
||||
)
|
||||
23
vendor/sourcery.dny.nu/pana/vocab/litepub/context.jsonld
vendored
Normal file
23
vendor/sourcery.dny.nu/pana/vocab/litepub/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"Emoji": "toot:Emoji",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"conversation": {
|
||||
"@id": "ostatus:conversation",
|
||||
"@type": "@id"
|
||||
},
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"schema": "http://schema.org/",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"totalItems": "as:totalItems",
|
||||
"value": "schema:value",
|
||||
"sensitive": "as:sensitive"
|
||||
}
|
||||
]
|
||||
}
|
||||
51
vendor/sourcery.dny.nu/pana/vocab/litepub/litepub-0.1.jsonld
vendored
Normal file
51
vendor/sourcery.dny.nu/pana/vocab/litepub/litepub-0.1.jsonld
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"ChatMessage": "litepub:ChatMessage",
|
||||
"Emoji": "toot:Emoji",
|
||||
"EmojiReact": "litepub:EmojiReact",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"alsoKnownAs": {
|
||||
"@id": "as:alsoKnownAs",
|
||||
"@type": "@id"
|
||||
},
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"capabilities": "litepub:capabilities",
|
||||
"contentMap": {
|
||||
"@container": "@language",
|
||||
"@id": "as:content"
|
||||
},
|
||||
"conversation": {
|
||||
"@id": "ostatus:conversation",
|
||||
"@type": "@id"
|
||||
},
|
||||
"directMessage": "litepub:directMessage",
|
||||
"discoverable": "toot:discoverable",
|
||||
"fedibird": "http://fedibird.com/ns#",
|
||||
"formerRepresentations": "litepub:formerRepresentations",
|
||||
"invisible": "litepub:invisible",
|
||||
"listMessage": {
|
||||
"@id": "litepub:listMessage",
|
||||
"@type": "@id"
|
||||
},
|
||||
"litepub": "http://litepub.social/ns#",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"misskey": "https://misskey-hub.net/ns#",
|
||||
"oauthRegistrationEndpoint": {
|
||||
"@id": "litepub:oauthRegistrationEndpoint",
|
||||
"@type": "@id"
|
||||
},
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"quoteUri": "fedibird:quoteUri",
|
||||
"quoteUrl": "as:quoteUrl",
|
||||
"schema": "http://schema.org#",
|
||||
"sensitive": "as:sensitive",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"value": "schema:value",
|
||||
"vcard": "http://www.w3.org/2006/vcard/ns#"
|
||||
}
|
||||
]
|
||||
}
|
||||
20
vendor/sourcery.dny.nu/pana/vocab/mastodon/context.go
vendored
Normal file
20
vendor/sourcery.dny.nu/pana/vocab/mastodon/context.go
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Package mastodon contains terms for the toot namespace.
|
||||
package mastodon
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "http://joinmastodon.org/ns#"
|
||||
|
||||
const (
|
||||
AttributionDomains = Namespace + "attributionDomains"
|
||||
Blurhash = Namespace + "blurhash"
|
||||
Discoverable = Namespace + "discoverable"
|
||||
Featured = Namespace + "featured"
|
||||
FeaturedTags = Namespace + "featuredTags"
|
||||
FocalPoint = Namespace + "focalPoint"
|
||||
Indexable = Namespace + "indexable"
|
||||
Memorial = Namespace + "memorial"
|
||||
Suspended = Namespace + "suspended"
|
||||
VotersCount = Namespace + "votersCount"
|
||||
TypeEmoji = Namespace + "Emoji"
|
||||
TypeIdentityProof = Namespace + "IdentityProof"
|
||||
)
|
||||
11
vendor/sourcery.dny.nu/pana/vocab/ostatus/context.go
vendored
Normal file
11
vendor/sourcery.dny.nu/pana/vocab/ostatus/context.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Package ostatus contains terms for the Ostatus.org namespace.
|
||||
package ostatus
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "http://ostatus.org#"
|
||||
|
||||
const (
|
||||
AtomURI = Namespace + "atomUri"
|
||||
Conversation = Namespace + "conversation"
|
||||
InReplyToAtomURI = Namespace + "inReplyToAtomUri"
|
||||
)
|
||||
29
vendor/sourcery.dny.nu/pana/vocab/schema/context.go
vendored
Normal file
29
vendor/sourcery.dny.nu/pana/vocab/schema/context.go
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Package schema contains terms for the Schema.org namespace.
|
||||
package schema
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "http://schema.org/"
|
||||
|
||||
const (
|
||||
About = Namespace + "about"
|
||||
Address = Namespace + "address"
|
||||
AddressCountry = Namespace + "addressCountry"
|
||||
AddressLocality = Namespace + "addressLocality"
|
||||
AddressRegion = Namespace + "addressRegion"
|
||||
Description = Namespace + "description"
|
||||
Email = Namespace + "email"
|
||||
FamilyName = Namespace + "familyName"
|
||||
GivenNaame = Namespace + "givenName"
|
||||
Image = Namespace + "image"
|
||||
Member = Namespace + "member"
|
||||
MemberOf = Namespace + "memberOf"
|
||||
Name = Namespace + "name"
|
||||
PostalCode = Namespace + "postalCode"
|
||||
StreetAddress = Namespace + "streetAddress"
|
||||
TypePropertyValue = Namespace + "PropertyValue"
|
||||
TypeOrganization = Namespace + "Organization"
|
||||
TypePerson = Namespace + "Person"
|
||||
TypePostalAddress = Namespace + "PostalAddress"
|
||||
URL = Namespace + "url"
|
||||
Value = Namespace + "value"
|
||||
)
|
||||
365
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/context.go
vendored
Normal file
365
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/context.go
vendored
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
// Package activitystreams contains terms for the ActivityStreams namespace.
|
||||
//
|
||||
// It also includes extensions.
|
||||
package activitystreams
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://www.w3.org/ns/activitystreams"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = IRI + "#"
|
||||
|
||||
// From the normative context definition.
|
||||
const (
|
||||
// Accuracy is an xml:float, an IEEE single-precision 32-bit floating point
|
||||
// value equivalent to a Go float32.
|
||||
Accuracy = Namespace + "accuracy"
|
||||
// Actor is an IRI, either as a string or as an object with an id property.
|
||||
Actor = Namespace + "actor"
|
||||
// AlsoKnownAs is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
AlsoKnownAs = Namespace + "alsoKnownAs"
|
||||
// Altitude is an xml:float, an IEEE single-precision 32-bit floating point
|
||||
// value equivalent to a Go float32.
|
||||
Altitude = Namespace + "altitude"
|
||||
// AnyOf is an IRI, either as a string or as an object with an id property.
|
||||
AnyOf = Namespace + "anyOf"
|
||||
// Attachment is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Attachment = Namespace + "attachment"
|
||||
// AttributedTo is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
AttributedTo = Namespace + "attributedTo"
|
||||
// Audience is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Audience = Namespace + "audience"
|
||||
// Bcc is an IRI, either as a string or as an object with an id property.
|
||||
Bcc = Namespace + "bcc"
|
||||
// Bto is an IRI, either as a string or as an object with an id property.
|
||||
Bto = Namespace + "bto"
|
||||
// Cc is an IRI, either as a string or as an object with an id property.
|
||||
Cc = Namespace + "cc"
|
||||
// Closed is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Closed = Namespace + "closed"
|
||||
// Content is a string.
|
||||
Content = Namespace + "content"
|
||||
// Context is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Context = Namespace + "context"
|
||||
// Current is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Current = Namespace + "current"
|
||||
// Deleted is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Deleted = Namespace + "deleted"
|
||||
// Describes is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Describes = Namespace + "describes"
|
||||
// Duration is an xml:duration and does not have a Go equivalent, but can be
|
||||
// handled as a string.
|
||||
Duration = Namespace + "duration"
|
||||
// EndTime is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
EndTime = Namespace + "endTime"
|
||||
// Endpoints is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Endpoints = Namespace + "endpoints"
|
||||
// First is an IRI, either as a string or as an object with an id property.
|
||||
First = Namespace + "first"
|
||||
// Followers is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Followers = Namespace + "followers"
|
||||
// Following is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Following = Namespace + "following"
|
||||
// FormerType is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
FormerType = Namespace + "formerType"
|
||||
// Generator is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Generator = Namespace + "generator"
|
||||
// Height is an xml:nonNegativeInteger, an "infinite size" integer. The XML
|
||||
// specification requires you to at least accept numbers with up to 16
|
||||
// digits. A Go uint64 may be sufficient depending on your usage. Remember
|
||||
// that you can only safely express up to 53-bit precision integers this way
|
||||
// since JSON treats integers as floats. For bigger values you'll need a
|
||||
// string.
|
||||
Height = Namespace + "height"
|
||||
// Href is an IRI, either as a string or as an object with an id property.
|
||||
Href = Namespace + "href"
|
||||
// Hreflang is a string.
|
||||
Hreflang = Namespace + "hreflang"
|
||||
// Icon is an IRI, either as a string or as an object with an id property.
|
||||
Icon = Namespace + "icon"
|
||||
// Image is an IRI, either as a string or as an object with an id property.
|
||||
Image = Namespace + "image"
|
||||
// InReplyTo is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
InReplyTo = Namespace + "inReplyTo"
|
||||
// Instrument is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Instrument = Namespace + "instrument"
|
||||
// Items is an IRI, either as a string or as an object with an id property.
|
||||
Items = Namespace + "items"
|
||||
// Last is an IRI, either as a string or as an object with an id property.
|
||||
Last = Namespace + "last"
|
||||
// Latitude is an xml:float, an IEEE single-precision 32-bit floating point
|
||||
// value equivalent to a Go float32.
|
||||
Latitude = Namespace + "latitude"
|
||||
// Liked is an IRI, either as a string or as an object with an id property.
|
||||
Liked = Namespace + "liked"
|
||||
// Likes is an IRI, either as a string or as an object with an id property.
|
||||
Likes = Namespace + "likes"
|
||||
// Location is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Location = Namespace + "location"
|
||||
// Longitude is an xml:float, an IEEE single-precision 32-bit floating point
|
||||
// value equivalent to a Go float32.
|
||||
Longitude = Namespace + "longitude"
|
||||
// MediaType is a string.
|
||||
MediaType = Namespace + "mediaType"
|
||||
// Name is a string.
|
||||
Name = Namespace + "name"
|
||||
// Next is an IRI, either as a string or as an object with an id property.
|
||||
Next = Namespace + "next"
|
||||
// OauthAuthzEndpoint is an IRI, either as a string or as an object
|
||||
// with an id property.
|
||||
OauthAuthzEndpoint = Namespace + "oauthAuthorizationEndpoint"
|
||||
// OauthTokenEndpoint is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
OauthTokenEndpoint = Namespace + "oauthTokenEndpoint"
|
||||
// Object is an IRI, either as a string or as an object with an id property.
|
||||
Object = Namespace + "object"
|
||||
// OneOf is an IRI, either as a string or as an object with an id property.
|
||||
OneOf = Namespace + "oneOf"
|
||||
// OrderedItems is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
OrderedItems = Namespace + "items"
|
||||
// Origin is an IRI, either as a string or as an object with an id property.
|
||||
Origin = Namespace + "origin"
|
||||
// Outbox is an IRI, either as a string or as an object with an id property.
|
||||
Outbox = Namespace + "outbox"
|
||||
// PartOf is an IRI, either as a string or as an object with an id property.
|
||||
PartOf = Namespace + "partOf"
|
||||
// PreferredUsername is a string.
|
||||
PreferredUsername = Namespace + "preferredUsername"
|
||||
// Prev is an IRI, either as a string or as an object with an id property.
|
||||
Prev = Namespace + "prev"
|
||||
// Preview is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Preview = Namespace + "preview"
|
||||
// ProvideClientKey is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
ProvideClientKey = Namespace + "provideClientKey"
|
||||
// ProxyURL is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
ProxyURL = Namespace + "proxyUrl"
|
||||
// PublicCollection represents the Public collection, aka everyone. Use it
|
||||
// as a value in the [Audience], [To] and [Cc] poperties.
|
||||
PublicCollection = Namespace + "Public"
|
||||
// Published is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Published = Namespace + "published"
|
||||
// Radius is an xml:float, an IEEE single-precision 32-bit floating point
|
||||
// value equivalent to a Go float32.
|
||||
Radius = Namespace + "radius"
|
||||
// Rel is a string.
|
||||
Rel = Namespace + "rel"
|
||||
// Relationship is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Relationship = Namespace + "relationship"
|
||||
// RelationshipIsContact is a possible value for a relationship property.
|
||||
RelationshipIsContact = Namespace + "IsContact"
|
||||
// RelationshipIsFollowedBy is a possible value for a relationship property.
|
||||
RelationshipIsFollowedBy = Namespace + "IsFollowedBy"
|
||||
// RelationshipIsFollowing is a possible value for a relationship property.
|
||||
RelationshipIsFollowing = Namespace + "IsFollowing"
|
||||
// RelationshipIsMember is a possible value for a relationship property.
|
||||
RelationshipIsMember = Namespace + "IsMember"
|
||||
// Replies is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Replies = Namespace + "replies"
|
||||
// Result is an IRI, either as a string or as an object with an id property.
|
||||
Result = Namespace + "result"
|
||||
// SharedInbox is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
SharedInbox = Namespace + "sharedInbox"
|
||||
// Shares is an IRI, either as a string or as an object with an id property.
|
||||
Shares = Namespace + "shares"
|
||||
// SignClientKey is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
SignClientKey = Namespace + "signClientKey"
|
||||
// Source is a string.
|
||||
Source = Namespace + "source"
|
||||
// StartIndex is an xml:nonNegativeInteger, an "infinite size" integer. The
|
||||
// XML specification requires you to at least accept numbers with up to 16
|
||||
// digits. A Go uint64 may be sufficient depending on your usage. Remember
|
||||
// that you can only safely express up to 53-bit precision integers this way
|
||||
// since JSON treats integers as floats. For bigger values you'll need a
|
||||
// string.
|
||||
StartIndex = Namespace + "startIndex"
|
||||
// StartTime is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
StartTime = Namespace + "startTime"
|
||||
// Streams is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Streams = Namespace + "streams"
|
||||
// Subject is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
Subject = Namespace + "subject"
|
||||
// Summary is a string.
|
||||
Summary = Namespace + "summary"
|
||||
// Tag is an IRI, either as a string or as an object with an id property.
|
||||
Tag = Namespace + "tag"
|
||||
// Target is an IRI, either as a string or as an object with an id property.
|
||||
Target = Namespace + "target"
|
||||
// To is an IRI, either as a string or as an object with an id property.
|
||||
To = Namespace + "to"
|
||||
// TotalItems is an xml:nonNegativeInteger, an "infinite size" integer. The
|
||||
// XML specification requires you to at least accept numbers with up to 16
|
||||
// digits. A Go uint64 may be sufficient depending on your usage. Remember
|
||||
// that you can only safely express up to 53-bit precision integers this way
|
||||
// since JSON treats integers as floats. For bigger values you'll need a
|
||||
// string.
|
||||
TotalItems = Namespace + "totalItems"
|
||||
// TypeAccept is a possible value for the type property.
|
||||
TypeAccept = Namespace + "Accept"
|
||||
// TypeActivity is a possible value for the type property.
|
||||
TypeActivity = Namespace + "Activity"
|
||||
// TypeAdd is a possible value for the type property.
|
||||
TypeAdd = Namespace + "Add"
|
||||
// TypeAnnounce is a possible value for the type property.
|
||||
TypeAnnounce = Namespace + "Announce"
|
||||
// TypeApplication is a possible value for the type property.
|
||||
TypeApplication = Namespace + "Application"
|
||||
// TypeArrive is a possible value for the type property.
|
||||
TypeArrive = Namespace + "Arrive"
|
||||
// TypeArticle is a possible value for the type property.
|
||||
TypeArticle = Namespace + "Article"
|
||||
// TypeAudio is a possible value for the type property.
|
||||
TypeAudio = Namespace + "Audio"
|
||||
// TypeBlock is a possible value for the type property.
|
||||
TypeBlock = Namespace + "Block"
|
||||
// TypeCollection is a possible value for the type property.
|
||||
TypeCollection = Namespace + "Collection"
|
||||
// TypeCollectionPage is a possible value for the type property.
|
||||
TypeCollectionPage = Namespace + "CollectionPage"
|
||||
// TypeCreate is a possible value for the type property.
|
||||
TypeCreate = Namespace + "Create"
|
||||
// TypeDelete is a possible value for the type property.
|
||||
TypeDelete = Namespace + "Delete"
|
||||
// TypeDislike is a possible value for the type property.
|
||||
TypeDislike = Namespace + "Dislike"
|
||||
// TypeDocument is a possible value for the type property.
|
||||
TypeDocument = Namespace + "Document"
|
||||
// TypeEvent is a possible value for the type property.
|
||||
TypeEvent = Namespace + "Event"
|
||||
// TypeFlag is a possible value for the type property.
|
||||
TypeFlag = Namespace + "Flag"
|
||||
// TypeFollow is a possible value for the type property.
|
||||
TypeFollow = Namespace + "Follow"
|
||||
// TypeGroup is a possible value for the type property.
|
||||
TypeGroup = Namespace + "Group"
|
||||
// TypeIgnore is a possible value for the type property.
|
||||
TypeIgnore = Namespace + "Ignore"
|
||||
// TypeImage is a possible value for the type property.
|
||||
TypeImage = Namespace + "Image"
|
||||
// TypeIntransitiveActivity is a possible value for the type property.
|
||||
TypeIntransitiveActivity = Namespace + "IntransitiveActivity"
|
||||
// TypeInvite is a possible value for the type property.
|
||||
TypeInvite = Namespace + "Invite"
|
||||
// TypeJoin is a possible value for the type property.
|
||||
TypeJoin = Namespace + "Join"
|
||||
// TypeLeave is a possible value for the type property.
|
||||
TypeLeave = Namespace + "Leave"
|
||||
// TypeLike is a possible value for the type property.
|
||||
TypeLike = Namespace + "Like"
|
||||
// TypeLink is a possible value for the type property.
|
||||
TypeLink = Namespace + "Link"
|
||||
// TypeListen is a possible value for the type property.
|
||||
TypeListen = Namespace + "Listen"
|
||||
// TypeMention is a possible value for the type property.
|
||||
TypeMention = Namespace + "Mention"
|
||||
// TypeMove is a possible value for the type property.
|
||||
TypeMove = Namespace + "Move"
|
||||
// TypeNote is a possible value for the type property.
|
||||
TypeNote = Namespace + "Note"
|
||||
// TypeObject is a possible value for the type property.
|
||||
TypeObject = Namespace + "Object"
|
||||
// TypeOffer is a possible value for the type property.
|
||||
TypeOffer = Namespace + "Offer"
|
||||
// TypeOrderedCollection is a possible value for the type property.
|
||||
TypeOrderedCollection = Namespace + "OrderedCollection"
|
||||
// TypeOrderedCollectionPage is a possible value for the type property.
|
||||
TypeOrderedCollectionPage = Namespace + "OrderedCollectionPage"
|
||||
// TypeOrganization is a possible value for the type property.
|
||||
TypeOrganization = Namespace + "Organization"
|
||||
// TypePage is a possible value for the type property.
|
||||
TypePage = Namespace + "Page"
|
||||
// TypePerson is a possible value for the type property.
|
||||
TypePerson = Namespace + "Person"
|
||||
// TypePlace is a possible value for the type property.
|
||||
TypePlace = Namespace + "Place"
|
||||
// TypeProfile is a possible value for the type property.
|
||||
TypeProfile = Namespace + "Profile"
|
||||
// TypeQuestion is a possible value for the type property.
|
||||
TypeQuestion = Namespace + "Question"
|
||||
// TypeRead is a possible value for the type property.
|
||||
TypeRead = Namespace + "Read"
|
||||
// TypeReject is a possible value for the type property.
|
||||
TypeReject = Namespace + "Reject"
|
||||
// TypeRelationship is a possible value for the type property.
|
||||
TypeRelationship = Namespace + "Relationship"
|
||||
// TypeRemove is a possible value for the type property.
|
||||
TypeRemove = Namespace + "Remove"
|
||||
// TypeService is a possible value for the type property.
|
||||
TypeService = Namespace + "Service"
|
||||
// TypeTentativeAccept is a possible value for the type property.
|
||||
TypeTentativeAccept = Namespace + "TentativeAccept"
|
||||
// TypeTentativeReject is a possible value for the type property.
|
||||
TypeTentativeReject = Namespace + "TentativeReject"
|
||||
// TypeTombstone is a possible value for the type property.
|
||||
TypeTombstone = Namespace + "Tombstone"
|
||||
// TypeTravel is a possible value for the type property.
|
||||
TypeTravel = Namespace + "Travel"
|
||||
// TypeUndo is a possible value for the type property.
|
||||
TypeUndo = Namespace + "Undo"
|
||||
// TypeUpdate is a possible value for the type property.
|
||||
TypeUpdate = Namespace + "Update"
|
||||
// TypeVideo is a possible value for the type property.
|
||||
TypeVideo = Namespace + "Video"
|
||||
// TypeView is a possible value for the type property.
|
||||
TypeView = Namespace + "View"
|
||||
// URL is an IRI, either as a string or as an object with an id property.
|
||||
URL = Namespace + "url"
|
||||
// Units is a string.
|
||||
Units = Namespace + "units"
|
||||
// Updated is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Updated = Namespace + "updated"
|
||||
// UploadMedia is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
UploadMedia = Namespace + "uploadMedia"
|
||||
// Width is an xml:nonNegativeInteger, an "infinite size" integer. The XML
|
||||
// specification requires you to at least accept numbers with up to 16
|
||||
// digits. A Go uint64 may be sufficient depending on your usage. Remember
|
||||
// that you can only safely express up to 53-bit precision integers this way
|
||||
// since JSON treats integers as floats. For bigger values you'll need a
|
||||
// string.
|
||||
Width = Namespace + "width"
|
||||
)
|
||||
|
||||
// Extensions: https://www.w3.org/wiki/Activity_Streams_extensions.
|
||||
const (
|
||||
// ManuallyApprovesFollowers is an xml:boolean.
|
||||
ManuallyApprovesFollowers = Namespace + "manuallyApprovesFollowers"
|
||||
// MovedTo is an IRI, either as a string or as an object with an id
|
||||
// property.
|
||||
MovedTo = Namespace + "movedTo"
|
||||
// Sensitive is an xml:boolean.
|
||||
Sensitive = Namespace + "sensitive"
|
||||
// TypeHashtag is a possible value for the type property.
|
||||
TypeHashtag = Namespace + "Hashtag"
|
||||
)
|
||||
379
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/context.jsonld
vendored
Normal file
379
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,379 @@
|
|||
{
|
||||
"@context": {
|
||||
"@vocab": "_:",
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||
"as": "https://www.w3.org/ns/activitystreams#",
|
||||
"ldp": "http://www.w3.org/ns/ldp#",
|
||||
"vcard": "http://www.w3.org/2006/vcard/ns#",
|
||||
"id": "@id",
|
||||
"type": "@type",
|
||||
"Accept": "as:Accept",
|
||||
"Activity": "as:Activity",
|
||||
"IntransitiveActivity": "as:IntransitiveActivity",
|
||||
"Add": "as:Add",
|
||||
"Announce": "as:Announce",
|
||||
"Application": "as:Application",
|
||||
"Arrive": "as:Arrive",
|
||||
"Article": "as:Article",
|
||||
"Audio": "as:Audio",
|
||||
"Block": "as:Block",
|
||||
"Collection": "as:Collection",
|
||||
"CollectionPage": "as:CollectionPage",
|
||||
"Relationship": "as:Relationship",
|
||||
"Create": "as:Create",
|
||||
"Delete": "as:Delete",
|
||||
"Dislike": "as:Dislike",
|
||||
"Document": "as:Document",
|
||||
"Event": "as:Event",
|
||||
"Follow": "as:Follow",
|
||||
"Flag": "as:Flag",
|
||||
"Group": "as:Group",
|
||||
"Ignore": "as:Ignore",
|
||||
"Image": "as:Image",
|
||||
"Invite": "as:Invite",
|
||||
"Join": "as:Join",
|
||||
"Leave": "as:Leave",
|
||||
"Like": "as:Like",
|
||||
"Link": "as:Link",
|
||||
"Mention": "as:Mention",
|
||||
"Note": "as:Note",
|
||||
"Object": "as:Object",
|
||||
"Offer": "as:Offer",
|
||||
"OrderedCollection": "as:OrderedCollection",
|
||||
"OrderedCollectionPage": "as:OrderedCollectionPage",
|
||||
"Organization": "as:Organization",
|
||||
"Page": "as:Page",
|
||||
"Person": "as:Person",
|
||||
"Place": "as:Place",
|
||||
"Profile": "as:Profile",
|
||||
"Question": "as:Question",
|
||||
"Reject": "as:Reject",
|
||||
"Remove": "as:Remove",
|
||||
"Service": "as:Service",
|
||||
"TentativeAccept": "as:TentativeAccept",
|
||||
"TentativeReject": "as:TentativeReject",
|
||||
"Tombstone": "as:Tombstone",
|
||||
"Undo": "as:Undo",
|
||||
"Update": "as:Update",
|
||||
"Video": "as:Video",
|
||||
"View": "as:View",
|
||||
"Listen": "as:Listen",
|
||||
"Read": "as:Read",
|
||||
"Move": "as:Move",
|
||||
"Travel": "as:Travel",
|
||||
"IsFollowing": "as:IsFollowing",
|
||||
"IsFollowedBy": "as:IsFollowedBy",
|
||||
"IsContact": "as:IsContact",
|
||||
"IsMember": "as:IsMember",
|
||||
"subject": {
|
||||
"@id": "as:subject",
|
||||
"@type": "@id"
|
||||
},
|
||||
"relationship": {
|
||||
"@id": "as:relationship",
|
||||
"@type": "@id"
|
||||
},
|
||||
"actor": {
|
||||
"@id": "as:actor",
|
||||
"@type": "@id"
|
||||
},
|
||||
"attributedTo": {
|
||||
"@id": "as:attributedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"attachment": {
|
||||
"@id": "as:attachment",
|
||||
"@type": "@id"
|
||||
},
|
||||
"bcc": {
|
||||
"@id": "as:bcc",
|
||||
"@type": "@id"
|
||||
},
|
||||
"bto": {
|
||||
"@id": "as:bto",
|
||||
"@type": "@id"
|
||||
},
|
||||
"cc": {
|
||||
"@id": "as:cc",
|
||||
"@type": "@id"
|
||||
},
|
||||
"context": {
|
||||
"@id": "as:context",
|
||||
"@type": "@id"
|
||||
},
|
||||
"current": {
|
||||
"@id": "as:current",
|
||||
"@type": "@id"
|
||||
},
|
||||
"first": {
|
||||
"@id": "as:first",
|
||||
"@type": "@id"
|
||||
},
|
||||
"generator": {
|
||||
"@id": "as:generator",
|
||||
"@type": "@id"
|
||||
},
|
||||
"icon": {
|
||||
"@id": "as:icon",
|
||||
"@type": "@id"
|
||||
},
|
||||
"image": {
|
||||
"@id": "as:image",
|
||||
"@type": "@id"
|
||||
},
|
||||
"inReplyTo": {
|
||||
"@id": "as:inReplyTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"items": {
|
||||
"@id": "as:items",
|
||||
"@type": "@id"
|
||||
},
|
||||
"instrument": {
|
||||
"@id": "as:instrument",
|
||||
"@type": "@id"
|
||||
},
|
||||
"orderedItems": {
|
||||
"@id": "as:items",
|
||||
"@type": "@id",
|
||||
"@container": "@list"
|
||||
},
|
||||
"last": {
|
||||
"@id": "as:last",
|
||||
"@type": "@id"
|
||||
},
|
||||
"location": {
|
||||
"@id": "as:location",
|
||||
"@type": "@id"
|
||||
},
|
||||
"next": {
|
||||
"@id": "as:next",
|
||||
"@type": "@id"
|
||||
},
|
||||
"object": {
|
||||
"@id": "as:object",
|
||||
"@type": "@id"
|
||||
},
|
||||
"oneOf": {
|
||||
"@id": "as:oneOf",
|
||||
"@type": "@id"
|
||||
},
|
||||
"anyOf": {
|
||||
"@id": "as:anyOf",
|
||||
"@type": "@id"
|
||||
},
|
||||
"closed": {
|
||||
"@id": "as:closed",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"origin": {
|
||||
"@id": "as:origin",
|
||||
"@type": "@id"
|
||||
},
|
||||
"accuracy": {
|
||||
"@id": "as:accuracy",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"prev": {
|
||||
"@id": "as:prev",
|
||||
"@type": "@id"
|
||||
},
|
||||
"preview": {
|
||||
"@id": "as:preview",
|
||||
"@type": "@id"
|
||||
},
|
||||
"replies": {
|
||||
"@id": "as:replies",
|
||||
"@type": "@id"
|
||||
},
|
||||
"result": {
|
||||
"@id": "as:result",
|
||||
"@type": "@id"
|
||||
},
|
||||
"audience": {
|
||||
"@id": "as:audience",
|
||||
"@type": "@id"
|
||||
},
|
||||
"partOf": {
|
||||
"@id": "as:partOf",
|
||||
"@type": "@id"
|
||||
},
|
||||
"tag": {
|
||||
"@id": "as:tag",
|
||||
"@type": "@id"
|
||||
},
|
||||
"target": {
|
||||
"@id": "as:target",
|
||||
"@type": "@id"
|
||||
},
|
||||
"to": {
|
||||
"@id": "as:to",
|
||||
"@type": "@id"
|
||||
},
|
||||
"url": {
|
||||
"@id": "as:url",
|
||||
"@type": "@id"
|
||||
},
|
||||
"altitude": {
|
||||
"@id": "as:altitude",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"content": "as:content",
|
||||
"contentMap": {
|
||||
"@id": "as:content",
|
||||
"@container": "@language"
|
||||
},
|
||||
"name": "as:name",
|
||||
"nameMap": {
|
||||
"@id": "as:name",
|
||||
"@container": "@language"
|
||||
},
|
||||
"duration": {
|
||||
"@id": "as:duration",
|
||||
"@type": "xsd:duration"
|
||||
},
|
||||
"endTime": {
|
||||
"@id": "as:endTime",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"height": {
|
||||
"@id": "as:height",
|
||||
"@type": "xsd:nonNegativeInteger"
|
||||
},
|
||||
"href": {
|
||||
"@id": "as:href",
|
||||
"@type": "@id"
|
||||
},
|
||||
"hreflang": "as:hreflang",
|
||||
"latitude": {
|
||||
"@id": "as:latitude",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"longitude": {
|
||||
"@id": "as:longitude",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"mediaType": "as:mediaType",
|
||||
"published": {
|
||||
"@id": "as:published",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"radius": {
|
||||
"@id": "as:radius",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"rel": "as:rel",
|
||||
"startIndex": {
|
||||
"@id": "as:startIndex",
|
||||
"@type": "xsd:nonNegativeInteger"
|
||||
},
|
||||
"startTime": {
|
||||
"@id": "as:startTime",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"summary": "as:summary",
|
||||
"summaryMap": {
|
||||
"@id": "as:summary",
|
||||
"@container": "@language"
|
||||
},
|
||||
"totalItems": {
|
||||
"@id": "as:totalItems",
|
||||
"@type": "xsd:nonNegativeInteger"
|
||||
},
|
||||
"units": "as:units",
|
||||
"updated": {
|
||||
"@id": "as:updated",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"width": {
|
||||
"@id": "as:width",
|
||||
"@type": "xsd:nonNegativeInteger"
|
||||
},
|
||||
"describes": {
|
||||
"@id": "as:describes",
|
||||
"@type": "@id"
|
||||
},
|
||||
"formerType": {
|
||||
"@id": "as:formerType",
|
||||
"@type": "@id"
|
||||
},
|
||||
"deleted": {
|
||||
"@id": "as:deleted",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"inbox": {
|
||||
"@id": "ldp:inbox",
|
||||
"@type": "@id"
|
||||
},
|
||||
"outbox": {
|
||||
"@id": "as:outbox",
|
||||
"@type": "@id"
|
||||
},
|
||||
"following": {
|
||||
"@id": "as:following",
|
||||
"@type": "@id"
|
||||
},
|
||||
"followers": {
|
||||
"@id": "as:followers",
|
||||
"@type": "@id"
|
||||
},
|
||||
"streams": {
|
||||
"@id": "as:streams",
|
||||
"@type": "@id"
|
||||
},
|
||||
"preferredUsername": "as:preferredUsername",
|
||||
"endpoints": {
|
||||
"@id": "as:endpoints",
|
||||
"@type": "@id"
|
||||
},
|
||||
"uploadMedia": {
|
||||
"@id": "as:uploadMedia",
|
||||
"@type": "@id"
|
||||
},
|
||||
"proxyUrl": {
|
||||
"@id": "as:proxyUrl",
|
||||
"@type": "@id"
|
||||
},
|
||||
"liked": {
|
||||
"@id": "as:liked",
|
||||
"@type": "@id"
|
||||
},
|
||||
"oauthAuthorizationEndpoint": {
|
||||
"@id": "as:oauthAuthorizationEndpoint",
|
||||
"@type": "@id"
|
||||
},
|
||||
"oauthTokenEndpoint": {
|
||||
"@id": "as:oauthTokenEndpoint",
|
||||
"@type": "@id"
|
||||
},
|
||||
"provideClientKey": {
|
||||
"@id": "as:provideClientKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"signClientKey": {
|
||||
"@id": "as:signClientKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"sharedInbox": {
|
||||
"@id": "as:sharedInbox",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Public": {
|
||||
"@id": "as:Public",
|
||||
"@type": "@id"
|
||||
},
|
||||
"source": "as:source",
|
||||
"likes": {
|
||||
"@id": "as:likes",
|
||||
"@type": "@id"
|
||||
},
|
||||
"shares": {
|
||||
"@id": "as:shares",
|
||||
"@type": "@id"
|
||||
},
|
||||
"alsoKnownAs": {
|
||||
"@id": "as:alsoKnownAs",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
}
|
||||
19
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/extensions.jsonld
vendored
Normal file
19
vendor/sourcery.dny.nu/pana/vocab/w3/activitystreams/extensions.jsonld
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"@context": {
|
||||
"as": "https://www.w3.org/ns/activitystreams#",
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"manuallyApprovesFollowers": {
|
||||
"@id": "as:manuallyApprovesFollowers",
|
||||
"@type": "xsd:boolean"
|
||||
},
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"sensitive": {
|
||||
"@id": "as:sensitive",
|
||||
"@type": "xsd:boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
10
vendor/sourcery.dny.nu/pana/vocab/w3/ldp/context.go
vendored
Normal file
10
vendor/sourcery.dny.nu/pana/vocab/w3/ldp/context.go
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Package ldp contains terms for the Linked Data Platform namespace.
|
||||
package ldp
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "https://www.w3.org/ns/ldp#"
|
||||
|
||||
const (
|
||||
// Inbox is an IRI, either as a string or as an object with an id property.
|
||||
Inbox = Namespace + "inbox"
|
||||
)
|
||||
37
vendor/sourcery.dny.nu/pana/vocab/w3id/credentialsv1/context.go
vendored
Normal file
37
vendor/sourcery.dny.nu/pana/vocab/w3id/credentialsv1/context.go
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Package credv1 contains terms for the W3ID Credentials namespace.
|
||||
package credv1
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://w3id.org/credentials/v1"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "https://w3id.org/credentials#"
|
||||
|
||||
const (
|
||||
// Claim is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Claim = Namespace + "claim"
|
||||
// Credential is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Credential = Namespace + "credential"
|
||||
// Issued is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Issued = Namespace + "issued"
|
||||
// Issuer is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Issuer = Namespace + "issuer"
|
||||
// Recipient is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Recipient = Namespace + "recipient"
|
||||
// ReferenceID is a string.
|
||||
ReferenceID = Namespace + "referenceId"
|
||||
TypeCredential = Namespace + "Credential"
|
||||
// TypeCryptographicKeyCredential is a possible value for the type property.
|
||||
TypeCryptographicKeyCredential = Namespace + "CryptographicKeyCredential"
|
||||
)
|
||||
78
vendor/sourcery.dny.nu/pana/vocab/w3id/credentialsv1/context.jsonld
vendored
Normal file
78
vendor/sourcery.dny.nu/pana/vocab/w3id/credentialsv1/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
"@context": {
|
||||
"id": "@id",
|
||||
"type": "@type",
|
||||
"cred": "https://w3id.org/credentials#",
|
||||
"dc": "http://purl.org/dc/terms/",
|
||||
"sec": "https://w3id.org/security#",
|
||||
"schema": "http://schema.org/",
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||
"Identity": "https://w3id.org/identity#Identity",
|
||||
"claim": {
|
||||
"@id": "cred:claim",
|
||||
"@type": "@id"
|
||||
},
|
||||
"credential": {
|
||||
"@id": "cred:credential",
|
||||
"@type": "@id"
|
||||
},
|
||||
"issued": {
|
||||
"@id": "cred:issued",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"issuer": {
|
||||
"@id": "cred:issuer",
|
||||
"@type": "@id"
|
||||
},
|
||||
"recipient": {
|
||||
"@id": "cred:recipient",
|
||||
"@type": "@id"
|
||||
},
|
||||
"referenceId": "cred:referenceId",
|
||||
"Credential": "cred:Credential",
|
||||
"CryptographicKeyCredential": "cred:CryptographicKeyCredential",
|
||||
"created": {
|
||||
"@id": "dc:created",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"creator": {
|
||||
"@id": "dc:creator",
|
||||
"@type": "@id"
|
||||
},
|
||||
"domain": "sec:domain",
|
||||
"expires": {
|
||||
"@id": "sec:expiration",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"nonce": "sec:nonce",
|
||||
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
||||
"owner": {
|
||||
"@id": "sec:owner",
|
||||
"@type": "@id"
|
||||
},
|
||||
"privateKey": {
|
||||
"@id": "sec:privateKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"privateKeyPem": "sec:privateKeyPem",
|
||||
"publicKey": {
|
||||
"@id": "sec:publicKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"publicKeyPem": "sec:publicKeyPem",
|
||||
"publicKeyService": {
|
||||
"@id": "sec:publicKeyService",
|
||||
"@type": "@id"
|
||||
},
|
||||
"revoked": {
|
||||
"@id": "sec:revoked",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"signature": "sec:signature",
|
||||
"signatureAlgorithm": "sec:signatureAlgorithm",
|
||||
"signatureValue": "sec:signatureValue",
|
||||
"CryptographicKey": "sec:Key",
|
||||
"GraphSignature2012": "sec:GraphSignature2012",
|
||||
"LinkedDataSignature2015": "sec:LinkedDataSignature2015"
|
||||
}
|
||||
}
|
||||
26
vendor/sourcery.dny.nu/pana/vocab/w3id/identityv1/context.go
vendored
Normal file
26
vendor/sourcery.dny.nu/pana/vocab/w3id/identityv1/context.go
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Package identityv1 contains terms for the W3ID Identity namespace.
|
||||
package identityv1
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://w3id.org/identity/v1"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "https://w3id.org/identity#"
|
||||
|
||||
const (
|
||||
// IdentityService is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
IdentityService = Namespace + "identityService"
|
||||
// IDP is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
IDP = Namespace + "idp"
|
||||
// TypeIdentity is a possible value for the type property.
|
||||
TypeIdentity = Namespace + "Identity"
|
||||
)
|
||||
152
vendor/sourcery.dny.nu/pana/vocab/w3id/identityv1/context.jsonld
vendored
Normal file
152
vendor/sourcery.dny.nu/pana/vocab/w3id/identityv1/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
{
|
||||
"@context": {
|
||||
"id": "@id",
|
||||
"type": "@type",
|
||||
"cred": "https://w3id.org/credentials#",
|
||||
"dc": "http://purl.org/dc/terms/",
|
||||
"identity": "https://w3id.org/identity#",
|
||||
"perm": "https://w3id.org/permissions#",
|
||||
"ps": "https://w3id.org/payswarm#",
|
||||
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
||||
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
||||
"sec": "https://w3id.org/security#",
|
||||
"schema": "http://schema.org/",
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||
"Group": "https://www.w3.org/ns/activitystreams#Group",
|
||||
"claim": {
|
||||
"@id": "cred:claim",
|
||||
"@type": "@id"
|
||||
},
|
||||
"credential": {
|
||||
"@id": "cred:credential",
|
||||
"@type": "@id"
|
||||
},
|
||||
"issued": {
|
||||
"@id": "cred:issued",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"issuer": {
|
||||
"@id": "cred:issuer",
|
||||
"@type": "@id"
|
||||
},
|
||||
"recipient": {
|
||||
"@id": "cred:recipient",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Credential": "cred:Credential",
|
||||
"CryptographicKeyCredential": "cred:CryptographicKeyCredential",
|
||||
"about": {
|
||||
"@id": "schema:about",
|
||||
"@type": "@id"
|
||||
},
|
||||
"address": {
|
||||
"@id": "schema:address",
|
||||
"@type": "@id"
|
||||
},
|
||||
"addressCountry": "schema:addressCountry",
|
||||
"addressLocality": "schema:addressLocality",
|
||||
"addressRegion": "schema:addressRegion",
|
||||
"comment": "rdfs:comment",
|
||||
"created": {
|
||||
"@id": "dc:created",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"creator": {
|
||||
"@id": "dc:creator",
|
||||
"@type": "@id"
|
||||
},
|
||||
"description": "schema:description",
|
||||
"email": "schema:email",
|
||||
"familyName": "schema:familyName",
|
||||
"givenName": "schema:givenName",
|
||||
"image": {
|
||||
"@id": "schema:image",
|
||||
"@type": "@id"
|
||||
},
|
||||
"label": "rdfs:label",
|
||||
"name": "schema:name",
|
||||
"postalCode": "schema:postalCode",
|
||||
"streetAddress": "schema:streetAddress",
|
||||
"title": "dc:title",
|
||||
"url": {
|
||||
"@id": "schema:url",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Person": "schema:Person",
|
||||
"PostalAddress": "schema:PostalAddress",
|
||||
"Organization": "schema:Organization",
|
||||
"identityService": {
|
||||
"@id": "identity:identityService",
|
||||
"@type": "@id"
|
||||
},
|
||||
"idp": {
|
||||
"@id": "identity:idp",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Identity": "identity:Identity",
|
||||
"paymentProcessor": "ps:processor",
|
||||
"preferences": {
|
||||
"@id": "ps:preferences",
|
||||
"@type": "@vocab"
|
||||
},
|
||||
"cipherAlgorithm": "sec:cipherAlgorithm",
|
||||
"cipherData": "sec:cipherData",
|
||||
"cipherKey": "sec:cipherKey",
|
||||
"digestAlgorithm": "sec:digestAlgorithm",
|
||||
"digestValue": "sec:digestValue",
|
||||
"domain": "sec:domain",
|
||||
"expires": {
|
||||
"@id": "sec:expiration",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"initializationVector": "sec:initializationVector",
|
||||
"member": {
|
||||
"@id": "schema:member",
|
||||
"@type": "@id"
|
||||
},
|
||||
"memberOf": {
|
||||
"@id": "schema:memberOf",
|
||||
"@type": "@id"
|
||||
},
|
||||
"nonce": "sec:nonce",
|
||||
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
||||
"owner": {
|
||||
"@id": "sec:owner",
|
||||
"@type": "@id"
|
||||
},
|
||||
"password": "sec:password",
|
||||
"privateKey": {
|
||||
"@id": "sec:privateKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"privateKeyPem": "sec:privateKeyPem",
|
||||
"publicKey": {
|
||||
"@id": "sec:publicKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"publicKeyPem": "sec:publicKeyPem",
|
||||
"publicKeyService": {
|
||||
"@id": "sec:publicKeyService",
|
||||
"@type": "@id"
|
||||
},
|
||||
"revoked": {
|
||||
"@id": "sec:revoked",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"signature": "sec:signature",
|
||||
"signatureAlgorithm": "sec:signatureAlgorithm",
|
||||
"signatureValue": "sec:signatureValue",
|
||||
"CryptographicKey": "sec:Key",
|
||||
"EncryptedMessage": "sec:EncryptedMessage",
|
||||
"GraphSignature2012": "sec:GraphSignature2012",
|
||||
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
||||
"accessControl": {
|
||||
"@id": "perm:accessControl",
|
||||
"@type": "@id"
|
||||
},
|
||||
"writePermission": {
|
||||
"@id": "perm:writePermission",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
}
|
||||
94
vendor/sourcery.dny.nu/pana/vocab/w3id/securityv1/context.go
vendored
Normal file
94
vendor/sourcery.dny.nu/pana/vocab/w3id/securityv1/context.go
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
// Package secv1 contains terms for the W3ID Security namespace.
|
||||
package secv1
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed context.jsonld
|
||||
var ContextDocument []byte
|
||||
|
||||
// IRI is the remote context IRI.
|
||||
const IRI = "https://w3id.org/security/v1"
|
||||
|
||||
// Namespace is the IRI prefix used for terms defined in this namespace.
|
||||
const Namespace = "https://w3id.org/security#"
|
||||
|
||||
const (
|
||||
// AuthenticationTag is a string.
|
||||
AuthenticationTag = Namespace + "authenticationTag"
|
||||
// CanonicalizationAlgorithm is a string.
|
||||
CanonicalizationAlgorithm = Namespace + "canonicalizationAlgorithm"
|
||||
// CipherAlgorithm is a string.
|
||||
CipherAlgorithm = Namespace + "cipherAlgorithm"
|
||||
// CipherData is a string.
|
||||
CipherData = Namespace + "cipherData"
|
||||
// CipherKey is a string.
|
||||
CipherKey = Namespace + "cipherKey"
|
||||
// DigestAlgorithm is a string.
|
||||
DigestAlgorithm = Namespace + "digestAlgorithm"
|
||||
// DigestValue is a string.
|
||||
DigestValue = Namespace + "digestValue"
|
||||
// Domain is a string.
|
||||
Domain = Namespace + "domain"
|
||||
// EncryptionKey is a string.
|
||||
EncryptionKey = Namespace + "encryptionKey"
|
||||
// Expiration is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Expiration = Namespace + "expiration"
|
||||
// Expires is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Expires = Namespace + "expiration"
|
||||
// InitializationVector is a string.
|
||||
InitializationVector = Namespace + "initializationVector"
|
||||
// IterationCount is a string.
|
||||
IterationCount = Namespace + "iterationCount"
|
||||
// Nonce is a string.
|
||||
Nonce = Namespace + "nonce"
|
||||
// NormalizationAlgorithm is a string.
|
||||
NormalizationAlgorithm = Namespace + "normalizationAlgorithm"
|
||||
// Owner is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
Owner = Namespace + "owner"
|
||||
// Password is a string.
|
||||
Password = Namespace + "password"
|
||||
// PrivateKey is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
PrivateKey = Namespace + "privateKey"
|
||||
// PrivateKeyPem is a string.
|
||||
PrivateKeyPem = Namespace + "privateKeyPem"
|
||||
// PublicKey is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
PublicKey = Namespace + "publicKey"
|
||||
// PublicKeyBase58 is a string.
|
||||
PublicKeyBase58 = Namespace + "publicKeyBase58"
|
||||
// PublicKeyPem is a string.
|
||||
PublicKeyPem = Namespace + "publicKeyPem"
|
||||
// PublicKeyService is an IRI, either as a string or as an object with an
|
||||
// id property.
|
||||
PublicKeyService = Namespace + "publicKeyService"
|
||||
// PublicKeyWif is a string.
|
||||
PublicKeyWif = Namespace + "publicKeyWif"
|
||||
// Revoked is an xml:dateTime, equivalent to a time.Date in RFC3339Nano.
|
||||
Revoked = Namespace + "revoked"
|
||||
// Salt is a string.
|
||||
Salt = Namespace + "salt"
|
||||
// Signature is a string.
|
||||
Signature = Namespace + "signature"
|
||||
// SignatureAlgorithm is a string.
|
||||
SignatureAlgorithm = Namespace + "signingAlgorithm"
|
||||
// SignatureValue is a string.
|
||||
SignatureValue = Namespace + "signatureValue"
|
||||
// TypeCryptographicKey is a possible value for the type property.
|
||||
TypeCryptographicKey = Namespace + "Key"
|
||||
// TypeEcdsaKoblitzSignature2016 is a possible value for the type property.
|
||||
TypeEcdsaKoblitzSignature2016 = Namespace + "EcdsaKoblitzSignature2016"
|
||||
// TypeEd25519Signature2018 is a possible value for the type property.
|
||||
TypeEd25519Signature2018 = Namespace + "Ed25519Signature2018"
|
||||
// TypeEncryptedMessage is a possible value for the type property.
|
||||
TypeEncryptedMessage = Namespace + "EncryptedMessage"
|
||||
// TypeGraphSignature2012 is a possible value for the type property.
|
||||
TypeGraphSignature2012 = Namespace + "GraphSignature2012"
|
||||
// TypeLinkedDataSignature2015 is a possible value for the type property.
|
||||
TypeLinkedDataSignature2015 = Namespace + "LinkedDataSignature2015"
|
||||
// TypeLinkedDataSignature2016 is a possible value for the type property.
|
||||
TypeLinkedDataSignature2016 = Namespace + "LinkedDataSignature2016"
|
||||
)
|
||||
74
vendor/sourcery.dny.nu/pana/vocab/w3id/securityv1/context.jsonld
vendored
Normal file
74
vendor/sourcery.dny.nu/pana/vocab/w3id/securityv1/context.jsonld
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"@context": {
|
||||
"id": "@id",
|
||||
"type": "@type",
|
||||
"dc": "http://purl.org/dc/terms/",
|
||||
"sec": "https://w3id.org/security#",
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
||||
"EcdsaKoblitzSignature2016": "sec:EcdsaKoblitzSignature2016",
|
||||
"Ed25519Signature2018": "sec:Ed25519Signature2018",
|
||||
"EncryptedMessage": "sec:EncryptedMessage",
|
||||
"GraphSignature2012": "sec:GraphSignature2012",
|
||||
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
||||
"LinkedDataSignature2016": "sec:LinkedDataSignature2016",
|
||||
"CryptographicKey": "sec:Key",
|
||||
"authenticationTag": "sec:authenticationTag",
|
||||
"canonicalizationAlgorithm": "sec:canonicalizationAlgorithm",
|
||||
"cipherAlgorithm": "sec:cipherAlgorithm",
|
||||
"cipherData": "sec:cipherData",
|
||||
"cipherKey": "sec:cipherKey",
|
||||
"created": {
|
||||
"@id": "dc:created",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"creator": {
|
||||
"@id": "dc:creator",
|
||||
"@type": "@id"
|
||||
},
|
||||
"digestAlgorithm": "sec:digestAlgorithm",
|
||||
"digestValue": "sec:digestValue",
|
||||
"domain": "sec:domain",
|
||||
"encryptionKey": "sec:encryptionKey",
|
||||
"expiration": {
|
||||
"@id": "sec:expiration",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"expires": {
|
||||
"@id": "sec:expiration",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"initializationVector": "sec:initializationVector",
|
||||
"iterationCount": "sec:iterationCount",
|
||||
"nonce": "sec:nonce",
|
||||
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
||||
"owner": {
|
||||
"@id": "sec:owner",
|
||||
"@type": "@id"
|
||||
},
|
||||
"password": "sec:password",
|
||||
"privateKey": {
|
||||
"@id": "sec:privateKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"privateKeyPem": "sec:privateKeyPem",
|
||||
"publicKey": {
|
||||
"@id": "sec:publicKey",
|
||||
"@type": "@id"
|
||||
},
|
||||
"publicKeyBase58": "sec:publicKeyBase58",
|
||||
"publicKeyPem": "sec:publicKeyPem",
|
||||
"publicKeyWif": "sec:publicKeyWif",
|
||||
"publicKeyService": {
|
||||
"@id": "sec:publicKeyService",
|
||||
"@type": "@id"
|
||||
},
|
||||
"revoked": {
|
||||
"@id": "sec:revoked",
|
||||
"@type": "xsd:dateTime"
|
||||
},
|
||||
"salt": "sec:salt",
|
||||
"signature": "sec:signature",
|
||||
"signatureAlgorithm": "sec:signingAlgorithm",
|
||||
"signatureValue": "sec:signatureValue"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue