~mariusor/activitypub-go

2 2

GetID() vs GetLink()

Anthony Wang <ta180m@proton.me>
Details
Message ID
<NXRUnlucUSX8FL9I57dimPx4dpMKz01JDjKXqeHC8V9Z7pSTnjoZyV8ukearYJOq4IDogmpDLoEK-ScPDKs_egPnFGcAAO4XqHbj2rTUm-E=@proton.me>
DKIM signature
pass
Download raw message
Hello Marius,

It appears that GetID() and GetLink() do something very similar. Is there a difference between the two functions, and when should I use one instead of the other?

-Anthony
Details
Message ID
<20220722081521.64xvuvmqiaveubhk@tp>
In-Reply-To
<NXRUnlucUSX8FL9I57dimPx4dpMKz01JDjKXqeHC8V9Z7pSTnjoZyV8ukearYJOq4IDogmpDLoEK-ScPDKs_egPnFGcAAO4XqHbj2rTUm-E=@proton.me> (view parent)
DKIM signature
pass
Download raw message
On 22-07-21 15:45:06, Anthony Wang wrote:
> Hello Marius,
> 
> It appears that GetID() and GetLink() do something very similar. Is there a difference between the two functions, and when should I use one instead of the other?
> 

Hey Anthony,

They are similar, and it's possible that in the long run GetID() will be
dropped (at least from the Item interface).

They reason why they both exist is because I wanted an interface that
can be satisfied by both a "Link" object (which doesn't have an ID,
because it represents a "link" to a resource outside the confines of an
ActivityPub context) and an "Object" (which conforms to the addressing
rules of ActivityPub, where the object can be uniquely dereferenced at
the IRI of its ID). In the ActivityStreams vocabulary documentation[1]
this difference is detailed a little (but not enough in my opinion).

As such for types that are based on an ActivityPub object, the two
methods return the same thing. For Link based objects (Mention is the
only one that I saw in use so far), GetID() doesn't exist.

I hope it clarifies things a little.

/Marius

[1] https://www.w3.org/TR/activitystreams-vocabulary/#object-types
Anthony Wang <ta180m@proton.me>
Details
Message ID
<WnAkDH0dKYAjjD_UhW0qhwWfsa3PUSu3-heNFIlGFz10OdaUPwZMiRl2Y-waOCXkjzbAGlUl7PaeK9nIdvsGJjr1-s2rE3z6hF-T4L_qHHk=@proton.me>
In-Reply-To
<20220722081521.64xvuvmqiaveubhk@tp> (view parent)
DKIM signature
pass
Download raw message
------- Original Message -------
On Friday, July 22nd, 2022 at 03:15, Marius Orcsik <marius@federated.id> wrote:
> Hey Anthony,
> 

> They are similar, and it's possible that in the long run GetID() will be
> dropped (at least from the Item interface).
> 

> They reason why they both exist is because I wanted an interface that
> can be satisfied by both a "Link" object (which doesn't have an ID,
> because it represents a "link" to a resource outside the confines of an
> ActivityPub context) and an "Object" (which conforms to the addressing
> rules of ActivityPub, where the object can be uniquely dereferenced at
> the IRI of its ID). In the ActivityStreams vocabulary documentation[1]
> this difference is detailed a little (but not enough in my opinion).
> 

> As such for types that are based on an ActivityPub object, the two
> methods return the same thing. For Link based objects (Mention is the
> only one that I saw in use so far), GetID() doesn't exist.
> 

> I hope it clarifies things a little.
> 

> /Marius
> 

> [1] https://www.w3.org/TR/activitystreams-vocabulary/#object-types

Hi Marius,

Yes, that makes a lot more sense. I'll use GetLink() from now on then.

-Anthony
Reply to thread Export thread (mbox)