From 0e0bb0765563e58c425ebc5661f0dea466e17ce9 Mon Sep 17 00:00:00 2001 From: Phrase Date: Wed, 17 Apr 2024 08:29:02 +0000 Subject: [PATCH] Deploying from phrase/openapi@0bd17562 --- .openapi-generator/FILES | 18 + README.md | 12 + docs/KeyCreateParameters.md | 2 +- docs/KeyUpdateParameters.md | 2 +- docs/ProjectCreateParameters.md | 2 +- docs/ProjectUpdateParameters.md | 2 +- docs/RepoSync.md | 33 ++ docs/RepoSyncEvent.md | 27 + docs/RepoSyncEventErrorsInner.md | 16 + docs/RepoSyncExport.md | 17 + docs/RepoSyncImport.md | 17 + docs/RepoSyncsApi.md | 454 ++++++++++++++++ docs/ScreenshotUpdateParameters.md | 2 +- lib/phrase.rb | 6 + lib/phrase/api/repo_syncs_api.rb | 508 ++++++++++++++++++ lib/phrase/models/repo_sync.rb | 268 +++++++++ lib/phrase/models/repo_sync_event.rb | 292 ++++++++++ .../models/repo_sync_event_errors_inner.rb | 207 +++++++ lib/phrase/models/repo_sync_export.rb | 196 +++++++ lib/phrase/models/repo_sync_import.rb | 196 +++++++ spec/api/repo_syncs_api_spec.rb | 120 +++++ .../repo_sync_event_errors_inner_spec.rb | 23 + spec/models/repo_sync_event_spec.rb | 67 +++ spec/models/repo_sync_export_spec.rb | 29 + spec/models/repo_sync_import_spec.rb | 29 + spec/models/repo_sync_spec.rb | 77 +++ 26 files changed, 2617 insertions(+), 5 deletions(-) create mode 100644 docs/RepoSync.md create mode 100644 docs/RepoSyncEvent.md create mode 100644 docs/RepoSyncEventErrorsInner.md create mode 100644 docs/RepoSyncExport.md create mode 100644 docs/RepoSyncImport.md create mode 100644 docs/RepoSyncsApi.md create mode 100644 lib/phrase/api/repo_syncs_api.rb create mode 100644 lib/phrase/models/repo_sync.rb create mode 100644 lib/phrase/models/repo_sync_event.rb create mode 100644 lib/phrase/models/repo_sync_event_errors_inner.rb create mode 100644 lib/phrase/models/repo_sync_export.rb create mode 100644 lib/phrase/models/repo_sync_import.rb create mode 100644 spec/api/repo_syncs_api_spec.rb create mode 100644 spec/models/repo_sync_event_errors_inner_spec.rb create mode 100644 spec/models/repo_sync_event_spec.rb create mode 100644 spec/models/repo_sync_export_spec.rb create mode 100644 spec/models/repo_sync_import_spec.rb create mode 100644 spec/models/repo_sync_spec.rb diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index fb1351f..a737a0e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -196,6 +196,12 @@ docs/ReleasePreview.md docs/ReleaseUpdateParameters.md docs/ReleasesApi.md docs/RepliesListParameters.md +docs/RepoSync.md +docs/RepoSyncEvent.md +docs/RepoSyncEventErrorsInner.md +docs/RepoSyncExport.md +docs/RepoSyncImport.md +docs/RepoSyncsApi.md docs/ReportsApi.md docs/Screenshot.md docs/ScreenshotMarker.md @@ -312,6 +318,7 @@ lib/phrase/api/organization_job_templates_api.rb lib/phrase/api/projects_api.rb lib/phrase/api/quality_performance_score_api.rb lib/phrase/api/releases_api.rb +lib/phrase/api/repo_syncs_api.rb lib/phrase/api/reports_api.rb lib/phrase/api/screenshot_markers_api.rb lib/phrase/api/screenshots_api.rb @@ -481,6 +488,11 @@ lib/phrase/models/release_create_parameters.rb lib/phrase/models/release_preview.rb lib/phrase/models/release_update_parameters.rb lib/phrase/models/replies_list_parameters.rb +lib/phrase/models/repo_sync.rb +lib/phrase/models/repo_sync_event.rb +lib/phrase/models/repo_sync_event_errors_inner.rb +lib/phrase/models/repo_sync_export.rb +lib/phrase/models/repo_sync_import.rb lib/phrase/models/screenshot.rb lib/phrase/models/screenshot_marker.rb lib/phrase/models/screenshot_marker_create_parameters.rb @@ -581,6 +593,7 @@ spec/api/organization_job_templates_api_spec.rb spec/api/projects_api_spec.rb spec/api/quality_performance_score_api_spec.rb spec/api/releases_api_spec.rb +spec/api/repo_syncs_api_spec.rb spec/api/reports_api_spec.rb spec/api/screenshot_markers_api_spec.rb spec/api/screenshots_api_spec.rb @@ -748,6 +761,11 @@ spec/models/release_preview_spec.rb spec/models/release_spec.rb spec/models/release_update_parameters_spec.rb spec/models/replies_list_parameters_spec.rb +spec/models/repo_sync_event_errors_inner_spec.rb +spec/models/repo_sync_event_spec.rb +spec/models/repo_sync_export_spec.rb +spec/models/repo_sync_import_spec.rb +spec/models/repo_sync_spec.rb spec/models/screenshot_marker_create_parameters_spec.rb spec/models/screenshot_marker_spec.rb spec/models/screenshot_marker_update_parameters_spec.rb diff --git a/README.md b/README.md index 2eebba3..a356e35 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,13 @@ Class | Method | HTTP request | Description *Phrase::ReleasesApi* | [**release_show**](docs/ReleasesApi.md#release_show) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Get a single release *Phrase::ReleasesApi* | [**release_update**](docs/ReleasesApi.md#release_update) | **PATCH** /accounts/{account_id}/distributions/{distribution_id}/releases/{id} | Update a release *Phrase::ReleasesApi* | [**releases_list**](docs/ReleasesApi.md#releases_list) | **GET** /accounts/{account_id}/distributions/{distribution_id}/releases | List releases +*Phrase::RepoSyncsApi* | [**repo_sync_activate**](docs/RepoSyncsApi.md#repo_sync_activate) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/activate | Activate a Repo Sync +*Phrase::RepoSyncsApi* | [**repo_sync_deactivate**](docs/RepoSyncsApi.md#repo_sync_deactivate) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/deactivate | Deactivate a Repo Sync +*Phrase::RepoSyncsApi* | [**repo_sync_events**](docs/RepoSyncsApi.md#repo_sync_events) | **GET** /accounts/{account_id}/repo_syncs/{repo_sync_id}/events | Repository Syncs History +*Phrase::RepoSyncsApi* | [**repo_sync_export**](docs/RepoSyncsApi.md#repo_sync_export) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/export | Export to code repository +*Phrase::RepoSyncsApi* | [**repo_sync_import**](docs/RepoSyncsApi.md#repo_sync_import) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/import | Import from code repository +*Phrase::RepoSyncsApi* | [**repo_sync_list**](docs/RepoSyncsApi.md#repo_sync_list) | **GET** /accounts/{account_id}/repo_syncs | Get Repo Syncs +*Phrase::RepoSyncsApi* | [**repo_sync_show**](docs/RepoSyncsApi.md#repo_sync_show) | **GET** /accounts/{account_id}/repo_syncs/{repo_sync_id} | Get a single Repo Sync *Phrase::ReportsApi* | [**report_locales_list**](docs/ReportsApi.md#report_locales_list) | **GET** /projects/{project_id}/report/locales | List Locale Reports *Phrase::ReportsApi* | [**report_show**](docs/ReportsApi.md#report_show) | **GET** /projects/{project_id}/report | Get Project Report *Phrase::ScreenshotMarkersApi* | [**screenshot_marker_create**](docs/ScreenshotMarkersApi.md#screenshot_marker_create) | **POST** /projects/{project_id}/screenshots/{screenshot_id}/markers | Create a screenshot marker @@ -549,6 +556,11 @@ Class | Method | HTTP request | Description - [Phrase::ReleasePreview](docs/ReleasePreview.md) - [Phrase::ReleaseUpdateParameters](docs/ReleaseUpdateParameters.md) - [Phrase::RepliesListParameters](docs/RepliesListParameters.md) + - [Phrase::RepoSync](docs/RepoSync.md) + - [Phrase::RepoSyncEvent](docs/RepoSyncEvent.md) + - [Phrase::RepoSyncEventErrorsInner](docs/RepoSyncEventErrorsInner.md) + - [Phrase::RepoSyncExport](docs/RepoSyncExport.md) + - [Phrase::RepoSyncImport](docs/RepoSyncImport.md) - [Phrase::Screenshot](docs/Screenshot.md) - [Phrase::ScreenshotMarker](docs/ScreenshotMarker.md) - [Phrase::ScreenshotMarkerCreateParameters](docs/ScreenshotMarkerCreateParameters.md) diff --git a/docs/KeyCreateParameters.md b/docs/KeyCreateParameters.md index 35f32af..ec05505 100644 --- a/docs/KeyCreateParameters.md +++ b/docs/KeyCreateParameters.md @@ -35,7 +35,7 @@ instance = Phrase::KeyCreateParameters.new(branch: my-feature-branch, data_type: number, tags: awesome-feature,needs-proofreading, max_characters_allowed: 140, - screenshot: [B@59a8891e, + screenshot: [B@38da693b, remove_screenshot: null, unformatted: null, default_translation_content: Default translation content, diff --git a/docs/KeyUpdateParameters.md b/docs/KeyUpdateParameters.md index bb48f63..d97f87d 100644 --- a/docs/KeyUpdateParameters.md +++ b/docs/KeyUpdateParameters.md @@ -34,7 +34,7 @@ instance = Phrase::KeyUpdateParameters.new(branch: my-feature-branch, data_type: number, tags: awesome-feature,needs-proofreading, max_characters_allowed: 140, - screenshot: [B@f054e29, + screenshot: [B@1c2912bb, remove_screenshot: null, unformatted: null, xml_space_preserve: null, diff --git a/docs/ProjectCreateParameters.md b/docs/ProjectCreateParameters.md index f0a4cbd..15f3039 100644 --- a/docs/ProjectCreateParameters.md +++ b/docs/ProjectCreateParameters.md @@ -40,7 +40,7 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project, main_format: yml, media: Python, shares_translation_memory: true, - project_image: [B@2c890ee3, + project_image: [B@4f808f77, remove_project_image: null, account_id: abcd1234, point_of_contact: abcd1234, diff --git a/docs/ProjectUpdateParameters.md b/docs/ProjectUpdateParameters.md index b5ffc86..a63849b 100644 --- a/docs/ProjectUpdateParameters.md +++ b/docs/ProjectUpdateParameters.md @@ -41,7 +41,7 @@ instance = Phrase::ProjectUpdateParameters.new(account_id: abcd1234, main_format: yml, media: Python, shares_translation_memory: true, - project_image: [B@62068fa5, + project_image: [B@758a3ba0, remove_project_image: false, workflow: review, machine_translation_enabled: true, diff --git a/docs/RepoSync.md b/docs/RepoSync.md new file mode 100644 index 0000000..9bbb9eb --- /dev/null +++ b/docs/RepoSync.md @@ -0,0 +1,33 @@ +# Phrase::RepoSync + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**project** | [**ProjectShort**](ProjectShort.md) | | [optional] +**provider** | **String** | | [optional] +**enabled** | **Boolean** | | [optional] +**auto_import** | **Boolean** | | [optional] +**repo_name** | **String** | | [optional] +**created_at** | **Time** | | [optional] +**last_import_at** | **Time** | | [optional] +**last_export_at** | **Time** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::RepoSync.new(id: null, + project: null, + provider: null, + enabled: null, + auto_import: null, + repo_name: null, + created_at: null, + last_import_at: null, + last_export_at: null) +``` + + diff --git a/docs/RepoSyncEvent.md b/docs/RepoSyncEvent.md new file mode 100644 index 0000000..d346883 --- /dev/null +++ b/docs/RepoSyncEvent.md @@ -0,0 +1,27 @@ +# Phrase::RepoSyncEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **String** | | [optional] +**created_at** | **Time** | | [optional] +**status** | **String** | | [optional] +**pull_request_url** | **String** | URL of the pull request created on export | [optional] +**auto_import** | **Boolean** | Whether the import was triggered by the repo push event | [optional] +**errors** | [**Array<RepoSyncEventErrorsInner>**](RepoSyncEventErrorsInner.md) | List of error messages, in case of failure | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::RepoSyncEvent.new(event_type: null, + created_at: null, + status: null, + pull_request_url: null, + auto_import: null, + errors: null) +``` + + diff --git a/docs/RepoSyncEventErrorsInner.md b/docs/RepoSyncEventErrorsInner.md new file mode 100644 index 0000000..8bc4514 --- /dev/null +++ b/docs/RepoSyncEventErrorsInner.md @@ -0,0 +1,16 @@ +# Phrase::RepoSyncEventErrorsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::RepoSyncEventErrorsInner.new() +``` + + diff --git a/docs/RepoSyncExport.md b/docs/RepoSyncExport.md new file mode 100644 index 0000000..48c32e8 --- /dev/null +++ b/docs/RepoSyncExport.md @@ -0,0 +1,17 @@ +# Phrase::RepoSyncExport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::RepoSyncExport.new(message: Export started) +``` + + diff --git a/docs/RepoSyncImport.md b/docs/RepoSyncImport.md new file mode 100644 index 0000000..3ec34f4 --- /dev/null +++ b/docs/RepoSyncImport.md @@ -0,0 +1,17 @@ +# Phrase::RepoSyncImport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Phrase' + +instance = Phrase::RepoSyncImport.new(message: Import started) +``` + + diff --git a/docs/RepoSyncsApi.md b/docs/RepoSyncsApi.md new file mode 100644 index 0000000..8e1c768 --- /dev/null +++ b/docs/RepoSyncsApi.md @@ -0,0 +1,454 @@ +# Phrase::RepoSyncsApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**repo_sync_activate**](RepoSyncsApi.md#repo_sync_activate) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/activate | Activate a Repo Sync +[**repo_sync_deactivate**](RepoSyncsApi.md#repo_sync_deactivate) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/deactivate | Deactivate a Repo Sync +[**repo_sync_events**](RepoSyncsApi.md#repo_sync_events) | **GET** /accounts/{account_id}/repo_syncs/{repo_sync_id}/events | Repository Syncs History +[**repo_sync_export**](RepoSyncsApi.md#repo_sync_export) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/export | Export to code repository +[**repo_sync_import**](RepoSyncsApi.md#repo_sync_import) | **POST** /accounts/{account_id}/repo_syncs/{repo_sync_id}/import | Import from code repository +[**repo_sync_list**](RepoSyncsApi.md#repo_sync_list) | **GET** /accounts/{account_id}/repo_syncs | Get Repo Syncs +[**repo_sync_show**](RepoSyncsApi.md#repo_sync_show) | **GET** /accounts/{account_id}/repo_syncs/{repo_sync_id} | Get a single Repo Sync + + + +## repo_sync_activate + +> RepoSync repo_sync_activate(account_id, repo_sync_id, opts) + +Activate a Repo Sync + +Activate a deactivated Repo Sync. Active syncs can be used to import and export translations, and imports to Phrase are automatically triggered by pushes to the repository, if configured. + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Activate a Repo Sync + result = api_instance.repo_sync_activate(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_activate: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**RepoSync**](RepoSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_deactivate + +> RepoSync repo_sync_deactivate(account_id, repo_sync_id, opts) + +Deactivate a Repo Sync + +Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs and the pushes to the repository won't trigger the import to Phrase. + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Deactivate a Repo Sync + result = api_instance.repo_sync_deactivate(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_deactivate: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**RepoSync**](RepoSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_events + +> Array<RepoSyncEvent> repo_sync_events(account_id, repo_sync_id, opts) + +Repository Syncs History + +Get the history of a single Repo Sync. The history includes all imports and exports performed by the Repo Sync. + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Repository Syncs History + result = api_instance.repo_sync_events(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_events: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Array<RepoSyncEvent>**](RepoSyncEvent.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_export + +> RepoSyncExport repo_sync_export(account_id, repo_sync_id, opts) + +Export to code repository + +> Beta: this feature will change in the future. Export translations from Phrase Strings to repository provider according to the .phrase.yml file within the code repository. *Export is done asynchronously and may take several seconds depending on the project size.* + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Export to code repository + result = api_instance.repo_sync_export(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_export: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**RepoSyncExport**](RepoSyncExport.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_import + +> RepoSyncImport repo_sync_import(account_id, repo_sync_id, opts) + +Import from code repository + +> Beta: this feature will change in the future. Import translations from repository provider to Phrase Strings according to the .phrase.yml file within the code repository. _Import is done asynchronously and may take several seconds depending on the project size._ + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Import from code repository + result = api_instance.repo_sync_import(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_import: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**RepoSyncImport**](RepoSyncImport.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_list + +> Array<RepoSync> repo_sync_list(account_id, opts) + +Get Repo Syncs + +Lists all Repo Syncs from an account + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get Repo Syncs + result = api_instance.repo_sync_list(account_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_list: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**Array<RepoSync>**](RepoSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## repo_sync_show + +> RepoSync repo_sync_show(account_id, repo_sync_id, opts) + +Get a single Repo Sync + +Shows a single Repo Sync setting. + +### Example + +```ruby +# load the gem +require 'phrase' +# setup authorization +Phrase.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' + + # Configure API key authorization: Token + config.api_key['Authorization'] = 'YOUR API KEY' + config.api_key_prefix['Authorization'] = 'token' +end + +api_instance = Phrase::RepoSyncsApi.new +account_id = 'account_id_example' # String | Account ID +repo_sync_id = 'repo_sync_id_example' # String | Repo Sync ID +opts = { + x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional) +} + +begin + #Get a single Repo Sync + result = api_instance.repo_sync_show(account_id, repo_sync_id, opts) + pp result +rescue Phrase::ApiError => e + puts "Exception when calling RepoSyncsApi->repo_sync_show: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **String**| Account ID | + **repo_sync_id** | **String**| Repo Sync ID | + **x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +Response<([**RepoSync**](RepoSync.md))> + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/ScreenshotUpdateParameters.md b/docs/ScreenshotUpdateParameters.md index 2de4df2..68da474 100644 --- a/docs/ScreenshotUpdateParameters.md +++ b/docs/ScreenshotUpdateParameters.md @@ -17,7 +17,7 @@ require 'Phrase' instance = Phrase::ScreenshotUpdateParameters.new(branch: my-feature-branch, name: A screenshot name, description: A screenshot description, - filename: [B@3db2665d) + filename: [B@736abb16) ``` diff --git a/lib/phrase.rb b/lib/phrase.rb index 65ea620..16eac33 100644 --- a/lib/phrase.rb +++ b/lib/phrase.rb @@ -159,6 +159,11 @@ require 'phrase/models/release_preview' require 'phrase/models/release_update_parameters' require 'phrase/models/replies_list_parameters' +require 'phrase/models/repo_sync' +require 'phrase/models/repo_sync_event' +require 'phrase/models/repo_sync_event_errors_inner' +require 'phrase/models/repo_sync_export' +require 'phrase/models/repo_sync_import' require 'phrase/models/screenshot' require 'phrase/models/screenshot_marker' require 'phrase/models/screenshot_marker_create_parameters' @@ -260,6 +265,7 @@ require 'phrase/api/projects_api' require 'phrase/api/quality_performance_score_api' require 'phrase/api/releases_api' +require 'phrase/api/repo_syncs_api' require 'phrase/api/reports_api' require 'phrase/api/screenshot_markers_api' require 'phrase/api/screenshots_api' diff --git a/lib/phrase/api/repo_syncs_api.rb b/lib/phrase/api/repo_syncs_api.rb new file mode 100644 index 0000000..158e037 --- /dev/null +++ b/lib/phrase/api/repo_syncs_api.rb @@ -0,0 +1,508 @@ +require 'cgi' + +module Phrase + class RepoSyncsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Activate a Repo Sync + # Activate a deactivated Repo Sync. Active syncs can be used to import and export translations, and imports to Phrase are automatically triggered by pushes to the repository, if configured. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + def repo_sync_activate(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_activate_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Activate a Repo Sync + # Activate a deactivated Repo Sync. Active syncs can be used to import and export translations, and imports to Phrase are automatically triggered by pushes to the repository, if configured. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(RepoSync)>, Integer, Hash)>] Response<(RepoSync)> data, response status code and response headers + def repo_sync_activate_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_activate ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_activate" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_activate" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}/activate'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'RepoSync' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_activate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Deactivate a Repo Sync + # Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs and the pushes to the repository won't trigger the import to Phrase. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + def repo_sync_deactivate(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_deactivate_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Deactivate a Repo Sync + # Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs and the pushes to the repository won't trigger the import to Phrase. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(RepoSync)>, Integer, Hash)>] Response<(RepoSync)> data, response status code and response headers + def repo_sync_deactivate_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_deactivate ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_deactivate" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_deactivate" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}/deactivate'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'RepoSync' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_deactivate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Repository Syncs History + # Get the history of a single Repo Sync. The history includes all imports and exports performed by the Repo Sync. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def repo_sync_events(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_events_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Repository Syncs History + # Get the history of a single Repo Sync. The history includes all imports and exports performed by the Repo Sync. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def repo_sync_events_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_events ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_events" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_events" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}/events'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'Array' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Export to code repository + # > Beta: this feature will change in the future. Export translations from Phrase Strings to repository provider according to the .phrase.yml file within the code repository. *Export is done asynchronously and may take several seconds depending on the project size.* + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSyncExport] + def repo_sync_export(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_export_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Export to code repository + # > Beta: this feature will change in the future. Export translations from Phrase Strings to repository provider according to the .phrase.yml file within the code repository. *Export is done asynchronously and may take several seconds depending on the project size.* + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(RepoSyncExport)>, Integer, Hash)>] Response<(RepoSyncExport)> data, response status code and response headers + def repo_sync_export_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_export ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_export" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_export" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}/export'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'RepoSyncExport' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Import from code repository + # > Beta: this feature will change in the future. Import translations from repository provider to Phrase Strings according to the .phrase.yml file within the code repository. _Import is done asynchronously and may take several seconds depending on the project size._ + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSyncImport] + def repo_sync_import(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_import_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Import from code repository + # > Beta: this feature will change in the future. Import translations from repository provider to Phrase Strings according to the .phrase.yml file within the code repository. _Import is done asynchronously and may take several seconds depending on the project size._ + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(RepoSyncImport)>, Integer, Hash)>] Response<(RepoSyncImport)> data, response status code and response headers + def repo_sync_import_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_import ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_import" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_import" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}/import'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'RepoSyncImport' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_import\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get Repo Syncs + # Lists all Repo Syncs from an account + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + def repo_sync_list(account_id, opts = {}) + data, _status_code, _headers = repo_sync_list_with_http_info(account_id, opts) + data + end + + # Get Repo Syncs + # Lists all Repo Syncs from an account + # @param account_id [String] Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(Array)>, Integer, Hash)>] Response<(Array)> data, response status code and response headers + def repo_sync_list_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_list ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_list" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs'.sub('{' + 'account_id' + '}', CGI.escape(account_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'Array' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + + # Get a single Repo Sync + # Shows a single Repo Sync setting. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + def repo_sync_show(account_id, repo_sync_id, opts = {}) + data, _status_code, _headers = repo_sync_show_with_http_info(account_id, repo_sync_id, opts) + data + end + + # Get a single Repo Sync + # Shows a single Repo Sync setting. + # @param account_id [String] Account ID + # @param repo_sync_id [String] Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array<(Response<(RepoSync)>, Integer, Hash)>] Response<(RepoSync)> data, response status code and response headers + def repo_sync_show_with_http_info(account_id, repo_sync_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RepoSyncsApi.repo_sync_show ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling RepoSyncsApi.repo_sync_show" + end + # verify the required parameter 'repo_sync_id' is set + if @api_client.config.client_side_validation && repo_sync_id.nil? + fail ArgumentError, "Missing the required parameter 'repo_sync_id' when calling RepoSyncsApi.repo_sync_show" + end + # resource path + local_var_path = '/accounts/{account_id}/repo_syncs/{repo_sync_id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'repo_sync_id' + '}', CGI.escape(repo_sync_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']) + header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'RepoSync' + + # auth_names + auth_names = opts[:auth_names] || ['Basic', 'Token'] + + new_options = opts.merge( + :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: RepoSyncsApi#repo_sync_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + response = ::Phrase::Response.new(data, headers) + return response, status_code, headers + end + end +end diff --git a/lib/phrase/models/repo_sync.rb b/lib/phrase/models/repo_sync.rb new file mode 100644 index 0000000..f3c2fe2 --- /dev/null +++ b/lib/phrase/models/repo_sync.rb @@ -0,0 +1,268 @@ +require 'date' + +module Phrase + class RepoSync + attr_accessor :id + + attr_accessor :project + + attr_accessor :provider + + attr_accessor :enabled + + attr_accessor :auto_import + + attr_accessor :repo_name + + attr_accessor :created_at + + attr_accessor :last_import_at + + attr_accessor :last_export_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'project' => :'project', + :'provider' => :'provider', + :'enabled' => :'enabled', + :'auto_import' => :'auto_import', + :'repo_name' => :'repo_name', + :'created_at' => :'created_at', + :'last_import_at' => :'last_import_at', + :'last_export_at' => :'last_export_at' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'project' => :'ProjectShort', + :'provider' => :'String', + :'enabled' => :'Boolean', + :'auto_import' => :'Boolean', + :'repo_name' => :'String', + :'created_at' => :'DateTime', + :'last_import_at' => :'DateTime', + :'last_export_at' => :'DateTime' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSync` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSync`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'project') + self.project = attributes[:'project'] + end + + if attributes.key?(:'provider') + self.provider = attributes[:'provider'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'auto_import') + self.auto_import = attributes[:'auto_import'] + end + + if attributes.key?(:'repo_name') + self.repo_name = attributes[:'repo_name'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'last_import_at') + self.last_import_at = attributes[:'last_import_at'] + end + + if attributes.key?(:'last_export_at') + self.last_export_at = attributes[:'last_export_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + project == o.project && + provider == o.provider && + enabled == o.enabled && + auto_import == o.auto_import && + repo_name == o.repo_name && + created_at == o.created_at && + last_import_at == o.last_import_at && + last_export_at == o.last_export_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, project, provider, enabled, auto_import, repo_name, created_at, last_import_at, last_export_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/repo_sync_event.rb b/lib/phrase/models/repo_sync_event.rb new file mode 100644 index 0000000..c84302d --- /dev/null +++ b/lib/phrase/models/repo_sync_event.rb @@ -0,0 +1,292 @@ +require 'date' + +module Phrase + class RepoSyncEvent + attr_accessor :event_type + + attr_accessor :created_at + + attr_accessor :status + + # URL of the pull request created on export + attr_accessor :pull_request_url + + # Whether the import was triggered by the repo push event + attr_accessor :auto_import + + # List of error messages, in case of failure + attr_accessor :errors + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'event_type' => :'event_type', + :'created_at' => :'created_at', + :'status' => :'status', + :'pull_request_url' => :'pull_request_url', + :'auto_import' => :'auto_import', + :'errors' => :'errors' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'event_type' => :'String', + :'created_at' => :'DateTime', + :'status' => :'String', + :'pull_request_url' => :'String', + :'auto_import' => :'Boolean', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'event_type') + self.event_type = attributes[:'event_type'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'pull_request_url') + self.pull_request_url = attributes[:'pull_request_url'] + end + + if attributes.key?(:'auto_import') + self.auto_import = attributes[:'auto_import'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + event_type_validator = EnumAttributeValidator.new('String', ["import", "export"]) + return false unless event_type_validator.valid?(@event_type) + status_validator = EnumAttributeValidator.new('String', ["running", "success", "failure"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] event_type Object to be assigned + def event_type=(event_type) + validator = EnumAttributeValidator.new('String', ["import", "export"]) + unless validator.valid?(event_type) + fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}." + end + @event_type = event_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["running", "success", "failure"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + event_type == o.event_type && + created_at == o.created_at && + status == o.status && + pull_request_url == o.pull_request_url && + auto_import == o.auto_import && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [event_type, created_at, status, pull_request_url, auto_import, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/repo_sync_event_errors_inner.rb b/lib/phrase/models/repo_sync_event_errors_inner.rb new file mode 100644 index 0000000..bf2ef18 --- /dev/null +++ b/lib/phrase/models/repo_sync_event_errors_inner.rb @@ -0,0 +1,207 @@ +require 'date' + +module Phrase + class RepoSyncEventErrorsInner + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + :'Object', + :'String' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncEventErrorsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncEventErrorsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + _any_of_found = false + self.class.openapi_any_of.each do |_class| + _any_of = Phrase.const_get(_class).build_from_hash(self.to_hash) + if _any_of.valid? + _any_of_found = true + end + end + + if !_any_of_found + return false + end + + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/repo_sync_export.rb b/lib/phrase/models/repo_sync_export.rb new file mode 100644 index 0000000..32211bf --- /dev/null +++ b/lib/phrase/models/repo_sync_export.rb @@ -0,0 +1,196 @@ +require 'date' + +module Phrase + class RepoSyncExport + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncExport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncExport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/phrase/models/repo_sync_import.rb b/lib/phrase/models/repo_sync_import.rb new file mode 100644 index 0000000..ab97e6c --- /dev/null +++ b/lib/phrase/models/repo_sync_import.rb @@ -0,0 +1,196 @@ +require 'date' + +module Phrase + class RepoSyncImport + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncImport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncImport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :Time + Time.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Phrase.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/spec/api/repo_syncs_api_spec.rb b/spec/api/repo_syncs_api_spec.rb new file mode 100644 index 0000000..6d7aad2 --- /dev/null +++ b/spec/api/repo_syncs_api_spec.rb @@ -0,0 +1,120 @@ +require 'spec_helper' +require 'json' + +# Unit tests for Phrase::RepoSyncsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSyncsApi' do + before do + # run before each test + @api_instance = Phrase::RepoSyncsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSyncsApi' do + it 'should create an instance of RepoSyncsApi' do + expect(@api_instance).to be_instance_of(Phrase::RepoSyncsApi) + end + end + + # unit tests for repo_sync_activate + # Activate a Repo Sync + # Activate a deactivated Repo Sync. Active syncs can be used to import and export translations, and imports to Phrase are automatically triggered by pushes to the repository, if configured. + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + describe 'repo_sync_activate test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_deactivate + # Deactivate a Repo Sync + # Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs and the pushes to the repository won't trigger the import to Phrase. + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + describe 'repo_sync_deactivate test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_events + # Repository Syncs History + # Get the history of a single Repo Sync. The history includes all imports and exports performed by the Repo Sync. + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'repo_sync_events test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_export + # Export to code repository + # > Beta: this feature will change in the future. Export translations from Phrase Strings to repository provider according to the .phrase.yml file within the code repository. *Export is done asynchronously and may take several seconds depending on the project size.* + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSyncExport] + describe 'repo_sync_export test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_import + # Import from code repository + # > Beta: this feature will change in the future. Import translations from repository provider to Phrase Strings according to the .phrase.yml file within the code repository. _Import is done asynchronously and may take several seconds depending on the project size._ + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSyncImport] + describe 'repo_sync_import test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_list + # Get Repo Syncs + # Lists all Repo Syncs from an account + # @param account_id Account ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [Array] + describe 'repo_sync_list test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for repo_sync_show + # Get a single Repo Sync + # Shows a single Repo Sync setting. + # @param account_id Account ID + # @param repo_sync_id Repo Sync ID + # @param [Hash] opts the optional parameters + # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) + # @return [RepoSync] + describe 'repo_sync_show test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/repo_sync_event_errors_inner_spec.rb b/spec/models/repo_sync_event_errors_inner_spec.rb new file mode 100644 index 0000000..912fe75 --- /dev/null +++ b/spec/models/repo_sync_event_errors_inner_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::RepoSyncEventErrorsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSyncEventErrorsInner' do + before do + # run before each test + @instance = Phrase::RepoSyncEventErrorsInner.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSyncEventErrorsInner' do + it 'should create an instance of RepoSyncEventErrorsInner' do + expect(@instance).to be_instance_of(Phrase::RepoSyncEventErrorsInner) + end + end +end diff --git a/spec/models/repo_sync_event_spec.rb b/spec/models/repo_sync_event_spec.rb new file mode 100644 index 0000000..d90a1d2 --- /dev/null +++ b/spec/models/repo_sync_event_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::RepoSyncEvent +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSyncEvent' do + before do + # run before each test + @instance = Phrase::RepoSyncEvent.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSyncEvent' do + it 'should create an instance of RepoSyncEvent' do + expect(@instance).to be_instance_of(Phrase::RepoSyncEvent) + end + end + describe 'test attribute "event_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["import", "export"]) + # validator.allowable_values.each do |value| + # expect { @instance.event_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["running", "success", "failure"]) + # validator.allowable_values.each do |value| + # expect { @instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "pull_request_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "auto_import"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/repo_sync_export_spec.rb b/spec/models/repo_sync_export_spec.rb new file mode 100644 index 0000000..de9fe40 --- /dev/null +++ b/spec/models/repo_sync_export_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::RepoSyncExport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSyncExport' do + before do + # run before each test + @instance = Phrase::RepoSyncExport.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSyncExport' do + it 'should create an instance of RepoSyncExport' do + expect(@instance).to be_instance_of(Phrase::RepoSyncExport) + end + end + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/repo_sync_import_spec.rb b/spec/models/repo_sync_import_spec.rb new file mode 100644 index 0000000..ecd7f9e --- /dev/null +++ b/spec/models/repo_sync_import_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::RepoSyncImport +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSyncImport' do + before do + # run before each test + @instance = Phrase::RepoSyncImport.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSyncImport' do + it 'should create an instance of RepoSyncImport' do + expect(@instance).to be_instance_of(Phrase::RepoSyncImport) + end + end + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/repo_sync_spec.rb b/spec/models/repo_sync_spec.rb new file mode 100644 index 0000000..4abd783 --- /dev/null +++ b/spec/models/repo_sync_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Phrase::RepoSync +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RepoSync' do + before do + # run before each test + @instance = Phrase::RepoSync.new + end + + after do + # run after each test + end + + describe 'test an instance of RepoSync' do + it 'should create an instance of RepoSync' do + expect(@instance).to be_instance_of(Phrase::RepoSync) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "project"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "provider"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "auto_import"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "repo_name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_import_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "last_export_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end