api-testing/pkg/server/server.proto

222 lines
4.5 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "github.com/linuxsuren/api-testing/pkg/server";
package server;
service Runner {
// belong to a specific store
rpc Run (TestTask) returns (TestResult) {}
rpc GetSuites(Empty) returns (Suites) {}
rpc CreateTestSuite(TestSuiteIdentity) returns (HelloReply) {}
rpc GetTestSuite(TestSuiteIdentity) returns (TestSuite) {}
rpc UpdateTestSuite(TestSuite) returns (HelloReply) {}
rpc DeleteTestSuite(TestSuiteIdentity) returns (HelloReply) {}
// test cases related
rpc ListTestCase(TestSuiteIdentity) returns (Suite) {}
rpc GetSuggestedAPIs(TestSuiteIdentity) returns (TestCases) {}
rpc RunTestCase(TestCaseIdentity) returns (TestCaseResult) {}
rpc GetTestCase(TestCaseIdentity) returns (TestCase) {}
rpc CreateTestCase(TestCaseWithSuite) returns (HelloReply) {}
rpc UpdateTestCase(TestCaseWithSuite) returns (HelloReply) {}
rpc DeleteTestCase(TestCaseIdentity) returns (HelloReply) {}
// code generator
rpc ListCodeGenerator(Empty) returns (SimpleList) {}
rpc GenerateCode(CodeGenerateRequest) returns (CommonResult) {}
// converter
rpc ListConverter(Empty) returns (SimpleList) {}
rpc ConvertTestSuite(CodeGenerateRequest) returns (CommonResult) {}
// common services
rpc PopularHeaders(Empty) returns (Pairs) {}
rpc FunctionsQuery(SimpleQuery) returns (Pairs) {}
rpc FunctionsQueryStream(stream SimpleQuery) returns (stream Pairs) {}
rpc GetVersion(Empty) returns (HelloReply) {}
rpc Sample(Empty) returns (HelloReply) {}
// stores related interfaces
rpc GetStoreKinds(Empty) returns (StoreKinds) {}
rpc GetStores(Empty) returns (Stores) {}
rpc CreateStore(Store) returns (Store) {}
rpc UpdateStore(Store) returns (Store) {}
rpc DeleteStore(Store) returns (Store) {}
rpc VerifyStore(SimpleQuery) returns (CommonResult) {}
// secret related interfaces
rpc GetSecrets(Empty) returns (Secrets) {}
rpc CreateSecret(Secret) returns (CommonResult) {}
rpc DeleteSecret(Secret) returns (CommonResult) {}
rpc UpdateSecret(Secret) returns (CommonResult) {}
}
message Suites {
map<string, Items> data = 1;
}
message Items {
repeated string data = 1;
}
message TestCaseIdentity {
string suite = 1;
string testcase = 2;
}
message TestSuite {
string name = 1;
string api = 2;
repeated Pair param = 3;
APISpec spec = 4;
}
message APISpec {
string kind = 1;
string url = 2;
}
message TestSuiteIdentity {
string name = 1;
string api = 2;
}
message TestTask {
string data = 1;
string kind = 2;
string caseName = 3;
string level = 4;
map<string, string> env = 5;
}
message TestResult {
string message = 1;
string error = 2;
repeated TestCaseResult testCaseResult = 3;
}
message HelloReply {
string message = 1;
string error = 2;
}
message Suite {
string name = 1;
string api = 2;
repeated TestCase items = 3;
}
message TestCaseWithSuite {
string suiteName = 1;
TestCase data = 2;
}
message TestCases {
repeated TestCase data = 1;
}
message TestCase {
string name = 1;
string suiteName = 2;
Request request = 3;
Response response = 4;
}
message Request {
string api = 1;
string method = 2;
repeated Pair header = 3;
repeated Pair query = 4;
repeated Pair form = 5;
string body = 6;
}
message Response {
int32 statusCode = 1;
string body = 2;
repeated Pair header = 3;
repeated Pair bodyFieldsExpect = 4;
repeated string verify = 5;
string schema = 6;
}
message TestCaseResult {
int32 statusCode = 1;
string body = 2;
repeated Pair header = 3;
string error = 4;
string id = 5;
string output = 6;
}
message Pair {
string key = 1;
string value = 2;
}
message Pairs {
repeated Pair data = 1;
}
message SimpleQuery {
string name = 1;
}
message Stores {
repeated Store data = 1;
}
message Store {
string name = 1;
string description = 2;
string url = 3;
string username = 4;
string password = 5;
repeated Pair properties = 6;
StoreKind kind = 7;
bool ready = 8;
}
message StoreKinds {
repeated StoreKind data = 1;
}
message StoreKind {
string name = 1;
string url = 2;
}
message CommonResult {
bool success = 1;
string message = 2;
}
message SimpleList {
repeated Pair data = 1;
}
message SimpleName {
string name = 1;
}
message CodeGenerateRequest {
string TestSuite = 1;
string TestCase = 2;
string Generator = 3;
}
message Secrets {
repeated Secret data = 1;
}
message Secret {
string Name = 1;
string Value = 2;
string Description = 3;
}
message Empty {
}