38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#pragma once
|
|
#include <Arduino.h>
|
|
#include <vector>
|
|
|
|
struct ParamSpec {
|
|
String name;
|
|
bool required;
|
|
String location; // "query" | "body" | "path" | "header"
|
|
String type; // e.g. "string", "number", "boolean"
|
|
std::vector<String> values; // optional allowed values
|
|
String defaultValue; // optional default value (stringified)
|
|
};
|
|
|
|
struct EndpointCapability {
|
|
String uri;
|
|
int method;
|
|
std::vector<ParamSpec> params;
|
|
};
|
|
|
|
struct EndpointInfo {
|
|
String uri;
|
|
int method;
|
|
std::vector<ParamSpec> params;
|
|
String serviceName; // Name of the service that registered this endpoint
|
|
bool isLocal; // Whether this endpoint is on the local node
|
|
|
|
// Constructor for individual parameters
|
|
EndpointInfo(const String& u, int m, const std::vector<ParamSpec>& p, const String& service, bool local)
|
|
: uri(u), method(m), params(p), serviceName(service), isLocal(local) {}
|
|
|
|
// Constructor for easy conversion from EndpointCapability
|
|
EndpointInfo(const EndpointCapability& cap, const String& service = "", bool local = true)
|
|
: uri(cap.uri), method(cap.method), params(cap.params), serviceName(service), isLocal(local) {}
|
|
|
|
// Default constructor
|
|
EndpointInfo() : isLocal(true) {}
|
|
};
|