Skip to content

Commit e6aad96

Browse files
authored
RPS-7890. Update api-python-sdk to the latest version (#59)
1 parent f65d52b commit e6aad96

16 files changed

+50
-26
lines changed

builder/ApiSource.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ def collectMethods(self, swaggerDict):
4444
self.methods.append(m)
4545

4646
def patchMethods(self, descr, m, swaggerDict):
47-
if descr['operationId'] == 'exportFileTranslations':
48-
propDict = {
49-
"type": "string",
50-
"format": "binary",
51-
"description": "The file contents to upload."
52-
}
53-
mp = MultipartProperty('file', propDict, swaggerDict)
54-
mp.setRequired()
55-
m.needMultipart = True
56-
m.multipartParameters.insert(0, mp)
5747
if descr['operationId'] in ('getAllSourceStringsByProject'):
5848
m.method = 'post'
5949
m.isJson = True

changes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Aug 29, 2024 - 3.1.6
2+
- updated according the latest changes in Smartling SDK
3+
14
Dec 09, 2022 - 3.1.5
25
- fix of ApiResponse get attribute may cause stack overflow on requesting non-existng attribute
36

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
description="python library to work with Smartling translation services APIs",
2929
license='Apache License v2.0',
3030
keywords='translation localization internationalization',
31-
url="https://api-reference.smartling.com/",
31+
url="",
3232
long_description="python SDK to work with Smartling API for computer assisted translation",
33-
packages=['smartlingApiSdk','smartlingApiSdk/example','smartlingApiSdk/api'],
33+
packages=['smartlingApiSdk','smartlingApiSdk/example','smartlingApiSdk/api','smartlingApiSdk/resources'],
3434
include_package_data = True,
3535
package_data = {
3636
'': ['*.properties', '*.xml', '*.png', '*.csv'],

smartlingApiSdk/api/AccountProjectsApi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AccountProjectsApi(ApiV2):
2626
def __init__(self, userIdentifier, userSecret, projectId, proxySettings=None, permanentHeaders={}, env='prod'):
2727
ApiV2.__init__(self, userIdentifier, userSecret, projectId, proxySettings, permanentHeaders=permanentHeaders, env=env)
2828

29-
def getProjectsByAccount(self, accountUid, projectNameFilter='', includeArchived='', offset=0, limit=0, **kwargs):
29+
def getProjectsByAccount(self, accountUid, projectNameFilter='', includeArchived='', offset=0, limit=0, projectTypeCode='', projectTypeCodes=[], **kwargs):
3030
"""
3131
method : GET
3232
api url : /accounts-api/v2/accounts/{accountUid}/projects
@@ -40,6 +40,8 @@ def getProjectsByAccount(self, accountUid, projectNameFilter='', includeArchived
4040
'includeArchived':includeArchived,
4141
'offset':offset,
4242
'limit':limit,
43+
'projectTypeCode':projectTypeCode,
44+
'projectTypeCodes':projectTypeCodes,
4345
}
4446
kw.update(kwargs)
4547
url = self.urlHelper.getUrl('/accounts-api/v2/accounts/{accountUid}/projects', accountUid=accountUid, **kwargs)

smartlingApiSdk/api/ContextApi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def downloadVisualContextFileContent(self, contextUid, **kwargs):
131131
return response, status
132132

133133

134-
def runAutomaticContextMatching(self, contextUid, contentFileUri='', stringHashcodes=[], translationJobUids=[], overrideContextOlderThanDays=0, **kwargs):
134+
def runAutomaticContextMatching(self, contextUid, contentFileUri='', stringHashcodes=[], translationJobUids=[], overrideContextOlderThanDays=0, videoMatchingMode='', **kwargs):
135135
"""
136136
method : POST
137137
api url : /context-api/v2/projects/{projectId}/contexts/{contextUid}/match/async
@@ -145,6 +145,7 @@ def runAutomaticContextMatching(self, contextUid, contentFileUri='', stringHashc
145145
'stringHashcodes':stringHashcodes,
146146
'translationJobUids':translationJobUids,
147147
'overrideContextOlderThanDays':overrideContextOlderThanDays,
148+
'videoMatchingMode':videoMatchingMode,
148149
}
149150
kw.update(kwargs)
150151
url = self.urlHelper.getUrl('/context-api/v2/projects/{projectId}/contexts/{contextUid}/match/async', contextUid=contextUid, **kwargs)

smartlingApiSdk/api/EstimatesApi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def getJobFuzzyEstimateReports(self, translationJobUid, reportStatus='', content
5151
return response, status
5252

5353

54-
def generateJobFuzzyEstimateReports(self, translationJobUid, contentType='', tags=[], **kwargs):
54+
def generateJobFuzzyEstimateReports(self, translationJobUid, contentType='ALL_CONTENT', tags=[], **kwargs):
5555
"""
5656
method : POST
5757
api url : /estimates-api/v2/projects/{projectId}/jobs/{translationJobUid}/reports/fuzzy
@@ -94,7 +94,7 @@ def getJobCostEstimateReports(self, translationJobUid, reportStatus='', contentC
9494
return response, status
9595

9696

97-
def generateJobCostEstimateReports(self, translationJobUid, contentType='', tags=[], localeWorkflows=[], fuzzyProfileUid='', **kwargs):
97+
def generateJobCostEstimateReports(self, translationJobUid, contentType='ALL_CONTENT', tags=[], localeWorkflows=[], fuzzyProfileUid='', **kwargs):
9898
"""
9999
method : POST
100100
api url : /estimates-api/v2/projects/{projectId}/jobs/{translationJobUid}/reports/cost

smartlingApiSdk/api/FilesApi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FilesApi(ApiV2):
2626
def __init__(self, userIdentifier, userSecret, projectId, proxySettings=None, permanentHeaders={}, env='prod'):
2727
ApiV2.__init__(self, userIdentifier, userSecret, projectId, proxySettings, permanentHeaders=permanentHeaders, env=env)
2828

29-
def uploadSourceFile(self, file, fileUri, fileType, authorize=False, localeIdsToAuthorize=[], callbackUrl='', directives={}, **kwargs):
29+
def uploadSourceFile(self, file, fileUri, fileType, callbackUrl='', directives={}, **kwargs):
3030
"""
3131
method : POST
3232
api url : /files-api/v2/projects/{projectId}/file
@@ -41,8 +41,6 @@ def uploadSourceFile(self, file, fileUri, fileType, authorize=False, localeIdsTo
4141
'file':self.processFile(file),
4242
'fileUri':fileUri,
4343
'fileType':fileType,
44-
'authorize':authorize,
45-
'localeIdsToAuthorize':localeIdsToAuthorize,
4644
'callbackUrl':callbackUrl,
4745
}
4846
self.addLibIdDirective(kw)

smartlingApiSdk/api/JobsApi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def findJobsByStrings(self, hashcodes=[], localeIds=[], **kwargs):
121121
return response, status
122122

123123

124-
def getStringsForTranslationJob(self, translationJobUid, targetLocaleId='', limit=0, offset=0, **kwargs):
124+
def getStringsForTranslationJob(self, translationJobUid, targetLocaleId='', limit=1000, offset=0, **kwargs):
125125
"""
126126
method : GET
127127
api url : /jobs-api/v3/projects/{projectId}/jobs/{translationJobUid}/strings
@@ -371,7 +371,7 @@ def removeFileFromJob(self, translationJobUid, fileUri='', **kwargs):
371371
return response, status
372372

373373

374-
def getJobFilesList(self, translationJobUid, limit=0, offset=0, **kwargs):
374+
def getJobFilesList(self, translationJobUid, limit=1000, offset=0, **kwargs):
375375
"""
376376
method : GET
377377
api url : /jobs-api/v3/projects/{projectId}/jobs/{translationJobUid}/files

smartlingApiSdk/api/TagsApi.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ class TagsApi(ApiV2):
2626
def __init__(self, userIdentifier, userSecret, projectId, proxySettings=None, permanentHeaders={}, env='prod'):
2727
ApiV2.__init__(self, userIdentifier, userSecret, projectId, proxySettings, permanentHeaders=permanentHeaders, env=env)
2828

29+
def getTagsListByAccount(self, accountUid, projectIds=[], tagMask='', limit=1500, offset=0, **kwargs):
30+
"""
31+
method : POST
32+
api url : /tags-api/v2/accounts/{accountUid}/tags
33+
as curl : curl -H "Authorization: Bearer $smartlingToken" https://api.smartling.com/tags-api/v2/accounts/$smartlingAccountUid/tags
34+
Responses:
35+
200 : OK
36+
details : https://api-reference.smartling.com/#operation/getTagsListByAccount
37+
"""
38+
kw = {
39+
'projectIds':projectIds,
40+
'tagMask':tagMask,
41+
'limit':limit,
42+
'offset':offset,
43+
}
44+
kw.update(kwargs)
45+
url = self.urlHelper.getUrl('/tags-api/v2/accounts/{accountUid}/tags', accountUid=accountUid, **kwargs)
46+
response, status = self.commandJson('POST', url, kw)
47+
return response, status
48+
49+
2950
def getTagsListByProject(self, tagMask='', limit=100, offset=0, **kwargs):
3051
"""
3152
method : GET

smartlingApiSdk/example/FilesExample.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ def checkUploadSourceFile(self):
133133
file=self.FILE_PATH + self.FILE_NAME
134134
fileUri=self.uri
135135
fileType=self.FILE_TYPE
136-
localeIdsToAuthorize=[self.MY_LOCALE]
137-
res, status = self.files_api.uploadSourceFile(file=file, fileUri=fileUri, fileType=fileType, localeIdsToAuthorize=localeIdsToAuthorize)
136+
res, status = self.files_api.uploadSourceFile(file=file, fileUri=fileUri, fileType=fileType)
138137

139138

140139
assert_equal(res.data.wordCount, 6)

0 commit comments

Comments
 (0)