kamiext

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

README

KamiExt

KamiReader Extension basic methods to use in extensions. Here follow the guide on how to use it, if you want to make an extension witouth using kamiext scroll down.

KamiExt provide easy and type safe methods to make an extension. Just follow the template inside "template/extension.go" in this repository.

TLDR for users that doesn't have to use KamiExt

  • Commands are executed by KamiExt as a normal CLI program. You will take input in this format:
    'your_program.exe CommandName --arg_name argdata --arg_name2 argdata2'
    
  • Different methods receive different arguments in different types:
    • GetComicByHandle:
      sourceid        string
      comic_handle    string
      
    • SearchComicByTitle:
      sourceid        string
      title           string
      
    • GetPagesByChapterHandle:
      sourceid        string
      chapter_handle  string
      
    • GetPageByHandle:
      sourceid        string
      page_handle     string
      
  • Data should be sent back to standard output in json format. The json response is command dependant but the "data" key is were you put the response, the "error" key is where you put the error string (this will change in the future) and the "dataversion" key is where you write the current DataVersion (current version is "1.0"). Here is the current different responses (You could also check types.go):
    • GetComicByHandle:
      {
          "data":{
              "title":"",
              "id":"",
              "url":"",
              "comictype":"",
              "releasestatus":"",
              "summary":"",
              "cover":"",
              "authors":"",
              "artists":"",
              "altnames":"",
              "genres":"",
              "year":"",
              "chapters":[
                  {
                      "name":"",
                      "number":"",
                      "timestamp":"",
                      "handle":"",
                      "pages":[""]
                  }
              ]
          },
          "error":""
      }
      
    • SearchComicByTitle:
      {
          "data": {
              "title":"",
              "id":"",
              "handle":"",
              "cover":""
          },
          "error":""
      }
      
    • GetPagesByChapterHandle:
      {
          "data": [""],
          "error":""
      }
      
    • GetPageByHandle:
      {
          "data": "base64_encoded_image",
          "error":""
      }
      

Documentation

Index

Constants

View Source
const DATAVERSION = "1.0"
View Source
const ExtErrorCode = 500
View Source
const NoMsg = ""
View Source
const NoParam = ""
View Source
const SuccessCode = 200

Variables

View Source
var Success = Status{Code: SuccessCode}

Functions

func Error

func Error(code int, error_msg string)

func NewExtension added in v0.0.7

func NewExtension() *ext

This initiate the extension

Types

type Chapter

type Chapter struct {
	Name      string   `json:"name"`
	Number    string   `json:"number"`
	Timestamp int      `json:"timestamp"`
	Handle    string   `json:"handle"`
	Pages     []string `json:"pages"`
}

type Comic

type Comic struct {
	Title         string    `json:"title"`
	Handle        string    `json:"handle"`
	Url           string    `json:"url"`
	ComicType     string    `json:"comictype"`
	ReleaseStatus string    `json:"releasestatus"`
	Summary       string    `json:"summary"`
	Cover         string    `json:"cover"`
	Authors       []string  `json:"authors"`
	Artists       []string  `json:"artists"`
	Altnames      []string  `json:"altnames"`
	Genres        []string  `json:"genres"`
	Year          string    `json:"year"`
	Chapters      []Chapter `json:"chapters"`
}

type Extension

type Extension struct {
	Name           string            `json:"name"`
	Id             string            `json:"id"`
	Author         string            `json:"author"`
	Links          Links             `json:"links"`
	Sources        map[string]Source `json:"sources"`
	Executable     string            `json:"executable"`
	UpdatesUrl     string            `json:"updatesurl"`
	Updater        string            `json:"updater"`
	Version        string            `json:"version"`
	ExtensionType  string            `json:"extensiontype"`
	Features       []string          `json:"features"`
	KamiExtVersion string            `json:"kamiextversion"`
	Description    string            `json:"description"`
}

type GetComicByHandleResponse added in v0.0.9

type GetComicByHandleResponse struct {
	Data        Comic  `json:"data"`
	Status      Status `json:"status"`
	DataVersion string `json:"dataversion"`
}

func GetComicByHandleRes added in v0.1.6

func GetComicByHandleRes(result Comic) GetComicByHandleResponse

type GetPageByHandleResponse added in v0.0.9

type GetPageByHandleResponse struct {
	Data        string `json:"data"`
	Status      Status `json:"status"`
	DataVersion string `json:"dataversion"`
}

func GetPageByHandleRes added in v0.1.6

func GetPageByHandleRes(result string) GetPageByHandleResponse

type GetPagesByChapterHandleResponse added in v0.0.9

type GetPagesByChapterHandleResponse struct {
	Data        []string `json:"data"`
	Status      Status   `json:"status"`
	DataVersion string   `json:"dataversion"`
}

func GetPagesByChapterHandleRes added in v0.1.6

func GetPagesByChapterHandleRes(result []string) GetPagesByChapterHandleResponse
type Links struct {
	GitHub     string `json:"github"`
	GenericGit string `json:"genericgit"`
	Website    string `json:"website"`
	Kofi       string `json:"kofi"`
}

type Response

type Response struct {
	Data        any    `json:"data"`
	Status      Status `json:"status"`
	DataVersion string `json:"dataversion"`
}

type SearchComic

type SearchComic struct {
	Title  string `json:"title"`
	Id     string `json:"id"`
	Handle string `json:"handle"`
	Cover  string `json:"cover"`
}

type SearchComicByTitleResponse added in v0.0.9

type SearchComicByTitleResponse struct {
	Data        []SearchComic `json:"data"`
	Status      Status        `json:"status"`
	DataVersion string        `json:"dataversion"`
}

func SearchComicByTitleRes added in v0.1.6

func SearchComicByTitleRes(result []SearchComic) SearchComicByTitleResponse

type Source

type Source struct {
	Name        string   `json:"name"`
	Methods     []string `json:"methods"`
	Id          string   `json:"id"`
	Domain      string   `json:"domain"`
	IsActive    bool     `json:"isactive"`
	ExtensionId string   `json:"extensionid"`
}

type Status added in v0.1.6

type Status struct {
	Code  int    `json:"code"`
	Value string `json:"value"`
}

func ErrorByCode added in v0.1.6

func ErrorByCode(code int, value string) Status

func ExtError added in v0.1.6

func ExtError(error_msg string) Status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL