Added more API examples

This commit is contained in:
2018-03-28 01:59:14 +02:00
parent c5de0c6d6f
commit bf6a28faca
9 changed files with 69 additions and 43 deletions

View File

@ -1,13 +1,14 @@
component API(types []string)
h1 API
table
//- thead
//- tr
//- th Table
tbody
each typeName in types
tr
td= typeName
td
a(href="/api/" + strings.ToLower(typeName) + "/")= "/api/" + strings.ToLower(typeName) + "/"
.api-docs-page
h1 API
table
//- thead
//- tr
//- th Table
tbody
each typeName in types
tr
td= typeName
td
a(href="/api/" + strings.ToLower(typeName) + "/")= "/api/" + strings.ToLower(typeName) + "/"

View File

@ -1,17 +1,17 @@
component APIDocs(t reflect.Type, examples []string, fields []*utils.APIField)
.api-docs-page
h1= "API: " + t.Name()
h1= t.Name()
h2 Examples
if len(examples) == 0
p.no-data No examples have been added to this type yet.
p.no-data No examples available yet.
else
.buttons
each example in examples
a.button(href="https://notify.moe" + example, target="_blank")
a.button(href=example, target="_blank")
Icon("external-link")
span= example
span= strings.TrimPrefix(example, "/api")
h2 Fields

View File

@ -1,6 +1,7 @@
.api-docs-page
h1,
h2
h2,
p
text-align left
table

View File

@ -24,7 +24,7 @@ component AllNotifications(notifications []*arn.Notification)
a(href=notification.User().Link())= notification.User().Nick
component Notification(notification *arn.Notification)
a.notification(href=notification.Link, target="_blank", data-seen=notification.Seen)
a.notification(href=notification.Link, target="_blank", data-seen=notification.Seen, data-id=notification.ID)
.notification-icon
img.lazy(data-src=notification.Icon, alt=notification.Title)

View File

@ -32,7 +32,7 @@ func BuyItem(ctx *aero.Context) string {
return ctx.Error(http.StatusBadRequest, "Invalid item quantity", err)
}
item, err := arn.GetItem(itemID)
item, err := arn.GetShopItem(itemID)
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching item data", err)

View File

@ -19,7 +19,7 @@ func Get(ctx *aero.Context) string {
return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
}
items, err := arn.AllItems()
items, err := arn.AllShopItems()
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching shop item data", err)