syntax = "proto3";

package http;

option go_package = "github.com/navidrome/navidrome/plugins/host/http;http";

// go:plugin type=host version=1
service HttpService {
    rpc Get(HttpRequest) returns (HttpResponse);
    rpc Post(HttpRequest) returns (HttpResponse);
    rpc Put(HttpRequest) returns (HttpResponse);
    rpc Delete(HttpRequest) returns (HttpResponse);
    rpc Patch(HttpRequest) returns (HttpResponse);
    rpc Head(HttpRequest) returns (HttpResponse);
    rpc Options(HttpRequest) returns (HttpResponse);
}

message HttpRequest {
    string url = 1;
    map<string, string> headers = 2;
    int32 timeout_ms = 3;
    bytes body = 4; // Ignored for GET/DELETE/HEAD/OPTIONS
}

message HttpResponse {
    int32 status = 1;
    bytes body = 2;
    map<string, string> headers = 3;
    string error = 4; // Non-empty if network/protocol error
}