Compare commits

..

4 Commits

37 changed files with 68 additions and 87 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2023 Charles Iliya Krempeaux :: http://changelog.ca/
Copyright (c) 2023 Charles Iliya Krempeaux :: http://reiver.link/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -5,34 +5,34 @@ Note that the **Mastodon API** is not (yet) officially part of **ActivityPub**.
## Documention
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-mstdn
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-mstdn
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-mstdn?status.svg)](https://godoc.org/sourcecode.social/reiver/go-mstdn)
[![GoDoc](https://godoc.org/github.com/reiver/go-mstdn?status.svg)](https://godoc.org/github.com/reiver/go-mstdn)
## Import
To import package **mstdn** use `import` code like the follownig:
```
import "sourcecode.social/reiver/go-mstdn"
import "github.com/reiver/go-mstdn"
```
To import the Mastodon API **entities** use `import` code like the following:
```
import "sourcecode.social/reiver/go-mstdn/ent"
import "github.com/reiver/go-mstdn/ent"
```
To import the Mastodon API **entities** for **administrators** use `import` code like the following:
```
import "sourcecode.social/reiver/go-mstdn/ent/admn"
import "github.com/reiver/go-mstdn/ent/admn"
```
## Installation
To install package **mstdn** do the following:
```
GOPROXY=direct go get https://sourcecode.social/reiver/go-mstdn
GOPROXY=direct go get https://github.com/reiver/go-mstdn
```
## Author
Package **mstdn** was written by [Charles Iliya Krempeaux](http://changelog.ca)
Package **mstdn** was written by [Charles Iliya Krempeaux](http://reiver.link)

View File

@ -5,8 +5,8 @@ import (
"sourcecode.social/reiver/go-pathmatch"
"sourcecode.social/reiver/go-mstdn"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn"
"github.com/reiver/go-mstdn/ent"
)
var _ http.Handler = internalHandler{}

View File

@ -1,8 +1,8 @@
package account_id
import (
"sourcecode.social/reiver/go-mstdn/api/v1"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/api/v1"
"github.com/reiver/go-mstdn/ent"
)
type LoaderFunc func(account *ent.Account, accountid string) v1.Error

View File

@ -3,8 +3,8 @@ package lookup
import (
"net/http"
"sourcecode.social/reiver/go-mstdn"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn"
"github.com/reiver/go-mstdn/ent"
)
var _ http.Handler = internalHandler{}

View File

@ -1,8 +1,8 @@
package lookup
import (
"sourcecode.social/reiver/go-mstdn/api/v1"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/api/v1"
"github.com/reiver/go-mstdn/ent"
)
type LoaderFunc func(account *ent.Account, acct string) v1.Error

View File

@ -5,7 +5,7 @@ import (
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-jsonint"
)

View File

@ -7,9 +7,9 @@ import (
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestAccount_MarshalJSON(t *testing.T) {

View File

@ -4,10 +4,10 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
var _ json.Marshaler = Account{}

View File

@ -7,10 +7,10 @@ import (
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent"
"sourcecode.social/reiver/go-mstdn/ent/admn"
"github.com/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent/admn"
)
func TestAdmin_MarshalJSON(t *testing.T) {

View File

@ -1,7 +1,7 @@
package admn
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// Dimension represents a Mastodon API "Admin::Dimension".

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
var _ json.Marshaler = DimensionData{}

View File

@ -5,9 +5,9 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent/admn"
"github.com/reiver/go-mstdn/ent/admn"
)
func TestDimensionData_MarshalJSON(t *testing.T) {

View File

@ -1,7 +1,7 @@
package admn
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// IP represents a Mastodon API "Admin::Ip".

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -7,9 +7,9 @@ import (
"sourcecode.social/reiver/go-jsonpp"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestApplication_MarshalJSON(t *testing.T) {

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
var _ json.Marshaler = CustomEmoji{}

View File

@ -6,7 +6,7 @@ import (
"bytes"
"encoding/json"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
func TestCustomEmoji_MarshalJSON(t *testing.T) {

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-erorr"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -6,7 +6,7 @@ import (
"bytes"
"encoding/json"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestField_MarshalJSON(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestField_UnmarshalJSON(t *testing.T) {

View File

@ -3,7 +3,7 @@ package ent
import (
"encoding/json"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -1,7 +1,7 @@
package ent
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// See:

View File

@ -1,7 +1,7 @@
package ent
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// Notification represents a Mastodon API "Notification".

View File

@ -2,7 +2,7 @@ package ent
import (
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -2,7 +2,7 @@ package ent
import (
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -2,7 +2,7 @@ package ent
import (
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -1,7 +1,7 @@
package ent
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// See:

View File

@ -3,7 +3,7 @@ package ent
import (
"sourcecode.social/reiver/go-jsonstr"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// Report represents a Mastodon API "Report".

View File

@ -9,9 +9,9 @@ import (
"sourcecode.social/reiver/go-jsonpp"
"sourcecode.social/reiver/go-jsonstr"
"sourcecode.social/reiver/go-nul"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestReport_MarshalJSON(t *testing.T) {

View File

@ -3,7 +3,7 @@ package ent
import (
"encoding/json"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-jsonint"
)

View File

@ -6,9 +6,9 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-mstdn/ent"
"github.com/reiver/go-mstdn/ent"
)
func TestRole_MarshalJSON(t *testing.T) {

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"sourcecode.social/reiver/go-jsonint"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
"sourcecode.social/reiver/go-nul"
)

View File

@ -1,7 +1,7 @@
package ent
import (
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
// Tag represents a Mastodon API "Tag".

View File

@ -6,7 +6,7 @@ import (
"io"
"net/http"
"sourcecode.social/reiver/go-opt"
"github.com/reiver/go-opt"
)
func errorJSON(writer io.Writer, statusCode int, msg ...interface{}) {

18
go.mod
View File

@ -1,13 +1,15 @@
module sourcecode.social/reiver/go-mstdn
module github.com/reiver/go-mstdn
go 1.20
require (
sourcecode.social/reiver/go-erorr v0.0.0-20230922202459-231149d185a1 // indirect
sourcecode.social/reiver/go-jsonint v0.0.0-20230924212905-09e0626e3dd8 // indirect
sourcecode.social/reiver/go-jsonpp v0.0.0-20230927044614-2bd26d25b35e // indirect
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927032837-cca9187c9798 // indirect
sourcecode.social/reiver/go-nul v0.0.0-20230927004815-8a8eeb3194fa // indirect
sourcecode.social/reiver/go-opt v0.0.0-20230927004316-272fd8451811 // indirect
sourcecode.social/reiver/go-pathmatch v0.0.0-20231001044920-1772a36eb6bd // indirect
github.com/reiver/go-opt v0.0.0-20240704165441-4ce81358adfc
sourcecode.social/reiver/go-erorr v0.0.0-20230922202459-231149d185a1
sourcecode.social/reiver/go-jsonint v0.0.0-20230924212905-09e0626e3dd8
sourcecode.social/reiver/go-jsonpp v0.0.0-20230927044614-2bd26d25b35e
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927032837-cca9187c9798
sourcecode.social/reiver/go-nul v0.0.0-20230927004815-8a8eeb3194fa
sourcecode.social/reiver/go-pathmatch v0.0.0-20231001044920-1772a36eb6bd
)
require github.com/reiver/go-erorr v0.0.0-20240704145350-0485e21eaa82 // indirect

31
go.sum
View File

@ -1,38 +1,17 @@
sourcecode.social/reiver/go-erorr v0.0.0-20230922194705-6dcd8d352220 h1:SOCgtgGppEFZZZNKMSMhALmtT9FD1ChUzS5JFlhNhBc=
sourcecode.social/reiver/go-erorr v0.0.0-20230922194705-6dcd8d352220/go.mod h1:NFtd7fzEf0r6A6R7JXYZfayRhPaJy0zt/18VWoLzrxA=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/reiver/go-erorr v0.0.0-20240704145350-0485e21eaa82 h1:xxt7qL+7ZfRysXWXU2MpULOg/zWe5P+Fmw9VyUFCmZE=
github.com/reiver/go-erorr v0.0.0-20240704145350-0485e21eaa82/go.mod h1:F0HbBf+Ak2ZlE8YkDW4Y+KxaUmT0KaaIJK6CXY3cJxE=
github.com/reiver/go-opt v0.0.0-20240704165441-4ce81358adfc h1:9ARo75fNaZDaGy6zzTrCnJWtkDMNigM7uMRRK8sUERM=
github.com/reiver/go-opt v0.0.0-20240704165441-4ce81358adfc/go.mod h1:Yu6dFKh0IZ0evP9U5QiBlxBa5BhlBzGEn7EZ1kP/pkA=
sourcecode.social/reiver/go-erorr v0.0.0-20230922202459-231149d185a1 h1:wpnz4JicQBLWrgGphYBls7DysIFCcnWgDz/vce/sY8E=
sourcecode.social/reiver/go-erorr v0.0.0-20230922202459-231149d185a1/go.mod h1:NFtd7fzEf0r6A6R7JXYZfayRhPaJy0zt/18VWoLzrxA=
sourcecode.social/reiver/go-jsonint v0.0.0-20230924185016-b499a1e14425 h1:3hEByqgGPWYmh89OAuYA6k4rdkTF7fobPgHAjQOzoq4=
sourcecode.social/reiver/go-jsonint v0.0.0-20230924185016-b499a1e14425/go.mod h1:PpaukJtakk0O45CurQVADzvpu4/2y0n1tc0j1dG1bVw=
sourcecode.social/reiver/go-jsonint v0.0.0-20230924212905-09e0626e3dd8 h1:Qf3OP8Z89a6t4M6qwF7q4+DYhU93rPFPJ1sl+bxesME=
sourcecode.social/reiver/go-jsonint v0.0.0-20230924212905-09e0626e3dd8/go.mod h1:PpaukJtakk0O45CurQVADzvpu4/2y0n1tc0j1dG1bVw=
sourcecode.social/reiver/go-jsonpp v0.0.0-20230927044614-2bd26d25b35e h1:hZJldAi9A94yjuyu7YzTH1MuBWQuPMbdM/aPFfow+zk=
sourcecode.social/reiver/go-jsonpp v0.0.0-20230927044614-2bd26d25b35e/go.mod h1:Wk0eR28gjwBkTH+6yv6lKOjoyqCntSOgQJJksJE1xc8=
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927001516-160f1f17699f h1:W6wVDR+GKH2PW4z0LuyMxD+v2R8+FlE9HHlF4aYdgeU=
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927001516-160f1f17699f/go.mod h1:K97qQnuRcjjh2OjhT2BzliIZMm8hLp4qIx8arkV/tnU=
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927032837-cca9187c9798 h1:yznt9jlfBogqkRvseZtzkeEA1BMktlveNVjDyoL0PSA=
sourcecode.social/reiver/go-jsonstr v0.0.0-20230927032837-cca9187c9798/go.mod h1:K97qQnuRcjjh2OjhT2BzliIZMm8hLp4qIx8arkV/tnU=
sourcecode.social/reiver/go-nul v0.0.0-20230924084858-46372d9e9949 h1:iAa2FSCR1CzOyWQgL6eUNIaII7ui87V0IOQTu4uYulU=
sourcecode.social/reiver/go-nul v0.0.0-20230924084858-46372d9e9949/go.mod h1:ZG+UaSVwpMEQr0faWJltKDXREDtzme3wCE2nutu7Tgw=
sourcecode.social/reiver/go-nul v0.0.0-20230924085205-da3d80e27a75 h1:u71gKZe6g4hPnSe7PkpkBd7zHKk6I/udCckdKG1xIiI=
sourcecode.social/reiver/go-nul v0.0.0-20230924085205-da3d80e27a75/go.mod h1:y59WFulHG1OigANht9QiVXSa5exV2bqt72RY3LmDstI=
sourcecode.social/reiver/go-nul v0.0.0-20230927004815-8a8eeb3194fa h1:ws1aQ5mMDvBbKEEk0UulTN4Mmszcs6pn4CgMcTLVkv0=
sourcecode.social/reiver/go-nul v0.0.0-20230927004815-8a8eeb3194fa/go.mod h1:4WTJneAzve27LLCE8+HRpFUIjuB3hgvZkNtlS43xbKw=
sourcecode.social/reiver/go-opt v0.0.0-20230922204021-df716e8fe048 h1:/MDewF+utMeOhLwYZmXA8GSy5Jma4/iq0fv1J+1vJT0=
sourcecode.social/reiver/go-opt v0.0.0-20230922204021-df716e8fe048/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230922223642-a33304548a94 h1:lk/e2W5McoYglMfWga0gk1YzNJYnqWA660Si4bnEwS4=
sourcecode.social/reiver/go-opt v0.0.0-20230922223642-a33304548a94/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230923002941-58bf264aa928 h1:FAQLe45K5yEDL/brV1DZN5TAJYHNgGq0EnSDFe4xTow=
sourcecode.social/reiver/go-opt v0.0.0-20230923002941-58bf264aa928/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230923212734-e38043bd8901 h1:mMuaCYrl0WklX8gDaA+WvPmXFMs2YhdbgYmW3E8A36M=
sourcecode.social/reiver/go-opt v0.0.0-20230923212734-e38043bd8901/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230924215954-cb749d3510af h1:1mjNkZavEsZJrxmCVWLFw/rMLXY1fV4nX3eXkSjeo4w=
sourcecode.social/reiver/go-opt v0.0.0-20230924215954-cb749d3510af/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230924220429-d6b2890eaa29 h1:93+N7APTX4WiA5f/1BtEYBN+uf4cFzhjudPOh5p1XJg=
sourcecode.social/reiver/go-opt v0.0.0-20230924220429-d6b2890eaa29/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230925023513-3e7cdb405e4f h1:Cp1Bz9qPPPMSQgcf79grTiPO2vnK+ILydgtBoI0HFu8=
sourcecode.social/reiver/go-opt v0.0.0-20230925023513-3e7cdb405e4f/go.mod h1:SEWWqfbCkDQCL0mpqwZEJQQkqLzhJZs1k4EmJ9xPU0E=
sourcecode.social/reiver/go-opt v0.0.0-20230927004316-272fd8451811 h1:T3ft05KUJpzkimaJXiNSpBkYJoRmyinvtrq8MbrfrFQ=
sourcecode.social/reiver/go-opt v0.0.0-20230927004316-272fd8451811/go.mod h1:O6WKM2UcKkheRT/dA6A2b1tW0m+WenSbxdcXE+idxzI=
sourcecode.social/reiver/go-pathmatch v0.0.0-20231001044920-1772a36eb6bd h1:6MIrZc2s6m4SaHnP2Aza6Cg4kMBiwpi+8mKdO9sjfhw=
sourcecode.social/reiver/go-pathmatch v0.0.0-20231001044920-1772a36eb6bd/go.mod h1:mw0k5AKQBwJ75SIP6sm9HWCSkEVxqn9UlHDH+MR8pjo=