Class: TemplateFox::AccountApi
- Inherits:
-
Object
- Object
- TemplateFox::AccountApi
- Defined in:
- lib/templatefox/api/account_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_account(opts = {}) ⇒ AccountInfoResponse
Get account info Get account information including remaining credits.
-
#get_account_with_http_info(opts = {}) ⇒ Array<(AccountInfoResponse, Integer, Hash)>
Get account info Get account information including remaining credits.
-
#initialize(api_client = ApiClient.default) ⇒ AccountApi
constructor
A new instance of AccountApi.
-
#list_transactions(opts = {}) ⇒ TransactionsResponse
List transactions List transaction history for the authenticated user.
-
#list_transactions_with_http_info(opts = {}) ⇒ Array<(TransactionsResponse, Integer, Hash)>
List transactions List transaction history for the authenticated user.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AccountApi
Returns a new instance of AccountApi.
19 20 21 |
# File 'lib/templatefox/api/account_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/templatefox/api/account_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_account(opts = {}) ⇒ AccountInfoResponse
Get account info 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. **Rate Limits:** 60 requests/min (free), 120 requests/min (paid). Headers included in response.
26 27 28 29 |
# File 'lib/templatefox/api/account_api.rb', line 26 def get_account(opts = {}) data, _status_code, _headers = get_account_with_http_info(opts) data end |
#get_account_with_http_info(opts = {}) ⇒ Array<(AccountInfoResponse, Integer, Hash)>
Get account info 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. **Rate Limits:** 60 requests/min (free), 120 requests/min (paid). Headers included in response.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/templatefox/api/account_api.rb', line 35 def get_account_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountApi.get_account ...' end # resource path local_var_path = '/v1/account' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AccountInfoResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth'] = opts.merge( :operation => :"AccountApi.get_account", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AccountApi#get_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_transactions(opts = {}) ⇒ TransactionsResponse
List transactions 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. **Rate Limits:** 60 requests/min (free), 120 requests/min (paid). Headers included in response.
85 86 87 88 |
# File 'lib/templatefox/api/account_api.rb', line 85 def list_transactions(opts = {}) data, _status_code, _headers = list_transactions_with_http_info(opts) data end |
#list_transactions_with_http_info(opts = {}) ⇒ Array<(TransactionsResponse, Integer, Hash)>
List transactions 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. **Rate Limits:** 60 requests/min (free), 120 requests/min (paid). Headers included in response.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/templatefox/api/account_api.rb', line 96 def list_transactions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountApi.list_transactions ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccountApi.list_transactions, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccountApi.list_transactions, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0 fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling AccountApi.list_transactions, must be greater than or equal to 0.' end # resource path local_var_path = '/v1/account/transactions' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TransactionsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth'] = opts.merge( :operation => :"AccountApi.list_transactions", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AccountApi#list_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |