Class: Shipeasy::Admin::Generated::ProfilesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/shipeasy_admin/api/profiles_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProfilesApi

Returns a new instance of ProfilesApi.



19
20
21
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_i18n_profile(create_i18n_profile_request, opts = {}) ⇒ CreateI18nProfileResponse

Create an i18n profile Create a locale profile. name is the stable handle (e.g. fr:prod). Use case: Stand up a new locale before seeding its keys.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



28
29
30
31
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 28

def create_i18n_profile(create_i18n_profile_request, opts = {})
  data, _status_code, _headers = create_i18n_profile_with_http_info(create_i18n_profile_request, opts)
  data
end

#create_i18n_profile_with_http_info(create_i18n_profile_request, opts = {}) ⇒ Array<(CreateI18nProfileResponse, Integer, Hash)>

Create an i18n profile Create a locale profile. `name` is the stable handle (e.g. `fr:prod`). Use case: Stand up a new locale before seeding its keys.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

  • (Array<(CreateI18nProfileResponse, Integer, Hash)>)

    CreateI18nProfileResponse data, response status code and response headers



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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 39

def create_i18n_profile_with_http_info(create_i18n_profile_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.create_i18n_profile ...'
  end
  # verify the required parameter 'create_i18n_profile_request' is set
  if @api_client.config.client_side_validation && create_i18n_profile_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_i18n_profile_request' when calling ProfilesApi.create_i18n_profile"
  end
  # resource path
  local_var_path = '/api/admin/i18n/profiles'

  # 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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_i18n_profile_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateI18nProfileResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ProfilesApi.create_i18n_profile",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#create_i18n_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_i18n_profiles(opts = {}) ⇒ Array<ListI18nProfilesResponseInner>

List i18n profiles Returns every locale profile in the project (e.g. en:prod, fr:prod). Use case: Discover which locale profiles exist before pushing keys or publishing a chunk.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



98
99
100
101
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 98

def list_i18n_profiles(opts = {})
  data, _status_code, _headers = list_i18n_profiles_with_http_info(opts)
  data
end

#list_i18n_profiles_with_http_info(opts = {}) ⇒ Array<(Array<ListI18nProfilesResponseInner>, Integer, Hash)>

List i18n profiles Returns every locale profile in the project (e.g. `en:prod`, `fr:prod`). Use case: Discover which locale profiles exist before pushing keys or publishing a chunk.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



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
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 108

def list_i18n_profiles_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.list_i18n_profiles ...'
  end
  # resource path
  local_var_path = '/api/admin/i18n/profiles'

  # 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']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<ListI18nProfilesResponseInner>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ProfilesApi.list_i18n_profiles",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#list_i18n_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_i18n_profile(profile_id, publish_i18n_profile_request, opts = {}) ⇒ PublishI18nProfileResponse

Publish a profile live Publish a profile to the CDN — rebuild its KV snapshot + purge the edge. Publishing is PROFILE-WIDE: the whole profile is snapshotted into one KV blob, so the optional chunk in the body is an audit label only (it does not scope what ships). Use case: Ship the latest translations live after pushing/updating keys.

Parameters:

  • profile_id (String)

    The profile id to publish.

  • publish_i18n_profile_request (PublishI18nProfileRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



160
161
162
163
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 160

def publish_i18n_profile(profile_id, publish_i18n_profile_request, opts = {})
  data, _status_code, _headers = publish_i18n_profile_with_http_info(profile_id, publish_i18n_profile_request, opts)
  data
end

#publish_i18n_profile_with_http_info(profile_id, publish_i18n_profile_request, opts = {}) ⇒ Array<(PublishI18nProfileResponse, Integer, Hash)>

Publish a profile live Publish a profile to the CDN — rebuild its KV snapshot + purge the edge. Publishing is PROFILE-WIDE: the whole profile is snapshotted into one KV blob, so the optional `chunk` in the body is an audit label only (it does not scope what ships). Use case: Ship the latest translations live after pushing/updating keys.

Parameters:

  • profile_id (String)

    The profile id to publish.

  • publish_i18n_profile_request (PublishI18nProfileRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

  • (Array<(PublishI18nProfileResponse, Integer, Hash)>)

    PublishI18nProfileResponse data, response status code and response headers



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/shipeasy_admin/api/profiles_api.rb', line 172

def publish_i18n_profile_with_http_info(profile_id, publish_i18n_profile_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProfilesApi.publish_i18n_profile ...'
  end
  # verify the required parameter 'publish_i18n_profile_request' is set
  if @api_client.config.client_side_validation && publish_i18n_profile_request.nil?
    fail ArgumentError, "Missing the required parameter 'publish_i18n_profile_request' when calling ProfilesApi.publish_i18n_profile"
  end
  # resource path
  local_var_path = '/api/admin/i18n/profiles/{profileId}/publish'.sub('{profileId}', CGI.escape(profile_id.to_s))

  # 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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(publish_i18n_profile_request)

  # return_type
  return_type = opts[:debug_return_type] || 'PublishI18nProfileResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ProfilesApi.publish_i18n_profile",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProfilesApi#publish_i18n_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end