templatefox 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +206 -0
- data/Rakefile +10 -0
- data/docs/AccountApi.md +152 -0
- data/docs/AccountInfoResponse.md +20 -0
- data/docs/CreatePdfRequest.md +32 -0
- data/docs/CreatePdfResponse.md +24 -0
- data/docs/ExportType.md +15 -0
- data/docs/HTTPValidationError.md +18 -0
- data/docs/IntegrationsApi.md +286 -0
- data/docs/LocationInner.md +15 -0
- data/docs/PDFApi.md +79 -0
- data/docs/S3ConfigRequest.md +26 -0
- data/docs/S3ConfigResponse.md +28 -0
- data/docs/S3SuccessResponse.md +18 -0
- data/docs/S3TestResponse.md +20 -0
- data/docs/TemplateField.md +26 -0
- data/docs/TemplateListItem.md +24 -0
- data/docs/TemplatesApi.md +148 -0
- data/docs/TemplatesListResponse.md +18 -0
- data/docs/Transaction.md +28 -0
- data/docs/TransactionsResponse.md +24 -0
- data/docs/ValidationError.md +22 -0
- data/git_push.sh +57 -0
- data/lib/templatefox/api/account_api.rb +154 -0
- data/lib/templatefox/api/integrations_api.rb +261 -0
- data/lib/templatefox/api/pdf_api.rb +90 -0
- data/lib/templatefox/api/templates_api.rb +142 -0
- data/lib/templatefox/api_client.rb +397 -0
- data/lib/templatefox/api_error.rb +58 -0
- data/lib/templatefox/api_model_base.rb +88 -0
- data/lib/templatefox/configuration.rb +308 -0
- data/lib/templatefox/models/account_info_response.rb +176 -0
- data/lib/templatefox/models/create_pdf_request.rb +414 -0
- data/lib/templatefox/models/create_pdf_response.rb +247 -0
- data/lib/templatefox/models/export_type.rb +40 -0
- data/lib/templatefox/models/http_validation_error.rb +149 -0
- data/lib/templatefox/models/location_inner.rb +103 -0
- data/lib/templatefox/models/s3_config_request.rb +372 -0
- data/lib/templatefox/models/s3_config_response.rb +301 -0
- data/lib/templatefox/models/s3_success_response.rb +166 -0
- data/lib/templatefox/models/s3_test_response.rb +193 -0
- data/lib/templatefox/models/template_field.rb +227 -0
- data/lib/templatefox/models/template_list_item.rb +247 -0
- data/lib/templatefox/models/templates_list_response.rb +167 -0
- data/lib/templatefox/models/transaction.rb +267 -0
- data/lib/templatefox/models/transactions_response.rb +248 -0
- data/lib/templatefox/models/validation_error.rb +218 -0
- data/lib/templatefox/version.rb +15 -0
- data/lib/templatefox.rb +60 -0
- data/spec/api/account_api_spec.rb +59 -0
- data/spec/api/integrations_api_spec.rb +80 -0
- data/spec/api/pdf_api_spec.rb +47 -0
- data/spec/api/templates_api_spec.rb +58 -0
- data/spec/models/account_info_response_spec.rb +42 -0
- data/spec/models/create_pdf_request_spec.rb +78 -0
- data/spec/models/create_pdf_response_spec.rb +54 -0
- data/spec/models/export_type_spec.rb +30 -0
- data/spec/models/http_validation_error_spec.rb +36 -0
- data/spec/models/location_inner_spec.rb +21 -0
- data/spec/models/s3_config_request_spec.rb +60 -0
- data/spec/models/s3_config_response_spec.rb +66 -0
- data/spec/models/s3_success_response_spec.rb +36 -0
- data/spec/models/s3_test_response_spec.rb +42 -0
- data/spec/models/template_field_spec.rb +60 -0
- data/spec/models/template_list_item_spec.rb +54 -0
- data/spec/models/templates_list_response_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +66 -0
- data/spec/models/transactions_response_spec.rb +54 -0
- data/spec/models/validation_error_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- data/templatefox.gemspec +39 -0
- metadata +177 -0
data/docs/Transaction.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# TemplateFox::Transaction
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **transaction_ref** | **String** | Unique transaction reference (UUID) | |
|
|
8
|
+
| **transaction_type** | **String** | Transaction type: PDFGEN, PURCHASE, REFUND, BONUS | |
|
|
9
|
+
| **template_id** | **String** | | [optional] |
|
|
10
|
+
| **exec_tm** | **Integer** | | [optional] |
|
|
11
|
+
| **credits** | **Integer** | Credits consumed (positive) or added (negative) | |
|
|
12
|
+
| **created_at** | **String** | ISO 8601 timestamp | |
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
require 'templatefox'
|
|
18
|
+
|
|
19
|
+
instance = TemplateFox::Transaction.new(
|
|
20
|
+
transaction_ref: null,
|
|
21
|
+
transaction_type: null,
|
|
22
|
+
template_id: null,
|
|
23
|
+
exec_tm: null,
|
|
24
|
+
credits: null,
|
|
25
|
+
created_at: null
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# TemplateFox::TransactionsResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **transactions** | [**Array<Transaction>**](Transaction.md) | | |
|
|
8
|
+
| **total** | **Integer** | Total number of transactions | |
|
|
9
|
+
| **limit** | **Integer** | Number of records returned | |
|
|
10
|
+
| **offset** | **Integer** | Number of records skipped | |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'templatefox'
|
|
16
|
+
|
|
17
|
+
instance = TemplateFox::TransactionsResponse.new(
|
|
18
|
+
transactions: null,
|
|
19
|
+
total: null,
|
|
20
|
+
limit: null,
|
|
21
|
+
offset: null
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# TemplateFox::ValidationError
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **loc** | [**Array<LocationInner>**](LocationInner.md) | | |
|
|
8
|
+
| **msg** | **String** | | |
|
|
9
|
+
| **type** | **String** | | |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'templatefox'
|
|
15
|
+
|
|
16
|
+
instance = TemplateFox::ValidationError.new(
|
|
17
|
+
loc: null,
|
|
18
|
+
msg: null,
|
|
19
|
+
type: null
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
data/git_push.sh
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
3
|
+
#
|
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
5
|
+
|
|
6
|
+
git_user_id=$1
|
|
7
|
+
git_repo_id=$2
|
|
8
|
+
release_note=$3
|
|
9
|
+
git_host=$4
|
|
10
|
+
|
|
11
|
+
if [ "$git_host" = "" ]; then
|
|
12
|
+
git_host="github.com"
|
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
|
17
|
+
git_user_id="TemplateFoxPDF"
|
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
|
22
|
+
git_repo_id="rubysdk"
|
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ "$release_note" = "" ]; then
|
|
27
|
+
release_note="Minor update"
|
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Initialize the local directory as a Git repository
|
|
32
|
+
git init
|
|
33
|
+
|
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
|
35
|
+
git add .
|
|
36
|
+
|
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
38
|
+
git commit -m "$release_note"
|
|
39
|
+
|
|
40
|
+
# Sets the new remote
|
|
41
|
+
git_remote=$(git remote)
|
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
43
|
+
|
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
47
|
+
else
|
|
48
|
+
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
git pull origin master
|
|
54
|
+
|
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TemplateFox API
|
|
3
|
+
|
|
4
|
+
#Generate PDFs from HTML templates via API. Design once, generate thousands.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module TemplateFox
|
|
16
|
+
class AccountApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Get account info
|
|
23
|
+
# Get account information including remaining credits. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** Check credit balance before performing operations. **No credits consumed:** This is a read-only endpoint.
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @return [AccountInfoResponse]
|
|
26
|
+
def get_account(opts = {})
|
|
27
|
+
data, _status_code, _headers = get_account_with_http_info(opts)
|
|
28
|
+
data
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Get account info
|
|
32
|
+
# Get account information including remaining credits. **Authentication:** API Key required (`x-api-key` header) or JWT token **Usage:** Check credit balance before performing operations. **No credits consumed:** This is a read-only endpoint.
|
|
33
|
+
# @param [Hash] opts the optional parameters
|
|
34
|
+
# @return [Array<(AccountInfoResponse, Integer, Hash)>] AccountInfoResponse data, response status code and response headers
|
|
35
|
+
def get_account_with_http_info(opts = {})
|
|
36
|
+
if @api_client.config.debugging
|
|
37
|
+
@api_client.config.logger.debug 'Calling API: AccountApi.get_account ...'
|
|
38
|
+
end
|
|
39
|
+
# resource path
|
|
40
|
+
local_var_path = '/v1/account'
|
|
41
|
+
|
|
42
|
+
# query parameters
|
|
43
|
+
query_params = opts[:query_params] || {}
|
|
44
|
+
|
|
45
|
+
# header parameters
|
|
46
|
+
header_params = opts[:header_params] || {}
|
|
47
|
+
# HTTP header 'Accept' (if needed)
|
|
48
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
49
|
+
|
|
50
|
+
# form parameters
|
|
51
|
+
form_params = opts[:form_params] || {}
|
|
52
|
+
|
|
53
|
+
# http body (model)
|
|
54
|
+
post_body = opts[:debug_body]
|
|
55
|
+
|
|
56
|
+
# return_type
|
|
57
|
+
return_type = opts[:debug_return_type] || 'AccountInfoResponse'
|
|
58
|
+
|
|
59
|
+
# auth_names
|
|
60
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
61
|
+
|
|
62
|
+
new_options = opts.merge(
|
|
63
|
+
:operation => :"AccountApi.get_account",
|
|
64
|
+
:header_params => header_params,
|
|
65
|
+
:query_params => query_params,
|
|
66
|
+
:form_params => form_params,
|
|
67
|
+
:body => post_body,
|
|
68
|
+
:auth_names => auth_names,
|
|
69
|
+
:return_type => return_type
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
73
|
+
if @api_client.config.debugging
|
|
74
|
+
@api_client.config.logger.debug "API called: AccountApi#get_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
75
|
+
end
|
|
76
|
+
return data, status_code, headers
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# List transactions
|
|
80
|
+
# List transaction history for the authenticated user. **Authentication:** API Key required (`x-api-key` header) or JWT token **Pagination:** Use `limit` and `offset` query parameters. **Transaction types:** - `PDFGEN`: PDF generation (consumes credits) - `REFUND`: Credit refund (on failed generation) - `PURCHASE`: Credit purchase - `BONUS`: Bonus credits **Credits field:** - Positive value = credits consumed - Negative value = credits added **No credits consumed:** This is a read-only endpoint.
|
|
81
|
+
# @param [Hash] opts the optional parameters
|
|
82
|
+
# @option opts [Integer] :limit Number of records to return (default to 300)
|
|
83
|
+
# @option opts [Integer] :offset Number of records to skip (default to 0)
|
|
84
|
+
# @return [TransactionsResponse]
|
|
85
|
+
def list_transactions(opts = {})
|
|
86
|
+
data, _status_code, _headers = list_transactions_with_http_info(opts)
|
|
87
|
+
data
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# List transactions
|
|
91
|
+
# List transaction history for the authenticated user. **Authentication:** API Key required (`x-api-key` header) or JWT token **Pagination:** Use `limit` and `offset` query parameters. **Transaction types:** - `PDFGEN`: PDF generation (consumes credits) - `REFUND`: Credit refund (on failed generation) - `PURCHASE`: Credit purchase - `BONUS`: Bonus credits **Credits field:** - Positive value = credits consumed - Negative value = credits added **No credits consumed:** This is a read-only endpoint.
|
|
92
|
+
# @param [Hash] opts the optional parameters
|
|
93
|
+
# @option opts [Integer] :limit Number of records to return (default to 300)
|
|
94
|
+
# @option opts [Integer] :offset Number of records to skip (default to 0)
|
|
95
|
+
# @return [Array<(TransactionsResponse, Integer, Hash)>] TransactionsResponse data, response status code and response headers
|
|
96
|
+
def list_transactions_with_http_info(opts = {})
|
|
97
|
+
if @api_client.config.debugging
|
|
98
|
+
@api_client.config.logger.debug 'Calling API: AccountApi.list_transactions ...'
|
|
99
|
+
end
|
|
100
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
|
|
101
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccountApi.list_transactions, must be smaller than or equal to 1000.'
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
105
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccountApi.list_transactions, must be greater than or equal to 1.'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
|
109
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling AccountApi.list_transactions, must be greater than or equal to 0.'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# resource path
|
|
113
|
+
local_var_path = '/v1/account/transactions'
|
|
114
|
+
|
|
115
|
+
# query parameters
|
|
116
|
+
query_params = opts[:query_params] || {}
|
|
117
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
118
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
119
|
+
|
|
120
|
+
# header parameters
|
|
121
|
+
header_params = opts[:header_params] || {}
|
|
122
|
+
# HTTP header 'Accept' (if needed)
|
|
123
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
124
|
+
|
|
125
|
+
# form parameters
|
|
126
|
+
form_params = opts[:form_params] || {}
|
|
127
|
+
|
|
128
|
+
# http body (model)
|
|
129
|
+
post_body = opts[:debug_body]
|
|
130
|
+
|
|
131
|
+
# return_type
|
|
132
|
+
return_type = opts[:debug_return_type] || 'TransactionsResponse'
|
|
133
|
+
|
|
134
|
+
# auth_names
|
|
135
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
136
|
+
|
|
137
|
+
new_options = opts.merge(
|
|
138
|
+
:operation => :"AccountApi.list_transactions",
|
|
139
|
+
:header_params => header_params,
|
|
140
|
+
:query_params => query_params,
|
|
141
|
+
:form_params => form_params,
|
|
142
|
+
:body => post_body,
|
|
143
|
+
:auth_names => auth_names,
|
|
144
|
+
:return_type => return_type
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
148
|
+
if @api_client.config.debugging
|
|
149
|
+
@api_client.config.logger.debug "API called: AccountApi#list_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
150
|
+
end
|
|
151
|
+
return data, status_code, headers
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TemplateFox API
|
|
3
|
+
|
|
4
|
+
#Generate PDFs from HTML templates via API. Design once, generate thousands.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module TemplateFox
|
|
16
|
+
class IntegrationsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Delete S3 configuration
|
|
23
|
+
# Delete S3 storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Remove your S3 integration. Generated PDFs will use the default CDN storage after deletion. **Warning:** This action is irreversible. You'll need to reconfigure S3 to use it again. **No credits consumed:** This is a configuration endpoint.
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @return [S3SuccessResponse]
|
|
26
|
+
def delete_s3_config(opts = {})
|
|
27
|
+
data, _status_code, _headers = delete_s3_config_with_http_info(opts)
|
|
28
|
+
data
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Delete S3 configuration
|
|
32
|
+
# Delete S3 storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Remove your S3 integration. Generated PDFs will use the default CDN storage after deletion. **Warning:** This action is irreversible. You'll need to reconfigure S3 to use it again. **No credits consumed:** This is a configuration endpoint.
|
|
33
|
+
# @param [Hash] opts the optional parameters
|
|
34
|
+
# @return [Array<(S3SuccessResponse, Integer, Hash)>] S3SuccessResponse data, response status code and response headers
|
|
35
|
+
def delete_s3_config_with_http_info(opts = {})
|
|
36
|
+
if @api_client.config.debugging
|
|
37
|
+
@api_client.config.logger.debug 'Calling API: IntegrationsApi.delete_s3_config ...'
|
|
38
|
+
end
|
|
39
|
+
# resource path
|
|
40
|
+
local_var_path = '/v1/integrations/s3'
|
|
41
|
+
|
|
42
|
+
# query parameters
|
|
43
|
+
query_params = opts[:query_params] || {}
|
|
44
|
+
|
|
45
|
+
# header parameters
|
|
46
|
+
header_params = opts[:header_params] || {}
|
|
47
|
+
# HTTP header 'Accept' (if needed)
|
|
48
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
49
|
+
|
|
50
|
+
# form parameters
|
|
51
|
+
form_params = opts[:form_params] || {}
|
|
52
|
+
|
|
53
|
+
# http body (model)
|
|
54
|
+
post_body = opts[:debug_body]
|
|
55
|
+
|
|
56
|
+
# return_type
|
|
57
|
+
return_type = opts[:debug_return_type] || 'S3SuccessResponse'
|
|
58
|
+
|
|
59
|
+
# auth_names
|
|
60
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
61
|
+
|
|
62
|
+
new_options = opts.merge(
|
|
63
|
+
:operation => :"IntegrationsApi.delete_s3_config",
|
|
64
|
+
:header_params => header_params,
|
|
65
|
+
:query_params => query_params,
|
|
66
|
+
:form_params => form_params,
|
|
67
|
+
:body => post_body,
|
|
68
|
+
:auth_names => auth_names,
|
|
69
|
+
:return_type => return_type
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
73
|
+
if @api_client.config.debugging
|
|
74
|
+
@api_client.config.logger.debug "API called: IntegrationsApi#delete_s3_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
75
|
+
end
|
|
76
|
+
return data, status_code, headers
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Get S3 configuration
|
|
80
|
+
# Get current S3 storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Retrieve your S3 integration settings. Secret access key is masked for security. **Returns 404** if S3 is not configured. **No credits consumed:** This is a read-only endpoint.
|
|
81
|
+
# @param [Hash] opts the optional parameters
|
|
82
|
+
# @return [S3ConfigResponse]
|
|
83
|
+
def get_s3_config(opts = {})
|
|
84
|
+
data, _status_code, _headers = get_s3_config_with_http_info(opts)
|
|
85
|
+
data
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Get S3 configuration
|
|
89
|
+
# Get current S3 storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Retrieve your S3 integration settings. Secret access key is masked for security. **Returns 404** if S3 is not configured. **No credits consumed:** This is a read-only endpoint.
|
|
90
|
+
# @param [Hash] opts the optional parameters
|
|
91
|
+
# @return [Array<(S3ConfigResponse, Integer, Hash)>] S3ConfigResponse data, response status code and response headers
|
|
92
|
+
def get_s3_config_with_http_info(opts = {})
|
|
93
|
+
if @api_client.config.debugging
|
|
94
|
+
@api_client.config.logger.debug 'Calling API: IntegrationsApi.get_s3_config ...'
|
|
95
|
+
end
|
|
96
|
+
# resource path
|
|
97
|
+
local_var_path = '/v1/integrations/s3'
|
|
98
|
+
|
|
99
|
+
# query parameters
|
|
100
|
+
query_params = opts[:query_params] || {}
|
|
101
|
+
|
|
102
|
+
# header parameters
|
|
103
|
+
header_params = opts[:header_params] || {}
|
|
104
|
+
# HTTP header 'Accept' (if needed)
|
|
105
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
106
|
+
|
|
107
|
+
# form parameters
|
|
108
|
+
form_params = opts[:form_params] || {}
|
|
109
|
+
|
|
110
|
+
# http body (model)
|
|
111
|
+
post_body = opts[:debug_body]
|
|
112
|
+
|
|
113
|
+
# return_type
|
|
114
|
+
return_type = opts[:debug_return_type] || 'S3ConfigResponse'
|
|
115
|
+
|
|
116
|
+
# auth_names
|
|
117
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
118
|
+
|
|
119
|
+
new_options = opts.merge(
|
|
120
|
+
:operation => :"IntegrationsApi.get_s3_config",
|
|
121
|
+
:header_params => header_params,
|
|
122
|
+
:query_params => query_params,
|
|
123
|
+
:form_params => form_params,
|
|
124
|
+
:body => post_body,
|
|
125
|
+
:auth_names => auth_names,
|
|
126
|
+
:return_type => return_type
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
130
|
+
if @api_client.config.debugging
|
|
131
|
+
@api_client.config.logger.debug "API called: IntegrationsApi#get_s3_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
132
|
+
end
|
|
133
|
+
return data, status_code, headers
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Save S3 configuration
|
|
137
|
+
# Save or update S3-compatible storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Configure your S3-compatible storage to receive generated PDFs directly in your own bucket instead of the default CDN. **Supported providers:** - Amazon S3 - DigitalOcean Spaces - Cloudflare R2 - MinIO - Any S3-compatible storage **Secret key behavior:** - For new configuration: `secret_access_key` is required - For updates: Omit `secret_access_key` to keep existing value **No credits consumed:** This is a configuration endpoint.
|
|
138
|
+
# @param s3_config_request [S3ConfigRequest]
|
|
139
|
+
# @param [Hash] opts the optional parameters
|
|
140
|
+
# @return [S3SuccessResponse]
|
|
141
|
+
def save_s3_config(s3_config_request, opts = {})
|
|
142
|
+
data, _status_code, _headers = save_s3_config_with_http_info(s3_config_request, opts)
|
|
143
|
+
data
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Save S3 configuration
|
|
147
|
+
# Save or update S3-compatible storage configuration. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Configure your S3-compatible storage to receive generated PDFs directly in your own bucket instead of the default CDN. **Supported providers:** - Amazon S3 - DigitalOcean Spaces - Cloudflare R2 - MinIO - Any S3-compatible storage **Secret key behavior:** - For new configuration: `secret_access_key` is required - For updates: Omit `secret_access_key` to keep existing value **No credits consumed:** This is a configuration endpoint.
|
|
148
|
+
# @param s3_config_request [S3ConfigRequest]
|
|
149
|
+
# @param [Hash] opts the optional parameters
|
|
150
|
+
# @return [Array<(S3SuccessResponse, Integer, Hash)>] S3SuccessResponse data, response status code and response headers
|
|
151
|
+
def save_s3_config_with_http_info(s3_config_request, opts = {})
|
|
152
|
+
if @api_client.config.debugging
|
|
153
|
+
@api_client.config.logger.debug 'Calling API: IntegrationsApi.save_s3_config ...'
|
|
154
|
+
end
|
|
155
|
+
# verify the required parameter 's3_config_request' is set
|
|
156
|
+
if @api_client.config.client_side_validation && s3_config_request.nil?
|
|
157
|
+
fail ArgumentError, "Missing the required parameter 's3_config_request' when calling IntegrationsApi.save_s3_config"
|
|
158
|
+
end
|
|
159
|
+
# resource path
|
|
160
|
+
local_var_path = '/v1/integrations/s3'
|
|
161
|
+
|
|
162
|
+
# query parameters
|
|
163
|
+
query_params = opts[:query_params] || {}
|
|
164
|
+
|
|
165
|
+
# header parameters
|
|
166
|
+
header_params = opts[:header_params] || {}
|
|
167
|
+
# HTTP header 'Accept' (if needed)
|
|
168
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
169
|
+
# HTTP header 'Content-Type'
|
|
170
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
171
|
+
if !content_type.nil?
|
|
172
|
+
header_params['Content-Type'] = content_type
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# form parameters
|
|
176
|
+
form_params = opts[:form_params] || {}
|
|
177
|
+
|
|
178
|
+
# http body (model)
|
|
179
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(s3_config_request)
|
|
180
|
+
|
|
181
|
+
# return_type
|
|
182
|
+
return_type = opts[:debug_return_type] || 'S3SuccessResponse'
|
|
183
|
+
|
|
184
|
+
# auth_names
|
|
185
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
186
|
+
|
|
187
|
+
new_options = opts.merge(
|
|
188
|
+
:operation => :"IntegrationsApi.save_s3_config",
|
|
189
|
+
:header_params => header_params,
|
|
190
|
+
:query_params => query_params,
|
|
191
|
+
:form_params => form_params,
|
|
192
|
+
:body => post_body,
|
|
193
|
+
:auth_names => auth_names,
|
|
194
|
+
:return_type => return_type
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
198
|
+
if @api_client.config.debugging
|
|
199
|
+
@api_client.config.logger.debug "API called: IntegrationsApi#save_s3_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
200
|
+
end
|
|
201
|
+
return data, status_code, headers
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Test S3 connection
|
|
205
|
+
# Test S3 connection with stored credentials. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Verify your S3 configuration is working correctly. The test will: 1. Connect to the endpoint 2. Verify bucket access 3. Check write permissions by uploading a small test file **Prerequisite:** S3 must be configured first using `POST /v1/integrations/s3` **No credits consumed:** This is a diagnostic endpoint.
|
|
206
|
+
# @param [Hash] opts the optional parameters
|
|
207
|
+
# @return [S3TestResponse]
|
|
208
|
+
def test_s3_connection(opts = {})
|
|
209
|
+
data, _status_code, _headers = test_s3_connection_with_http_info(opts)
|
|
210
|
+
data
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Test S3 connection
|
|
214
|
+
# Test S3 connection with stored credentials. **Authentication:** API Key required (`x-api-key` header) with admin privileges **Usage:** Verify your S3 configuration is working correctly. The test will: 1. Connect to the endpoint 2. Verify bucket access 3. Check write permissions by uploading a small test file **Prerequisite:** S3 must be configured first using `POST /v1/integrations/s3` **No credits consumed:** This is a diagnostic endpoint.
|
|
215
|
+
# @param [Hash] opts the optional parameters
|
|
216
|
+
# @return [Array<(S3TestResponse, Integer, Hash)>] S3TestResponse data, response status code and response headers
|
|
217
|
+
def test_s3_connection_with_http_info(opts = {})
|
|
218
|
+
if @api_client.config.debugging
|
|
219
|
+
@api_client.config.logger.debug 'Calling API: IntegrationsApi.test_s3_connection ...'
|
|
220
|
+
end
|
|
221
|
+
# resource path
|
|
222
|
+
local_var_path = '/v1/integrations/s3/test'
|
|
223
|
+
|
|
224
|
+
# query parameters
|
|
225
|
+
query_params = opts[:query_params] || {}
|
|
226
|
+
|
|
227
|
+
# header parameters
|
|
228
|
+
header_params = opts[:header_params] || {}
|
|
229
|
+
# HTTP header 'Accept' (if needed)
|
|
230
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
231
|
+
|
|
232
|
+
# form parameters
|
|
233
|
+
form_params = opts[:form_params] || {}
|
|
234
|
+
|
|
235
|
+
# http body (model)
|
|
236
|
+
post_body = opts[:debug_body]
|
|
237
|
+
|
|
238
|
+
# return_type
|
|
239
|
+
return_type = opts[:debug_return_type] || 'S3TestResponse'
|
|
240
|
+
|
|
241
|
+
# auth_names
|
|
242
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
243
|
+
|
|
244
|
+
new_options = opts.merge(
|
|
245
|
+
:operation => :"IntegrationsApi.test_s3_connection",
|
|
246
|
+
:header_params => header_params,
|
|
247
|
+
:query_params => query_params,
|
|
248
|
+
:form_params => form_params,
|
|
249
|
+
:body => post_body,
|
|
250
|
+
:auth_names => auth_names,
|
|
251
|
+
:return_type => return_type
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
255
|
+
if @api_client.config.debugging
|
|
256
|
+
@api_client.config.logger.debug "API called: IntegrationsApi#test_s3_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
257
|
+
end
|
|
258
|
+
return data, status_code, headers
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TemplateFox API
|
|
3
|
+
|
|
4
|
+
#Generate PDFs from HTML templates via API. Design once, generate thousands.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module TemplateFox
|
|
16
|
+
class PDFApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Generate PDF from template
|
|
23
|
+
# Generate a PDF from a saved template with dynamic data. **Authentication:** API Key required (`x-api-key` header) ## Request Body | Field | Type | Required | Description | |-------|------|----------|-------------| | `template_id` | string | ✅ Yes | Template short ID (12 characters) | | `data` | object | ✅ Yes | Key-value data to render in template | | `export_type` | string | No | `url` (default) or `binary` | | `expiration` | integer | No | URL expiration in seconds (60-604800, default: 86400) | ## Export Types - `url` (default): PDF is uploaded to CDN, returns JSON with URL - `binary`: Returns raw PDF bytes directly **Credits:** 1 credit deducted per successful generation.
|
|
24
|
+
# @param create_pdf_request [CreatePdfRequest]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @return [CreatePdfResponse]
|
|
27
|
+
def create_pdf(create_pdf_request, opts = {})
|
|
28
|
+
data, _status_code, _headers = create_pdf_with_http_info(create_pdf_request, opts)
|
|
29
|
+
data
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Generate PDF from template
|
|
33
|
+
# Generate a PDF from a saved template with dynamic data. **Authentication:** API Key required (`x-api-key` header) ## Request Body | Field | Type | Required | Description | |-------|------|----------|-------------| | `template_id` | string | ✅ Yes | Template short ID (12 characters) | | `data` | object | ✅ Yes | Key-value data to render in template | | `export_type` | string | No | `url` (default) or `binary` | | `expiration` | integer | No | URL expiration in seconds (60-604800, default: 86400) | ## Export Types - `url` (default): PDF is uploaded to CDN, returns JSON with URL - `binary`: Returns raw PDF bytes directly **Credits:** 1 credit deducted per successful generation.
|
|
34
|
+
# @param create_pdf_request [CreatePdfRequest]
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(CreatePdfResponse, Integer, Hash)>] CreatePdfResponse data, response status code and response headers
|
|
37
|
+
def create_pdf_with_http_info(create_pdf_request, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.create_pdf ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'create_pdf_request' is set
|
|
42
|
+
if @api_client.config.client_side_validation && create_pdf_request.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'create_pdf_request' when calling PDFApi.create_pdf"
|
|
44
|
+
end
|
|
45
|
+
# resource path
|
|
46
|
+
local_var_path = '/v1/pdf/create'
|
|
47
|
+
|
|
48
|
+
# query parameters
|
|
49
|
+
query_params = opts[:query_params] || {}
|
|
50
|
+
|
|
51
|
+
# header parameters
|
|
52
|
+
header_params = opts[:header_params] || {}
|
|
53
|
+
# HTTP header 'Accept' (if needed)
|
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
55
|
+
# HTTP header 'Content-Type'
|
|
56
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
57
|
+
if !content_type.nil?
|
|
58
|
+
header_params['Content-Type'] = content_type
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# form parameters
|
|
62
|
+
form_params = opts[:form_params] || {}
|
|
63
|
+
|
|
64
|
+
# http body (model)
|
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_pdf_request)
|
|
66
|
+
|
|
67
|
+
# return_type
|
|
68
|
+
return_type = opts[:debug_return_type] || 'CreatePdfResponse'
|
|
69
|
+
|
|
70
|
+
# auth_names
|
|
71
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
72
|
+
|
|
73
|
+
new_options = opts.merge(
|
|
74
|
+
:operation => :"PDFApi.create_pdf",
|
|
75
|
+
:header_params => header_params,
|
|
76
|
+
:query_params => query_params,
|
|
77
|
+
:form_params => form_params,
|
|
78
|
+
:body => post_body,
|
|
79
|
+
:auth_names => auth_names,
|
|
80
|
+
:return_type => return_type
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
84
|
+
if @api_client.config.debugging
|
|
85
|
+
@api_client.config.logger.debug "API called: PDFApi#create_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
86
|
+
end
|
|
87
|
+
return data, status_code, headers
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|