@localazy/ts-api
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -9,2 +9,3 @@ declare type Common = { | ||
static get(options: Common): Promise<any>; | ||
static getBlob(options: Common): Promise<Blob>; | ||
static post(options: Common): Promise<any>; | ||
@@ -11,0 +12,0 @@ static put(options: Common): Promise<any>; |
@@ -78,2 +78,28 @@ "use strict"; | ||
}); | ||
Object.defineProperty(LocalazyAPI, "getBlob", { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fetch("".concat(options.url), { | ||
method: 'GET', | ||
headers: { | ||
Authorization: "Bearer ".concat(options.projectToken), | ||
'Response-Type': 'blob', | ||
}, | ||
}).catch(function (e) { | ||
throw e; | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.blob()]; | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
Object.defineProperty(LocalazyAPI, "post", { | ||
@@ -80,0 +106,0 @@ enumerable: false, |
@@ -28,2 +28,3 @@ import Constructor from './models/arguments/constructor'; | ||
import DeleteScreenshotResult from './models/responses/delete-screenshot-result'; | ||
import GetFileContents from './models/arguments/get-file-contents'; | ||
declare class LocalazyService { | ||
@@ -54,2 +55,7 @@ private projectToken; | ||
/** | ||
* Returns the given file contents. | ||
* @see https://localazy.com/docs/api/files | ||
*/ | ||
getFileContents(options: GetFileContents, config?: CommonConfig): Promise<Blob>; | ||
/** | ||
* Retrieve list of keys for language from file. | ||
@@ -56,0 +62,0 @@ * @see https://localazy.com/docs/api/files#retrieve-a-list-of-keys-and-translations-from-file |
@@ -159,2 +159,24 @@ "use strict"; | ||
/** | ||
* Returns the given file contents. | ||
* @see https://localazy.com/docs/api/files | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "getFileContents", { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function (options, config) { | ||
if (config === void 0) { config = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var projectId, fileId, lang; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId, fileId = options.fileId, lang = options.lang; | ||
return [2 /*return*/, api_1.default.getBlob({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/files/").concat(fileId, "/download/").concat(lang), | ||
projectToken: config.projectToken || this.projectToken, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Retrieve list of keys for language from file. | ||
@@ -161,0 +183,0 @@ * @see https://localazy.com/docs/api/files#retrieve-a-list-of-keys-and-translations-from-file |
{ | ||
"name": "@localazy/ts-api", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "This is a Typescript library facilitating usage of Localazy's API.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -78,2 +78,12 @@ # @localazy/ts-api | ||
### getFileContents | ||
Returns the given file contents. | ||
```ts | ||
async getFileContents(options: DownloadFile, config: CommonConfig = {}) | ||
``` | ||
Documentation: https://localazy.com/docs/api/files | ||
### listKeysInFileForLanguage | ||
@@ -80,0 +90,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
67340
114
1121
189
5