All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Ada.client.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
--  ------------ EDIT NOTE ------------
--  {{{appName}}}
--  {{{appDescription}}}
--  This file was generated with openapi-generator.  You can modify it to implement
--  the client.  After you modify this file, you should add the following line
--  to the .openapi-generator-ignore file:
--
--  src/{{packageName}}.ads
--
--  Then, you can drop this edit note comment.
--  ------------ EDIT NOTE ------------
with {{package}}.Clients;
with {{package}}.Models;
with {{openApiPackageName}};
with {{openApiPackageName}}.Credentials.OAuth;
with Util.Http.Clients.{{httpClientPackageName}};
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Calendar.Formatting;
with Ada.Exceptions;
procedure {{package}}.Client is

   use Ada.Text_IO;

   procedure Usage;

   Server    : constant {{openApiPackageName}}.UString := {{openApiPackageName}}.To_UString ("http://localhost:8080/v2");
   Arg_Count : constant Natural := Ada.Command_Line.Argument_Count;
   Arg       : Positive := 1;

   procedure Usage is
   begin
      Put_Line ("Usage: {{projectName}} {params}...");
   end Usage;

begin
   if Arg_Count <= 1 then
      Usage;
      return;
   end if;
   Util.Http.Clients.{{httpClientPackageName}}.Register;
   declare
      Command : constant String := Ada.Command_Line.Argument (Arg);
      Item    : constant String := Ada.Command_Line.Argument (Arg + 1);
      Cred    : aliased {{openApiPackageName}}.Credentials.OAuth.OAuth2_Credential_Type;
      C       : {{package}}.Clients.Client_Type;
   begin
      C.Set_Server (Server);
      C.Set_Credentials (Cred'Unchecked_Access);
      Arg := Arg + 2;

   exception
      when E : Constraint_Error =>
         Put_Line ("Constraint error raised: " & Ada.Exceptions.Exception_Message (E));

   end;
end {{package}}.Client;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy