From 4377d3893362eabd472d61f3e26e0e6105b9641d Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 2 Sep 2023 04:07:36 +0200 Subject: [PATCH] remove autogenerated docs, update API docs link --- backend/openapi.html | 480 ------------------ backend/routes.go | 11 - .../src/routes/settings/tokens/+page.svelte | 2 +- 3 files changed, 1 insertion(+), 492 deletions(-) delete mode 100644 backend/openapi.html diff --git a/backend/openapi.html b/backend/openapi.html deleted file mode 100644 index bb77d6f..0000000 --- a/backend/openapi.html +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - pronouns.cc - - - - - - - - - -

pronouns.cc (1.0.0)

Download OpenAPI specification:Download

License: GNU AGPLv3

The pronouns.cc REST API

-

Get a user

Get a user object. Accepts either ID or username.

-
path Parameters
userRef
required
string

A user reference, either an ID or a username. -IDs are always prioritized, if a user's username is the same as another user's ID, the user with that ID is returned.

-

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "member_title": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "members": [
    ],
  • "fields": [
    ],
  • "custom_preferences": {
    }
}

Get your own user

Get the user object associated with the provided token.

-
Authorizations:
TokenAuth

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "member_title": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "members": [
    ],
  • "fields": [
    ],
  • "custom_preferences": {
    },
  • "max_invites": 0,
  • "is_admin": true,
  • "list_private": true,
  • "discord": "string",
  • "discord_username": "string",
  • "tumblr": "string",
  • "tumblr_username": "string",
  • "google": "string",
  • "google_username": "string",
  • "fediverse": "string",
  • "fediverse_username": "string",
  • "fediverse_instance": "string"
}

Update your own user

Update the current user.

-
Request Body schema: application/json
name
string [ 2 .. 40 ] characters

The user's username, a unique string that identifies them in URLs.

-
display_name
string [ 1 .. 100 ] characters

The user's display name.

-
bio
string [ 1 .. 1000 ] characters

The user's bio/description.

-
member_title
string

Optional text used for the "Members" heading on the user's profile page.

-
avatar
string

A hash of the user's avatar, if set.

-

When editing, a base64-encoded PNG, JPEG, GIF, or WebP image file.

-
links
Array of strings

Links the user has added to their profile.

-
Array of objects (Root Type for FieldEntry)

The user's preferred names.

-
Array of objects (Root Type for FieldEntry)

The user's preferred pronouns.

-
Array of objects (Field)
object (CustomPreferences)

A user's custom preferences.

-
list_private
boolean

Whether your member list is private.

-

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "member_title": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "custom_preferences": {
    },
  • "list_private": true
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "member_title": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "members": [
    ],
  • "fields": [
    ],
  • "custom_preferences": {
    },
  • "max_invites": 0,
  • "is_admin": true,
  • "list_private": true,
  • "discord": "string",
  • "discord_username": "string",
  • "tumblr": "string",
  • "tumblr_username": "string",
  • "google": "string",
  • "google_username": "string",
  • "fediverse": "string",
  • "fediverse_username": "string",
  • "fediverse_instance": "string"
}

Get a user's member list

path Parameters
userRef
required
string

A user ID, username, or @me for yourself.

-

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a member

Authorizations:
TokenAuth
Request Body schema: application/json
name
string

The member's unique (per-user) name, used to identify them in URLs. Case insensitive.

-
display_name
string

The member's display name.

-
bio
string

The member's bio/description.

-
avatar
string

A hash of the member's avatar, if set.

-

When editing, a base64-encoded PNG, JPEG, GIF, or WebP image file.

-
links
Array of strings

The member's profile links.

-
Array of objects (Root Type for FieldEntry)

The member's preferred names.

-
Array of objects (PronounEntry)

The member's preferred pronouns.

-
Array of objects (Field)

The member's custom label fields.

-
object (Root Type for PartialUser)

A partial user object as returned from a member endpoint.

-

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Get a member by ID

path Parameters
memberRef
required
string

The member's unique ID.

-

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Delete a member

Authorizations:
TokenAuth
path Parameters
memberRef
required
string

The member's unique ID.

-

Responses

Response samples

Content type
application/json
{
  • "code": 2001,
  • "message": "User not found"
}

Update a member

Authorizations:
TokenAuth
path Parameters
memberRef
required
string

The member's unique ID.

-
Request Body schema: application/json
name
string

The member's unique (per-user) name, used to identify them in URLs. Case insensitive.

-
display_name
string

The member's display name.

-
bio
string

The member's bio/description.

-
avatar
string

A hash of the member's avatar, if set.

-

When editing, a base64-encoded PNG, JPEG, GIF, or WebP image file.

-
links
Array of strings

The member's profile links.

-
Array of objects (Root Type for FieldEntry)

The member's preferred names.

-
Array of objects (PronounEntry)

The member's preferred pronouns.

-
Array of objects (Field)

The member's custom label fields.

-
object (Root Type for PartialUser)

A partial user object as returned from a member endpoint.

-

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Get a member by ID or name

path Parameters
userRef
required
string

A user ID, username, or @me for yourself.

-
memberRef
required
string

A member ID or name.

-

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "display_name": "string",
  • "bio": "string",
  • "avatar": "string",
  • "links": [
    ],
  • "names": [
    ],
  • "pronouns": [
    ],
  • "fields": [
    ],
  • "user": {
    }
}

Get meta info

Responses

Response samples

Content type
application/json
{}
- - - - diff --git a/backend/routes.go b/backend/routes.go index 7ff0cca..f755929 100644 --- a/backend/routes.go +++ b/backend/routes.go @@ -1,8 +1,6 @@ package backend import ( - "net/http" - "codeberg.org/pronounscc/pronouns.cc/backend/routes/v1/auth" "codeberg.org/pronounscc/pronouns.cc/backend/routes/v1/bot" "codeberg.org/pronounscc/pronouns.cc/backend/routes/v1/member" @@ -12,14 +10,10 @@ import ( user2 "codeberg.org/pronounscc/pronouns.cc/backend/routes/v2/user" "codeberg.org/pronounscc/pronouns.cc/backend/server" "github.com/go-chi/chi/v5" - "github.com/go-chi/render" _ "embed" ) -//go:embed openapi.html -var openapi string - // mountRoutes mounts all API routes on the server's router. // they are all mounted under /v1/ func mountRoutes(s *server.Server) { @@ -35,9 +29,4 @@ func mountRoutes(s *server.Server) { s.Router.Route("/v2", func(r chi.Router) { user2.Mount(s, r) }) - - // API docs - s.Router.Get("/", func(w http.ResponseWriter, r *http.Request) { - render.HTML(w, r, openapi) - }) } diff --git a/frontend/src/routes/settings/tokens/+page.svelte b/frontend/src/routes/settings/tokens/+page.svelte index aa9ae9c..d1a1132 100644 --- a/frontend/src/routes/settings/tokens/+page.svelte +++ b/frontend/src/routes/settings/tokens/+page.svelte @@ -50,7 +50,7 @@ - +