Skip to content

Latest commit

 

History

History
168 lines (130 loc) · 6.65 KB

GitHubSyncApi.md

File metadata and controls

168 lines (130 loc) · 6.65 KB

GitHubSyncApi

All URIs are relative to https://api.phrase.com/v2

Method HTTP request Description
githubSyncExport POST /github_syncs/export Export from Phrase to GitHub
githubSyncImport POST /github_syncs/import Import to Phrase from GitHub

githubSyncExport

githubSyncExport(githubSyncExportParameters, xPhraseAppOTP)

Export from Phrase to GitHub

Export translations from Phrase to GitHub according to the .phraseapp.yml file within the GitHub repository.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.GitHubSyncApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Token.setApiKeyPrefix("Token");

    GitHubSyncApi apiInstance = new GitHubSyncApi(defaultClient);
    GithubSyncExportParameters githubSyncExportParameters = new GithubSyncExportParameters(); // GithubSyncExportParameters | 
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      apiInstance.githubSyncExport(githubSyncExportParameters, xPhraseAppOTP);
    } catch (ApiException e) {
      System.err.println("Exception when calling GitHubSyncApi#githubSyncExport");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
githubSyncExportParameters GithubSyncExportParameters
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

null (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

githubSyncImport

githubSyncImport(githubSyncImportParameters, xPhraseAppOTP)

Import to Phrase from GitHub

Import files to Phrase from your connected GitHub repository.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.GitHubSyncApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Token.setApiKeyPrefix("Token");

    GitHubSyncApi apiInstance = new GitHubSyncApi(defaultClient);
    GithubSyncImportParameters githubSyncImportParameters = new GithubSyncImportParameters(); // GithubSyncImportParameters | 
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      apiInstance.githubSyncImport(githubSyncImportParameters, xPhraseAppOTP);
    } catch (ApiException e) {
      System.err.println("Exception when calling GitHubSyncApi#githubSyncImport");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
githubSyncImportParameters GithubSyncImportParameters
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

null (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -