Skip to content

Commit 5e74fa8

Browse files
committed
Updated on 2025-03-22 23:15:48. Version: 2.1.0
1 parent ecdcca8 commit 5e74fa8

19 files changed

+243
-20
lines changed

.openapi-generator/FILES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ lib/docspring/model/list_submissions_response.ex
3535
lib/docspring/model/move_folder_data.ex
3636
lib/docspring/model/move_template_data.ex
3737
lib/docspring/model/multiple_errors_response.ex
38+
lib/docspring/model/publish_version_data.ex
3839
lib/docspring/model/rename_folder_data.ex
40+
lib/docspring/model/restore_version_data.ex
3941
lib/docspring/model/submission.ex
4042
lib/docspring/model/submission_action.ex
4143
lib/docspring/model/submission_batch.ex
@@ -50,7 +52,9 @@ lib/docspring/model/success_error_response.ex
5052
lib/docspring/model/success_multiple_errors_response.ex
5153
lib/docspring/model/template.ex
5254
lib/docspring/model/template_add_fields_response.ex
55+
lib/docspring/model/template_delete_response.ex
5356
lib/docspring/model/template_preview.ex
57+
lib/docspring/model/template_publish_version_response.ex
5458
lib/docspring/model/update_html_template.ex
5559
lib/docspring/model/update_submission_data_request_data.ex
5660
lib/docspring/model/upload_presign_response.ex

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### 2.1.0 [March 22, 2025]
2+
3+
- Added support for Template Versioning parameters:
4+
- Optional version parameter in submission requests (e.g., 1.2.3, draft, latest)
5+
- New API methods: publish_template_version, restore_template_version
6+
- Updated copy_template and delete_template methods to accept template version strings
7+
18
### 2.0.0 [February 23, 2025]
29

310
- **BREAKING CHANGE**: Updated default host to our new synchronous API subdomain: sync.api.docspring.com. (EU customers should use sync.api-eu.docspring.com). Removed all custom polling code from library since this logic is now handled by the API service running on our sync subdomain

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ your list of dependencies in `mix.exs`:
1818

1919
```elixir
2020
def deps do
21-
[{:docspring, "~> 2.0.0"}]
21+
[{:docspring, "~> 2.1.0"}]
2222
end
2323
```
2424

lib/docspring/api/pdf.ex

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,24 +470,30 @@ defmodule Docspring.Api.PDF do
470470
- `connection` (Docspring.Connection): Connection to server
471471
- `template_id` (String.t):
472472
- `opts` (keyword): Optional parameters
473+
- `:version` (String.t):
473474
474475
### Returns
475476
476-
- `{:ok, Docspring.Model.SuccessMultipleErrorsResponse.t}` on success
477+
- `{:ok, Docspring.Model.TemplateDeleteResponse.t}` on success
477478
- `{:error, Tesla.Env.t}` on failure
478479
"""
479-
@spec delete_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} | {:ok, Docspring.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
480-
def delete_template(connection, template_id, _opts \\ []) do
480+
@spec delete_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.ErrorResponse.t} | {:ok, Docspring.Model.TemplateDeleteResponse.t} | {:error, Tesla.Env.t}
481+
def delete_template(connection, template_id, opts \\ []) do
482+
optional_params = %{
483+
:version => :query
484+
}
485+
481486
request =
482487
%{}
483488
|> method(:delete)
484489
|> url("/templates/#{template_id}")
490+
|> add_optional_params(optional_params, opts)
485491
|> Enum.into([])
486492

487493
connection
488494
|> Connection.request(request)
489495
|> evaluate_response([
490-
{200, Docspring.Model.SuccessMultipleErrorsResponse},
496+
{200, Docspring.Model.TemplateDeleteResponse},
491497
{404, Docspring.Model.ErrorResponse},
492498
{401, Docspring.Model.ErrorResponse}
493499
])
@@ -728,7 +734,7 @@ defmodule Docspring.Api.PDF do
728734
end
729735

730736
@doc """
731-
Fetch the full template attributes
737+
Fetch the full attributes for a PDF template
732738
733739
### Parameters
734740
@@ -1194,6 +1200,40 @@ defmodule Docspring.Api.PDF do
11941200
])
11951201
end
11961202

1203+
@doc """
1204+
Publish a template version
1205+
1206+
### Parameters
1207+
1208+
- `connection` (Docspring.Connection): Connection to server
1209+
- `template_id` (String.t):
1210+
- `data` (PublishVersionData):
1211+
- `opts` (keyword): Optional parameters
1212+
1213+
### Returns
1214+
1215+
- `{:ok, Docspring.Model.TemplatePublishVersionResponse.t}` on success
1216+
- `{:error, Tesla.Env.t}` on failure
1217+
"""
1218+
@spec publish_template_version(Tesla.Env.client, String.t, Docspring.Model.PublishVersionData.t, keyword()) :: {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} | {:ok, Docspring.Model.ErrorResponse.t} | {:ok, Docspring.Model.TemplatePublishVersionResponse.t} | {:error, Tesla.Env.t}
1219+
def publish_template_version(connection, template_id, data, _opts \\ []) do
1220+
request =
1221+
%{}
1222+
|> method(:post)
1223+
|> url("/templates/#{template_id}/publish_version")
1224+
|> add_param(:body, :body, data)
1225+
|> Enum.into([])
1226+
1227+
connection
1228+
|> Connection.request(request)
1229+
|> evaluate_response([
1230+
{200, Docspring.Model.TemplatePublishVersionResponse},
1231+
{422, Docspring.Model.SuccessMultipleErrorsResponse},
1232+
{404, Docspring.Model.ErrorResponse},
1233+
{401, Docspring.Model.ErrorResponse}
1234+
])
1235+
end
1236+
11971237
@doc """
11981238
Rename a folder
11991239
@@ -1228,6 +1268,40 @@ defmodule Docspring.Api.PDF do
12281268
])
12291269
end
12301270

1271+
@doc """
1272+
Restore a template version
1273+
1274+
### Parameters
1275+
1276+
- `connection` (Docspring.Connection): Connection to server
1277+
- `template_id` (String.t):
1278+
- `data` (RestoreVersionData):
1279+
- `opts` (keyword): Optional parameters
1280+
1281+
### Returns
1282+
1283+
- `{:ok, Docspring.Model.SuccessErrorResponse.t}` on success
1284+
- `{:error, Tesla.Env.t}` on failure
1285+
"""
1286+
@spec restore_template_version(Tesla.Env.client, String.t, Docspring.Model.RestoreVersionData.t, keyword()) :: {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} | {:ok, Docspring.Model.ErrorResponse.t} | {:ok, Docspring.Model.SuccessErrorResponse.t} | {:error, Tesla.Env.t}
1287+
def restore_template_version(connection, template_id, data, _opts \\ []) do
1288+
request =
1289+
%{}
1290+
|> method(:post)
1291+
|> url("/templates/#{template_id}/restore_version")
1292+
|> add_param(:body, :body, data)
1293+
|> Enum.into([])
1294+
1295+
connection
1296+
|> Connection.request(request)
1297+
|> evaluate_response([
1298+
{200, Docspring.Model.SuccessErrorResponse},
1299+
{422, Docspring.Model.SuccessMultipleErrorsResponse},
1300+
{404, Docspring.Model.SuccessMultipleErrorsResponse},
1301+
{401, Docspring.Model.ErrorResponse}
1302+
])
1303+
end
1304+
12311305
@doc """
12321306
Test Authentication
12331307

lib/docspring/connection.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ defmodule Docspring.Connection do
119119
Keyword.get(
120120
tesla_options,
121121
:user_agent,
122-
"docspring-elixir-2.0.0"
122+
"docspring-elixir-2.1.0"
123123
)
124124
)
125125

lib/docspring/model/combined_submission_action.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule Docspring.Model.CombinedSubmissionAction do
2020
:id => String.t | nil,
2121
:integration_id => String.t | nil,
2222
:state => String.t,
23-
:action_type => String.t,
23+
:action_type => String.t | nil,
2424
:action_category => String.t,
2525
:result_data => map()
2626
}

lib/docspring/model/create_html_submission_data.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ defmodule Docspring.Model.CreateHtmlSubmissionData do
1616
:html,
1717
:metadata,
1818
:password,
19-
:test
19+
:test,
20+
:version
2021
]
2122

2223
@type t :: %__MODULE__{
@@ -28,7 +29,8 @@ defmodule Docspring.Model.CreateHtmlSubmissionData do
2829
:html => String.t | nil,
2930
:metadata => map() | nil,
3031
:password => String.t | nil,
31-
:test => boolean() | nil
32+
:test => boolean() | nil,
33+
:version => String.t | nil
3234
}
3335

3436
def decode(value) do

lib/docspring/model/create_pdf_submission_data.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ defmodule Docspring.Model.CreatePdfSubmissionData do
1515
:field_overrides,
1616
:metadata,
1717
:password,
18-
:test
18+
:test,
19+
:version
1920
]
2021

2122
@type t :: %__MODULE__{
@@ -26,7 +27,8 @@ defmodule Docspring.Model.CreatePdfSubmissionData do
2627
:field_overrides => map() | nil,
2728
:metadata => map() | nil,
2829
:password => String.t | nil,
29-
:test => boolean() | nil
30+
:test => boolean() | nil,
31+
:version => String.t | nil
3032
}
3133

3234
alias Docspring.Deserializer
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator 7.11.0 (https://openapi-generator.tech).
2+
# Do not edit this file manually.
3+
4+
defmodule Docspring.Model.PublishVersionData do
5+
@moduledoc """
6+
7+
"""
8+
9+
@derive Jason.Encoder
10+
defstruct [
11+
:description,
12+
:version_type
13+
]
14+
15+
@type t :: %__MODULE__{
16+
:description => String.t | nil,
17+
:version_type => String.t
18+
}
19+
20+
def decode(value) do
21+
value
22+
end
23+
end
24+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator 7.11.0 (https://openapi-generator.tech).
2+
# Do not edit this file manually.
3+
4+
defmodule Docspring.Model.RestoreVersionData do
5+
@moduledoc """
6+
7+
"""
8+
9+
@derive Jason.Encoder
10+
defstruct [
11+
:version
12+
]
13+
14+
@type t :: %__MODULE__{
15+
:version => String.t
16+
}
17+
18+
def decode(value) do
19+
value
20+
end
21+
end
22+

lib/docspring/model/submission.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ defmodule Docspring.Model.Submission do
2020
:processed_at,
2121
:state,
2222
:template_id,
23+
:template_type,
24+
:template_version,
2325
:test,
2426
:truncated_text,
2527
:pdf_hash,
@@ -47,6 +49,8 @@ defmodule Docspring.Model.Submission do
4749
:processed_at => String.t | nil,
4850
:state => String.t,
4951
:template_id => String.t | nil,
52+
:template_type => String.t,
53+
:template_version => String.t | nil,
5054
:test => boolean(),
5155
:truncated_text => map() | nil,
5256
:pdf_hash => String.t | nil,

lib/docspring/model/submission_data_request_event.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule Docspring.Model.SubmissionDataRequestEvent do
2222
:submission_id => String.t | nil,
2323
:submission_data_request_id => String.t | nil,
2424
:event_type => String.t,
25-
:message_type => String.t,
25+
:message_type => String.t | nil,
2626
:message_recipient => String.t | nil,
2727
:occurred_at => String.t | nil
2828
}

lib/docspring/model/submission_preview.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ defmodule Docspring.Model.SubmissionPreview do
2020
:processed_at,
2121
:state,
2222
:template_id,
23+
:template_type,
24+
:template_version,
2325
:test,
2426
:truncated_text,
2527
:pdf_hash,
@@ -44,6 +46,8 @@ defmodule Docspring.Model.SubmissionPreview do
4446
:processed_at => String.t | nil,
4547
:state => String.t,
4648
:template_id => String.t | nil,
49+
:template_type => String.t,
50+
:template_version => String.t | nil,
4751
:test => boolean(),
4852
:truncated_text => map() | nil,
4953
:pdf_hash => String.t | nil,

lib/docspring/model/template.ex

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ defmodule Docspring.Model.Template do
4242
:slack_webhook_url,
4343
:template_type,
4444
:updated_at,
45+
:version_published_at,
46+
:version,
4547
:webhook_url,
4648
:demo,
49+
:latest_version,
50+
:last_changed_at,
51+
:last_changed_by_type,
52+
:last_changed_by_id,
4753
:defaults,
4854
:field_order,
4955
:fields,
@@ -53,7 +59,8 @@ defmodule Docspring.Model.Template do
5359
:html,
5460
:predefined_fields,
5561
:scss,
56-
:shared_field_data
62+
:shared_field_data,
63+
:versions
5764
]
5865

5966
@type t :: %__MODULE__{
@@ -91,8 +98,14 @@ defmodule Docspring.Model.Template do
9198
:slack_webhook_url => String.t | nil,
9299
:template_type => String.t,
93100
:updated_at => String.t | nil,
101+
:version_published_at => String.t | nil,
102+
:version => String.t | nil,
94103
:webhook_url => String.t | nil,
95104
:demo => boolean(),
105+
:latest_version => String.t | nil,
106+
:last_changed_at => String.t | nil,
107+
:last_changed_by_type => String.t | nil,
108+
:last_changed_by_id => String.t | nil,
96109
:defaults => map(),
97110
:field_order => [[float()]],
98111
:fields => map(),
@@ -102,7 +115,8 @@ defmodule Docspring.Model.Template do
102115
:html => String.t | nil,
103116
:predefined_fields => [map()],
104117
:scss => String.t | nil,
105-
:shared_field_data => map()
118+
:shared_field_data => map(),
119+
:versions => [map()]
106120
}
107121

108122
def decode(value) do
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator 7.11.0 (https://openapi-generator.tech).
2+
# Do not edit this file manually.
3+
4+
defmodule Docspring.Model.TemplateDeleteResponse do
5+
@moduledoc """
6+
7+
"""
8+
9+
@derive Jason.Encoder
10+
defstruct [
11+
:status,
12+
:errors,
13+
:latest_version,
14+
:versions
15+
]
16+
17+
@type t :: %__MODULE__{
18+
:status => String.t,
19+
:errors => [String.t] | nil,
20+
:latest_version => String.t | nil,
21+
:versions => [map()] | nil
22+
}
23+
24+
def decode(value) do
25+
value
26+
end
27+
end
28+

0 commit comments

Comments
 (0)