{"id":15058782,"url":"https://github.com/go-ap/activitypub","last_synced_at":"2025-05-16T14:05:18.537Z","repository":{"id":32553870,"uuid":"103186241","full_name":"go-ap/activitypub","owner":"go-ap","description":"ActivityPub vocabulary for Go","archived":false,"fork":false,"pushed_at":"2025-05-01T09:09:45.000Z","size":1670,"stargazers_count":139,"open_issues_count":1,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-08T16:01:50.140Z","etag":null,"topics":["activitypub","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-ap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-11T20:45:18.000Z","updated_at":"2025-05-01T09:09:48.000Z","dependencies_parsed_at":"2023-11-24T09:03:19.079Z","dependency_job_id":"699cf698-4c7c-439c-bec8-50eaef7db71d","html_url":"https://github.com/go-ap/activitypub","commit_stats":{"total_commits":970,"total_committers":5,"mean_commits":194.0,"dds":"0.43608247422680413","last_synced_commit":"b4b8c8aa484ca3202aed9f92fe9bb7fd4fcccb6a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-ap%2Factivitypub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-ap%2Factivitypub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-ap%2Factivitypub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-ap%2Factivitypub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-ap","download_url":"https://codeload.github.com/go-ap/activitypub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activitypub","go"],"created_at":"2024-09-24T22:30:08.310Z","updated_at":"2025-05-16T14:05:18.517Z","avatar_url":"https://github.com/go-ap.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About GoActivityPub: Vocabulary\n\n[![MIT Licensed](https://img.shields.io/github/license/go-ap/activitypub.svg)](https://raw.githubusercontent.com/go-ap/activitypub/master/LICENSE)\n[![Build Status](https://builds.sr.ht/~mariusor/activitypub.svg)](https://builds.sr.ht/~mariusor/activitypub)\n[![Test Coverage](https://img.shields.io/codecov/c/github/go-ap/activitypub.svg)](https://codecov.io/gh/go-ap/activitypub)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-ap/activitypub)](https://goreportcard.com/report/github.com/go-ap/activitypub)\n\nThis project is part of the [GoActivityPub](https://github.com/go-ap) library which helps with creating ActivityPub applications using the Go programming language.\n\nIt contains data types for most of the [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/) and the [ActivityPub](https://www.w3.org/TR/activitypub/) extension.\nThey are documented accordingly with annotations from these specifications.\n\nYou can find an expanded documentation about the whole library [on SourceHut](https://man.sr.ht/~mariusor/go-activitypub/go-ap/index.md).\n\nFor discussions about the projects you can write to the discussions mailing list: [~mariusor/go-activitypub-discuss@lists.sr.ht](mailto:~mariusor/go-activitypub-discuss@lists.sr.ht)\n\nFor patches and bug reports please use the dev mailing list: [~mariusor/go-activitypub-dev@lists.sr.ht](mailto:~mariusor/go-activitypub-dev@lists.sr.ht)\n\n## Usage\n\n```go\nimport vocab \"github.com/go-ap/activitypub\"\n\nfollow := vocab.Activity{\n    Type: vocab.FollowType,\n    Actor: vocab.IRI(\"https://example.com/alice\"),\n    Object: vocab.IRI(\"https://example.com/janedoe\"),\n}\n\n```\n\n## Note about generics\n\nThe module contains helper functions which make it simpler to deal with the `vocab.Item` \ninterfaces and they come in two flavours: explicit `OnXXX` and `ToXXX` functions corresponding \nto each type and, a generic pair of functions `On[T]` and `To[T]`.\n\n```go\nimport (\n    \"fmt\"\n\n    vocab \"github.com/go-ap/activitypub\"\n)\n\nvar it vocab.Item = ... // an ActivityPub object unmarshaled from a request\n\nerr := vocab.OnActivity(it, func(act *vocab.Activity) error {\n    if vocab.ContentManagementActivityTypes.Contains(act.Type) {\n        fmt.Printf(\"This is a Content Management type activity: %q\", act.Type)\n    }\n    return nil\n})\n\nerr := vocab.On[vocab.Activity](it, func(act *vocab.Activity) error {\n    if vocab.ReactionsActivityTypes.Contains(act.Type) {\n        fmt.Printf(\"This is a Reaction type activity: %q\", act.Type)\n    }\n    return nil\n})\n\n```\n\nBefore using the generic versions you should consider that they come with a pretty heavy performance penalty:\n\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/go-ap/activitypub\ncpu: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz\nBenchmark_OnT_vs_On_T/OnObject-8                    752387791       1.633 ns/op\nBenchmark_OnT_vs_On_T/On_T_Object-8                   4656264     261.8   ns/op\nBenchmark_OnT_vs_On_T/OnActor-8                     739833261       1.596 ns/op\nBenchmark_OnT_vs_On_T/On_T_Actor-8                    4035148     301.9   ns/op\nBenchmark_OnT_vs_On_T/OnActivity-8                  751173854       1.604 ns/op\nBenchmark_OnT_vs_On_T/On_T_Activity-8                 4062598     285.9   ns/op\nBenchmark_OnT_vs_On_T/OnIntransitiveActivity-8      675824500       1.640 ns/op\nBenchmark_OnT_vs_On_T/On_T_IntransitiveActivity-8     4372798     274.1   ns/op\nPASS\nok  \tgithub.com/go-ap/activitypub\t11.350s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-ap%2Factivitypub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-ap%2Factivitypub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-ap%2Factivitypub/lists"}