/ src / graphql_server.ads
graphql_server.ads
 1  -- SPDX-License-Identifier: AGPL-3.0-or-later
 2  -- GraphQL Server for bitfuckit
 3  -- Fire-and-Fuck-GET (and more) with Bitbucket
 4  --
 5  -- Exposes ALL CLI functionality via GraphQL API.
 6  -- Everything you can do offline, you can do via this API.
 7  
 8  with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
 9  
10  package GraphQL_Server
11     with SPARK_Mode => On
12  is
13     -- Server configuration
14     type Server_Config is record
15        Port            : Positive := 4000;
16        Host            : Unbounded_String := To_Unbounded_String ("127.0.0.1");
17        Enable_Playground : Boolean := False;
18        Enable_Introspection : Boolean := True;
19        Max_Depth       : Positive := 10;
20        Timeout_Seconds : Positive := 30;
21     end record;
22  
23     -- Server state
24     type Server_State is (Stopped, Starting, Running, Stopping, Error);
25  
26     -- Result type for operations
27     type GraphQL_Result is record
28        Success : Boolean;
29        Data    : Unbounded_String;
30        Errors  : Unbounded_String;
31     end record;
32  
33     -- Server operations
34     procedure Initialize (Config : Server_Config)
35        with Global => null;
36  
37     procedure Start
38        with Global => null,
39             Pre => Get_State = Stopped;
40  
41     procedure Stop
42        with Global => null,
43             Pre => Get_State = Running;
44  
45     function Get_State return Server_State
46        with Global => null;
47  
48     -- Query execution
49     function Execute_Query (Query : String; Variables : String := "{}")
50        return GraphQL_Result
51        with Global => null;
52  
53     -- Schema introspection
54     function Get_Schema return String
55        with Global => null;
56  
57     -- Health check
58     function Is_Healthy return Boolean
59        with Global => null;
60  
61  private
62     Current_State : Server_State := Stopped;
63     Current_Config : Server_Config;
64  
65  end GraphQL_Server;