esell / deb-simple

A lightweight, bare-bones apt repository server
MIT License
238 stars 17 forks source link

deb-simple API client #22

Closed xor-gate closed 5 years ago

xor-gate commented 7 years ago

When integrating with other golang software. deb-simple could benefit from an API client package. E.g:

package main

import (
    "github.com/esell/deb-simple/client"
)

func main() {
    client.New(&client.Config {
     APIKey: "1337",
    })
    client.PublishDebFile("myfile.deb")
}
pkramme commented 7 years ago

Wouldn't a simple system() call with the URL be enough?

xor-gate commented 7 years ago

System call, that is unacceptable! Golang has native support for HTTP transport. os.Exec as you mention as system() is 100% unportable across systems!

The native Client approach is fairly easy to implement.

pkramme commented 7 years ago

Oh, sorry, i am a C guy, so this would be more difficult in C. Sorry if this was disgusting to you :(

xor-gate commented 7 years ago

Ooh no, don't feel attacked. I know how you feel when writing in C/C++. I write mostly C for embedded systems and know how hard it is!

pkramme commented 7 years ago

Oh, that is good, i am always concerned pissing someone off... The reason for a system call would be, that other languages could use it too, and cross platform wouldn't be a problem IMO. I will look into libcurl for C (and the equivalent for python). Let's see if we can do something 👍

xor-gate commented 7 years ago

Probably an API build on top of Curl + some sort of JSON library would take 400% more time than a package in Golang :+)

esell commented 5 years ago

I think since deb-simple exposes REST endpoints, it might make sense to just have other go programs use those. I'll close this for now but if there is a good reason to add this we can open it back up.