@localazy/ts-api
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -1,2 +0,2 @@ | ||
declare type Common = { | ||
type Common = { | ||
url: string; | ||
@@ -3,0 +3,0 @@ projectToken: string; |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -60,2 +60,3 @@ if (y = 0, t) op = [op[0] & 2, t.value]; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var localazy_error_1 = require("./errors/localazy-error"); | ||
var LocalazyAPI = /** @class */ (function () { | ||
@@ -70,3 +71,3 @@ function LocalazyAPI() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var queryParams, response; | ||
var queryParams, response, json; | ||
return __generator(this, function (_a) { | ||
@@ -84,3 +85,9 @@ switch (_a.label) { | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
json = _a.sent(); | ||
if (json.success === false) { | ||
throw new localazy_error_1.LocalazyError(json.error, json.message, json.code); | ||
} | ||
return [2 /*return*/, json]; | ||
} | ||
@@ -108,2 +115,5 @@ }); | ||
response = _a.sent(); | ||
if (response.status >= 400 && response.status < 500) { | ||
throw new localazy_error_1.LocalazyError(response.statusText, '', response.status); | ||
} | ||
return [2 /*return*/, response.blob()]; | ||
@@ -121,3 +131,3 @@ } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var body, response; | ||
var body, response, json; | ||
return __generator(this, function (_a) { | ||
@@ -141,3 +151,9 @@ switch (_a.label) { | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
json = _a.sent(); | ||
if (json.success === false) { | ||
throw new localazy_error_1.LocalazyError(json.error, json.message, json.code); | ||
} | ||
return [2 /*return*/, json]; | ||
} | ||
@@ -154,3 +170,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var body, response; | ||
var body, response, json; | ||
return __generator(this, function (_a) { | ||
@@ -174,3 +190,9 @@ switch (_a.label) { | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
json = _a.sent(); | ||
if (json.success === false) { | ||
throw new localazy_error_1.LocalazyError(json.error, json.message, json.code); | ||
} | ||
return [2 /*return*/, json]; | ||
} | ||
@@ -187,3 +209,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response; | ||
var response, json; | ||
return __generator(this, function (_a) { | ||
@@ -199,3 +221,9 @@ switch (_a.label) { | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
json = _a.sent(); | ||
if (json.success === false) { | ||
throw new localazy_error_1.LocalazyError(json.error, json.message, json.code); | ||
} | ||
return [2 /*return*/, json]; | ||
} | ||
@@ -202,0 +230,0 @@ }); |
@@ -17,3 +17,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -20,0 +20,0 @@ if (y = 0, t) op = [op[0] & 2, t.value]; |
@@ -1,2 +0,2 @@ | ||
declare type CommonConfig = { | ||
type CommonConfig = { | ||
/** Optionally override initially set project token */ | ||
@@ -3,0 +3,0 @@ projectToken?: string; |
/** | ||
* Initial service options used for authorization and content resolution | ||
*/ | ||
declare type Constructor = { | ||
type Constructor = { | ||
/** Localazy project's Authentication token. | ||
@@ -6,0 +6,0 @@ * @see [Authentication](https://localazy.com/docs/api/authentication) |
@@ -1,2 +0,2 @@ | ||
declare type DeleteKey = { | ||
type DeleteKey = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ keyId: string; |
@@ -1,2 +0,2 @@ | ||
declare type DeleteScreenshot = { | ||
type DeleteScreenshot = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ screenshotId: string; |
@@ -1,2 +0,2 @@ | ||
declare type GetFileContents = { | ||
type GetFileContents = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ fileId: string; |
@@ -1,4 +0,4 @@ | ||
declare type GetWebhooksSecret = { | ||
type GetWebhooksSecret = { | ||
projectId: string; | ||
}; | ||
export default GetWebhooksSecret; |
import LocFile from './loc-file'; | ||
/** @see [Request structure](https://localazy.com/docs/api/import#request-structure) */ | ||
declare type Import = { | ||
type Import = { | ||
projectId: string; | ||
@@ -5,0 +5,0 @@ /** Import all translations to go through the review process. |
@@ -1,4 +0,4 @@ | ||
declare type ListFiles = { | ||
type ListFiles = { | ||
projectId: string; | ||
}; | ||
export default ListFiles; |
@@ -1,2 +0,2 @@ | ||
declare type ListKeysInFile = { | ||
type ListKeysInFile = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ fileId: string; |
@@ -1,2 +0,2 @@ | ||
declare type ListProjects = { | ||
type ListProjects = { | ||
/** Add information about the owning organization. */ | ||
@@ -3,0 +3,0 @@ organization?: boolean; |
@@ -1,4 +0,4 @@ | ||
declare type ListScreenshotsTags = { | ||
type ListScreenshotsTags = { | ||
projectId: string; | ||
}; | ||
export default ListScreenshotsTags; |
@@ -1,4 +0,4 @@ | ||
declare type ListScreenshots = { | ||
type ListScreenshots = { | ||
projectId: string; | ||
}; | ||
export default ListScreenshots; |
@@ -1,4 +0,4 @@ | ||
declare type ListWebhooks = { | ||
type ListWebhooks = { | ||
projectId: string; | ||
}; | ||
export default ListWebhooks; |
/** Strings in the given language to be imported. | ||
* @see [Request structure](https://localazy.com/docs/api/import#request-structure) | ||
*/ | ||
declare type LocFileContentLanguage = { | ||
type LocFileContentLanguage = { | ||
[k: string]: string | string[] | LocFileContentLanguage; | ||
}; | ||
declare type LocFileContent = { | ||
type LocFileContent = { | ||
/** The file type to be used for backing the strings. @see https://localazy.com/docs/api/import#response-1 | ||
@@ -9,0 +9,0 @@ * default: api */ |
import LocFileContent from './loc-file-content'; | ||
declare type LocFile = { | ||
type LocFile = { | ||
/** The file name */ | ||
@@ -4,0 +4,0 @@ name: string; |
@@ -1,2 +0,2 @@ | ||
declare type PostScreenshot = { | ||
type PostScreenshot = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ screenshotId: string; |
@@ -1,2 +0,2 @@ | ||
declare type PostScreenshots = { | ||
type PostScreenshots = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ rawScreenshot: string; |
import Webhooks from '../common/webhooks'; | ||
declare type PostWebhooks = { | ||
type PostWebhooks = { | ||
projectId: string; | ||
@@ -4,0 +4,0 @@ webhooks: Webhooks; |
import { Phrase, Tag, Metadata } from '../common/screenshots'; | ||
export declare type Screenshot = { | ||
export type Screenshot = { | ||
/** Custom comment for the screenshot */ | ||
@@ -21,3 +21,3 @@ comment?: string; | ||
}; | ||
declare type PutScreenshot = { | ||
type PutScreenshot = { | ||
projectId: string; | ||
@@ -24,0 +24,0 @@ screenshotId: string; |
@@ -1,2 +0,2 @@ | ||
declare type UpdateKey = { | ||
type UpdateKey = { | ||
projectId: string; | ||
@@ -3,0 +3,0 @@ keyId: string; |
@@ -1,5 +0,5 @@ | ||
export declare type Phrase = string; | ||
export declare type Tag = string; | ||
export declare type Metadata = Record<string, string>; | ||
declare type Screenshot = { | ||
export type Phrase = string; | ||
export type Tag = string; | ||
export type Metadata = Record<string, string>; | ||
type Screenshot = { | ||
id: string; | ||
@@ -6,0 +6,0 @@ url: string; |
@@ -1,3 +0,3 @@ | ||
export declare type WebhookEvent = 'project_published' | 'import_finished' | 'import_finished_empty' | 'comment_added'; | ||
export declare type Webhook = { | ||
export type WebhookEvent = 'project_published' | 'import_finished' | 'import_finished_empty' | 'comment_added'; | ||
export type Webhook = { | ||
enabled: boolean; | ||
@@ -9,5 +9,5 @@ customId?: string; | ||
}; | ||
declare type Webhooks = { | ||
type Webhooks = { | ||
items: Webhook[]; | ||
}; | ||
export default Webhooks; |
@@ -1,4 +0,4 @@ | ||
declare type CommonApiResult = { | ||
type CommonApiResult = { | ||
result: boolean; | ||
}; | ||
export default CommonApiResult; |
import CommonApiResult from './common-api-result'; | ||
declare type DeleteKeyResult = CommonApiResult; | ||
type DeleteKeyResult = CommonApiResult; | ||
export default DeleteKeyResult; |
import CommonApiResult from './common-api-result'; | ||
declare type DeleteScreenshotResult = CommonApiResult; | ||
type DeleteScreenshotResult = CommonApiResult; | ||
export default DeleteScreenshotResult; |
@@ -1,2 +0,2 @@ | ||
declare type FileResult = { | ||
type FileResult = { | ||
id: string; | ||
@@ -3,0 +3,0 @@ type: string; |
@@ -1,2 +0,2 @@ | ||
declare type Format = { | ||
type Format = { | ||
type: string; | ||
@@ -12,3 +12,3 @@ name: string; | ||
}; | ||
export declare type PluralMeta = { | ||
export type PluralMeta = { | ||
type: string; | ||
@@ -22,3 +22,3 @@ name: string; | ||
}; | ||
export declare type ArrayMeta = { | ||
export type ArrayMeta = { | ||
type: string; | ||
@@ -28,3 +28,3 @@ name: string; | ||
}; | ||
export declare type KeyTransformerMeta = { | ||
export type KeyTransformerMeta = { | ||
type: string; | ||
@@ -34,7 +34,7 @@ name: string; | ||
}; | ||
export declare type PluralFormat = Format & { | ||
export type PluralFormat = Format & { | ||
supportPlurals: true; | ||
plurals: PluralMeta[]; | ||
}; | ||
export declare type ArrayFormat = Format & { | ||
export type ArrayFormat = Format & { | ||
supportArrays: true; | ||
@@ -41,0 +41,0 @@ arrays: ArrayMeta[]; |
@@ -1,4 +0,4 @@ | ||
declare type GetWebhooksSecretResult = { | ||
type GetWebhooksSecretResult = { | ||
secret: string; | ||
}; | ||
export default GetWebhooksSecretResult; |
@@ -1,2 +0,2 @@ | ||
declare type ImportResult = { | ||
type ImportResult = { | ||
/** ID of the import batch */ | ||
@@ -3,0 +3,0 @@ result: string; |
@@ -1,2 +0,2 @@ | ||
export declare type Key = { | ||
export type Key = { | ||
id: string; | ||
@@ -11,3 +11,3 @@ /** nested keys are stored as array entries. Simple keys are arrays containing single item. */ | ||
}; | ||
declare type KeysInFile = { | ||
type KeysInFile = { | ||
keys: Key[]; | ||
@@ -14,0 +14,0 @@ /** Next is the paging key. The field is not contained if there are no more pages. */ |
@@ -1,2 +0,2 @@ | ||
declare type Language = { | ||
type Language = { | ||
id: number; | ||
@@ -3,0 +3,0 @@ code: string; |
import Screenshot from '../common/screenshots'; | ||
declare type ListScreenshotsResult = Screenshot[]; | ||
type ListScreenshotsResult = Screenshot[]; | ||
export default ListScreenshotsResult; |
import { Tag } from '../common/screenshots'; | ||
declare type ListScreenshotsTagsResult = Tag[]; | ||
type ListScreenshotsTagsResult = Tag[]; | ||
export default ListScreenshotsTagsResult; |
@@ -1,2 +0,2 @@ | ||
declare type Organization = { | ||
type Organization = { | ||
availableKeys: number; | ||
@@ -3,0 +3,0 @@ usedKeys: number; |
@@ -1,4 +0,4 @@ | ||
declare type PostScreenhotResult = { | ||
type PostScreenhotResult = { | ||
id: string; | ||
}; | ||
export default PostScreenhotResult; |
@@ -1,4 +0,4 @@ | ||
declare type PostScreenhotsResult = { | ||
type PostScreenhotsResult = { | ||
id: string; | ||
}; | ||
export default PostScreenhotsResult; |
import CommonApiResult from './common-api-result'; | ||
declare type PostWebhooksResult = CommonApiResult; | ||
type PostWebhooksResult = CommonApiResult; | ||
export default PostWebhooksResult; |
import Language from './language'; | ||
import Organization from './organization'; | ||
declare type Project = { | ||
type Project = { | ||
id: string; | ||
@@ -5,0 +5,0 @@ orgId: string; |
import CommonApiResult from './common-api-result'; | ||
declare type PutScreenshotResult = CommonApiResult; | ||
type PutScreenshotResult = CommonApiResult; | ||
export default PutScreenshotResult; |
import CommonApiResult from './common-api-result'; | ||
declare type UpdateKeyResult = CommonApiResult; | ||
type UpdateKeyResult = CommonApiResult; | ||
export default UpdateKeyResult; |
{ | ||
"name": "@localazy/ts-api", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "This is a Typescript library facilitating usage of Localazy's API.", | ||
@@ -10,6 +10,6 @@ "main": "dist/index.js", | ||
"lint": "eslint src --ext .js,.jsx,.ts,.tsxclear --fix", | ||
"build": "rimraf dist/* && tsc", | ||
"build": "rimraf dist/* && npx tsc", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm run lint", | ||
"version": "git add -A src", | ||
"version": "standard-version", | ||
"postversion": "git push && git push --tags" | ||
@@ -45,4 +45,5 @@ }, | ||
"rimraf": "^3.0.2", | ||
"standard-version": "^9.5.0", | ||
"typescript": "^4.5.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83073
136
1365
9