Skip to content

Commit f1a4a22

Browse files
committed
Updated API samples
1 parent deedac7 commit f1a4a22

3,540 files changed

Lines changed: 206896 additions & 33793 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.6.0
1+
8.0.0-SNAPSHOT

openapi-client/ada/defaultproject.gpr

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88
with "config";
99
with "utilada_sys";
1010
with "utilada_xml";
11-
with "utilada_http";
11+
with "utilada_curl";
1212
with "security";
1313
with "swagger";
1414
project defaultProject is
1515

16-
Mains := ("-client.adb");
17-
for Main use Mains;
18-
for Source_Dirs use ("src", "src/model", "src/client");
19-
for Object_Dir use "./" & Config'Exec_Dir & "/bin";
16+
for Object_Dir use "obj/";
17+
for Source_Dirs use ("src", "src/model", "src/client");
18+
Mains := ("-client.adb");
2019

21-
package Binder renames Config.Binder;
22-
package Builder renames Config.Builder;
23-
package Compiler renames Config.Compiler;
24-
package Linker renames Config.Linker;
20+
package Binder renames Config.Binder;
21+
package Builder renames Config.Builder;
22+
package Compiler renames Config.Compiler;
23+
package Linker renames Config.Linker;
2524

2625
end defaultProject;

openapi-client/ada/src/-client.adb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1+
-- ------------ EDIT NOTE ------------
2+
-- MailBaby Email Delivery and Management Service API
3+
-- **Send emails fast and with confidence through our easy to use [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API interface.** # Overview This is the API interface to the [Mail Baby](https//mail.baby/) Mail services provided by [InterServer](https://www.interserver.net). To use this service you must have an account with us at [my.interserver.net](https://my.interserver.net). # Authentication In order to use most of the API calls you must pass credentials from the [my.interserver.net](https://my.interserver.net/) site. We support several different authentication methods but the preferred method is to use the **API Key** which you can get from the [Account Security](https://my.interserver.net/account_security) page.
4+
-- This file was generated with openapi-generator. You can modify it to implement
5+
-- the client. After you modify this file, you should add the following line
6+
-- to the .openapi-generator-ignore file:
7+
--
8+
-- src/.ads
9+
--
10+
-- Then, you can drop this edit note comment.
11+
-- ------------ EDIT NOTE ------------
112
with .Clients;
213
with .Models;
314
with Swagger;
15+
with Swagger.Credentials.OAuth;
416
with Util.Http.Clients.Curl;
517
with Ada.Text_IO;
618
with Ada.Command_Line;
@@ -30,9 +42,11 @@ begin
3042
declare
3143
Command : constant String := Ada.Command_Line.Argument (Arg);
3244
Item : constant String := Ada.Command_Line.Argument (Arg + 1);
45+
Cred : aliased Swagger.Credentials.OAuth.OAuth2_Credential_Type;
3346
C : .Clients.Client_Type;
3447
begin
3548
C.Set_Server (Server);
49+
C.Set_Credentials (Cred'Unchecked_Access);
3650
Arg := Arg + 2;
3751

3852
exception

openapi-client/ada/src/client/-clients.adb

Lines changed: 159 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44
-- The version of the OpenAPI document: 1.1.0
55
-- Contact: support@interserver.net
66
--
7-
-- NOTE: This package is auto generated by OpenAPI-Generator 6.6.0.
7+
-- NOTE: This package is auto generated by OpenAPI-Generator 8.0.0-SNAPSHOT.
88
-- https://openapi-generator.tech
99
-- Do not edit the class manually.
1010

1111
pragma Warnings (Off, "*is not referenced");
1212
with Swagger.Streams;
1313
package body .Clients is
14-
pragma Style_Checks ("-mr");
14+
pragma Style_Checks ("-bmrIu");
15+
16+
Mime_1 : aliased constant String := "multipart/form-data";
17+
Media_List_1 : constant Swagger.Mime_List := (
18+
1 => Swagger.Mime_Json );
19+
Media_List_2 : constant Swagger.Mime_List := (
20+
1 => Swagger.Mime_Form,
21+
22+
2 => Swagger.Mime_Json );
23+
Media_List_3 : constant Swagger.Mime_List := (
24+
1 => Swagger.Mime_Json,
25+
26+
2 => Mime_1'Access );
27+
1528

1629
-- Creates a new email deny rule.
1730
-- Adds a new email deny rule into the system to block new emails that match the given criteria
@@ -25,8 +38,9 @@ package body .Clients is
2538
Req : Swagger.Clients.Request_Type;
2639
Reply : Swagger.Value_Type;
2740
begin
28-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
29-
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));
41+
Client.Set_Accept (Media_List_1);
42+
43+
Client.Initialize (Req, Media_List_2);
3044
.Models.Serialize (Req.Stream, "user", User);
3145
.Models.Serialize (Req.Stream, "type", P_Type);
3246
.Models.Serialize (Req.Stream, "data", Data);
@@ -45,10 +59,11 @@ package body .Clients is
4559
URI : Swagger.Clients.URI_Type;
4660
Reply : Swagger.Value_Type;
4761
begin
48-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
62+
Client.Set_Accept (Media_List_1);
63+
4964

5065
URI.Set_Path ("/mail/rules/{ruleId}");
51-
URI.Set_Path_Param ("ruleId", Swagger.To_String (Rule_Id));
66+
URI.Set_Path_Param ("ruleId", .Models.To_String (Rule_Id));
5267
Client.Call (Swagger.Clients.DELETE, URI, Reply);
5368
.Models.Deserialize (Reply, "", Result);
5469
end Delete_Rule;
@@ -57,16 +72,15 @@ package body .Clients is
5772
-- Removes an email address from the various block lists.
5873
procedure Delist_Block
5974
(Client : in out Client_Type;
60-
Email_Address_Type : in .Models.EmailAddress_Type;
75+
P_Body : in Swagger.UString;
6176
Result : out .Models.GenericResponse_Type) is
6277
URI : Swagger.Clients.URI_Type;
6378
Req : Swagger.Clients.Request_Type;
6479
Reply : Swagger.Value_Type;
6580
begin
66-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
67-
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
68-
Swagger.Clients.MULTIPART_FORM-DATA));
69-
.Models.Serialize (Req.Stream, "", Email_Address_Type);
81+
Client.Set_Accept (Media_List_1);
82+
Client.Initialize (Req, Media_List_3);
83+
.Models.Serialize (Req.Stream, "", P_Body);
7084

7185
URI.Set_Path ("/mail/blocks/delete");
7286
Client.Call (Swagger.Clients.POST, URI, Req, Reply);
@@ -80,7 +94,8 @@ package body .Clients is
8094
URI : Swagger.Clients.URI_Type;
8195
Reply : Swagger.Value_Type;
8296
begin
83-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
97+
Client.Set_Accept (Media_List_1);
98+
8499

85100
URI.Set_Path ("/mail/blocks");
86101
Client.Call (Swagger.Clients.GET, URI, Reply);
@@ -95,21 +110,24 @@ package body .Clients is
95110
URI : Swagger.Clients.URI_Type;
96111
Reply : Swagger.Value_Type;
97112
begin
98-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
113+
Client.Set_Accept (Media_List_1);
114+
99115

100116
URI.Set_Path ("/mail/rules");
101117
Client.Call (Swagger.Clients.GET, URI, Reply);
102118
.Models.Deserialize (Reply, "", Result);
103119
end Get_Rules;
104120

105-
-- displays a list of blocked email addresses
121+
-- Account usage statistics.
122+
-- Returns information about the usage on your mail accounts.
106123
procedure Get_Stats
107124
(Client : in out Client_Type;
108125
Result : out .Models.GetStats200ResponseInner_Type_Vectors.Vector) is
109126
URI : Swagger.Clients.URI_Type;
110127
Reply : Swagger.Value_Type;
111128
begin
112-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
129+
Client.Set_Accept (Media_List_1);
130+
113131

114132
URI.Set_Path ("/mail/stats");
115133
Client.Call (Swagger.Clients.GET, URI, Reply);
@@ -135,7 +153,8 @@ package body .Clients is
135153
URI : Swagger.Clients.URI_Type;
136154
Reply : Swagger.Value_Type;
137155
begin
138-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
156+
Client.Set_Accept (Media_List_1);
157+
139158

140159
URI.Add_Param ("id", Id);
141160
URI.Add_Param ("origin", Origin);
@@ -155,24 +174,136 @@ package body .Clients is
155174

156175
-- Sends an Email with Advanced Options
157176
-- Sends An email through one of your mail orders allowing additional options such as file attachments, cc, bcc, etc.
177+
--
178+
-- Here are 9 examples showing the various ways to call the advsend operation showing the different ways you can pass the to, cc, bcc, and replyto information. The first several examples are all for the application/x-www-form-urlencoded content-type while the later ones are for application/json content-types.
179+
--
180+
-- ```
181+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
182+
-- --header 'Accept: application/json' \
183+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
184+
-- --header 'X-API-KEY: YOUR_API_KEY' \
185+
-- --data 'subject=Welcome' \
186+
-- --data 'body=Hello' \
187+
-- --data from=user@domain.com \
188+
-- --data to=support@interserver.net
189+
-- ```
190+
--
191+
-- ```
192+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
193+
-- --header 'Accept: application/json' \
194+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
195+
-- --header 'X-API-KEY: YOUR_API_KEY' \
196+
-- --data 'subject=Welcome' \
197+
-- --data 'body=Hello' \
198+
-- --data from=user@domain.com \
199+
-- --data "to[0][name]=Joe" \
200+
-- --data "to[0][email]=support@interserver.net"
201+
-- ```
202+
--
203+
-- ```
204+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
205+
-- --header 'Accept: application/json' \
206+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
207+
-- --header 'X-API-KEY: YOUR_API_KEY' \
208+
-- --data 'subject=Welcome' \
209+
-- --data 'body=Hello' \
210+
-- --data from="Joe <user@domain.com>" \
211+
-- --data to="Joe <support@interserver.net>"
212+
-- ```
213+
--
214+
-- ```
215+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
216+
-- --header 'Accept: application/json' \
217+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
218+
-- --header 'X-API-KEY: YOUR_API_KEY' \
219+
-- --data 'subject=Welcome' \
220+
-- --data 'body=Hello' \
221+
-- --data from=user@domain.com \
222+
-- --data "to=support@interserver.net, support@interserver.net"
223+
-- ```
224+
--
225+
-- ```
226+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
227+
-- --header 'Accept: application/json' \
228+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
229+
-- --header 'X-API-KEY: YOUR_API_KEY' \
230+
-- --data 'subject=Welcome' \
231+
-- --data 'body=Hello' \
232+
-- --data from=user@domain.com \
233+
-- --data "to=Joe <support@interserver.net>, Joe <support@interserver.net>"
234+
-- ```
235+
--
236+
-- ```
237+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
238+
-- --header 'Accept: application/json' \
239+
-- --header 'Content-Type: application/x-www-form-urlencoded' \
240+
-- --header 'X-API-KEY: YOUR_API_KEY' \
241+
-- --data 'subject=Welcome' \
242+
-- --data 'body=Hello' \
243+
-- --data from=user@domain.com \
244+
-- --data "to[0][name]=Joe" \
245+
-- --data "to[0][email]=support@interserver.net" \
246+
-- --data "to[1][name]=Joe" \
247+
-- --data "to[1][email]=support@interserver.net"
248+
-- ```
249+
--
250+
-- ```
251+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
252+
-- --header 'Accept: application/json' \
253+
-- --header 'Content-Type: application/json' \
254+
-- --header 'X-API-KEY: YOUR_API_KEY' \
255+
-- --data '{
256+
-- "subject": "Welcome",
257+
-- "body": "Hello",
258+
-- "from": "user@domain.com",
259+
-- "to": "support@interserver.net"
260+
-- }'
261+
-- ```
262+
--
263+
-- ```
264+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
265+
-- --header 'Accept: application/json' \
266+
-- --header 'Content-Type: application/json' \
267+
-- --header 'X-API-KEY: YOUR_API_KEY' \
268+
-- --data '{
269+
-- "subject": "Welcome",
270+
-- "body": "Hello",
271+
-- "from": {"name": "Joe", "email": "user@domain.com"},
272+
-- "to": [{"name": "Joe", "email": "support@interserver.net"}]
273+
-- }'
274+
-- ```
275+
--
276+
-- ```
277+
-- curl -i --request POST --url https://api.mailbaby.net/mail/advsend \
278+
-- --header 'Accept: application/json' \
279+
-- --header 'Content-Type: application/json' \
280+
-- --header 'X-API-KEY: YOUR_API_KEY' \
281+
-- --data '{
282+
-- "subject": "Welcome",
283+
-- "body": "Hello",
284+
-- "from": "Joe <user@domain.com>",
285+
-- "to": "Joe <support@interserver.net>"
286+
-- }'
287+
-- ```
158288
procedure Send_Adv_Mail
159289
(Client : in out Client_Type;
160290
Subject : in Swagger.UString;
161291
P_Body : in Swagger.UString;
162-
From : in .Models..Models.EmailAddressName_Type;
163-
To : in .Models.EmailAddressName_Type_Vectors.Vector;
164-
Replyto : in .Models.EmailAddressName_Type_Vectors.Vector;
165-
Cc : in .Models.EmailAddressName_Type_Vectors.Vector;
166-
Bcc : in .Models.EmailAddressName_Type_Vectors.Vector;
292+
From : in .Models..Models.EmailAddressTypes_Type;
293+
To : in .Models..Models.EmailAddressesTypes_Type;
294+
Replyto : in .Models..Models.EmailAddressesTypes_Type;
295+
Cc : in .Models..Models.EmailAddressesTypes_Type;
296+
Bcc : in .Models..Models.EmailAddressesTypes_Type;
167297
Attachments : in .Models.MailAttachment_Type_Vectors.Vector;
168298
Id : in Swagger.Nullable_Long;
169299
Result : out .Models.GenericResponse_Type) is
170300
URI : Swagger.Clients.URI_Type;
171301
Req : Swagger.Clients.Request_Type;
172302
Reply : Swagger.Value_Type;
173303
begin
174-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
175-
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));
304+
Client.Set_Accept (Media_List_1);
305+
306+
Client.Initialize (Req, Media_List_2);
176307
.Models.Serialize (Req.Stream, "subject", Subject);
177308
.Models.Serialize (Req.Stream, "body", P_Body);
178309
.Models.Serialize (Req.Stream, "from", From);
@@ -203,8 +334,9 @@ package body .Clients is
203334
Req : Swagger.Clients.Request_Type;
204335
Reply : Swagger.Value_Type;
205336
begin
206-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
207-
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));
337+
Client.Set_Accept (Media_List_1);
338+
339+
Client.Initialize (Req, Media_List_2);
208340
.Models.Serialize (Req.Stream, "to", To);
209341
.Models.Serialize (Req.Stream, "from", From);
210342
.Models.Serialize (Req.Stream, "subject", Subject);
@@ -223,7 +355,8 @@ package body .Clients is
223355
URI : Swagger.Clients.URI_Type;
224356
Reply : Swagger.Value_Type;
225357
begin
226-
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
358+
Client.Set_Accept (Media_List_1);
359+
227360

228361
URI.Set_Path ("/mail");
229362
Client.Call (Swagger.Clients.GET, URI, Reply);

0 commit comments

Comments
 (0)