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

Ada.client-body.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{>licenseInfo}}
pragma Warnings (Off, "*is not referenced");
with {{openApiPackageName}}.Streams;
package body {{package}}.Clients is
   pragma Style_Checks ("-bmrIu");

{{#mediaVariables}}
   {{name}} : aliased constant String := "{{value}}";
{{/mediaVariables}}
{{#mediaLists}}
   Media_List_{{-index}} : constant {{openApiPackageName}}.Mime_List := ({{#this}}
     {{-index}} => {{name}}{{^-last}},
     {{/-last}}
   {{/this}});
{{/mediaLists}}

{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}

   --  {{summary}}{{#vendorExtensions.x-has-notes}}
   --  {{#lambdaAdaComment}}{{unescapedNotes}}{{/lambdaAdaComment}}{{/vendorExtensions.x-has-notes}}
   procedure {{operationId}}
      (Client : in out Client_Type{{#hasParams}};{{/hasParams}}{{#allParams}}
       {{paramName}} : in {{^isFile}}{{^isString}}{{^isPrimitiveType}}{{^isContainer}}{{package}}.Models.{{/isContainer}}{{/isPrimitiveType}}{{/isString}}{{/isFile}}{{#vendorExtensions.x-ada-type-name}}{{vendorExtensions.x-ada-type-name}}{{/vendorExtensions.x-ada-type-name}}{{^vendorExtensions.x-ada-type-name}}{{dataType}}{{/vendorExtensions.x-ada-type-name}}{{^-last}};{{/-last}}{{/allParams}}{{#returnProperty}};
       Result : out {{#vendorExtensions.x-ada-type-name}}{{.}}{{/vendorExtensions.x-ada-type-name}}{{^vendorExtensions.x-ada-type-name}}{{dataType}}{{/vendorExtensions.x-ada-type-name}}{{/returnProperty}}) is
      URI   : {{openApiPackageName}}.Clients.URI_Type;{{#hasBodyParam}}
      Req   : {{openApiPackageName}}.Clients.Request_Type;{{/hasBodyParam}}{{#hasFormParams}}
      Req   : {{openApiPackageName}}.Clients.Request_Type;{{/hasFormParams}}
      {{#returnType}}
      Reply : {{openApiPackageName}}.Value_Type;
      {{/returnType}}
   begin
{{#vendorExtensions.x-produces-media-index}}
      Client.Set_Accept (Media_List_{{vendorExtensions.x-produces-media-index}});
{{/vendorExtensions.x-produces-media-index}}
      {{#hasBodyParam}}
      Client.Initialize (Req{{#hasConsumes}}, Media_List_{{vendorExtensions.x-consumes-media-index}}{{/hasConsumes}});{{#bodyParams}}{{#vendorExtensions.x-is-model-type}}
      {{package}}.Models.Serialize (Req.Stream, "", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{#isFile}}
      --  TODO: Serialize (Req.Stream, "{{basename}}", {{paramName}});{{/isFile}}{{^isFile}}{{^isLong}}
      Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/isLong}}{{#isLong}}
      Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/isLong}}{{/isFile}}{{/vendorExtensions.x-is-model-type}}{{/bodyParams}}{{/hasBodyParam}}{{#hasFormParams}}
      Client.Initialize (Req, Media_List_{{vendorExtensions.x-consumes-media-index}});{{#formParams}}{{#vendorExtensions.x-is-model-type}}
      {{package}}.Models.Serialize (Req.Stream, "{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}
      Req.Stream.Write_Entity ("{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{/formParams}}{{/hasFormParams}}
{{#queryParams}}{{#isQueryParam}}{{^isPrimitiveType}}{{^isString}}{{^isContainer}}{{^isDateTime}}{{#vendorExtensions.x-is-model-type}}
      URI.Add_Param ("{{baseName}}", {{package}}.Models.To_String ({{paramName}}));{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}
      URI.Add_Param ("{{baseName}}", {{paramName}});{{/vendorExtensions.x-is-model-type}}{{/isDateTime}}{{/isContainer}}{{/isString}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{^isLong}}
      URI.Add_Param ("{{baseName}}", {{paramName}});{{/isLong}}{{/isPrimitiveType}}{{#isLong}}
      URI.Add_Param ("{{baseName}}", {{paramName}});{{/isLong}}{{#isContainer}}
      URI.Add_Param ("{{baseName}}", {{paramName}});{{/isContainer}}{{#isDateTime}}
      URI.Add_Param ("{{baseName}}", {{paramName}});{{/isDateTime}}{{/isQueryParam}}{{/queryParams}}
      URI.Set_Path ("{{path}}");{{#pathParams}}
      URI.Set_Path_Param ("{{baseName}}", {{^isString}}{{#vendorExtensions.x-is-model-type}}{{package}}.Models{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{openApiPackageName}}{{/vendorExtensions.x-is-model-type}}.To_String ({{/isString}}{{paramName}}{{^isString}}){{/isString}});{{/pathParams}}
      Client.Call ({{openApiPackageName}}.Clients.{{httpMethod}}, URI{{#hasBodyParam}}, Req{{/hasBodyParam}}{{#hasFormParams}}, Req{{/hasFormParams}}{{#returnType}}, Reply{{/returnType}});
      {{#returnProperty}}
      {{^vendorExtensions.x-is-model-type}}
      {{openApiPackageName}}.Streams.Deserialize (Reply, "", Result);
      {{/vendorExtensions.x-is-model-type}}
      {{#vendorExtensions.x-is-model-type}}
      {{package}}.Models.Deserialize (Reply, "", Result);
      {{/vendorExtensions.x-is-model-type}}
      {{/returnProperty}}
   end {{operationId}};
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
end {{package}}.Clients;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy