@localazy/ts-api
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -5,2 +5,3 @@ declare type Common = { | ||
options?: Record<string, unknown>; | ||
rawData?: string; | ||
}; | ||
@@ -10,4 +11,6 @@ export default class LocalazyAPI { | ||
static post(options: Common): Promise<any>; | ||
static put(options: Common): Promise<any>; | ||
static delete(options: Common): Promise<any>; | ||
private static getQueryString; | ||
} | ||
export {}; |
@@ -84,2 +84,70 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var body, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (options.rawData) { | ||
body = options.rawData; | ||
} | ||
else if (options.options) { | ||
body = JSON.stringify(options.options); | ||
} | ||
return [4 /*yield*/, fetch("".concat(options.url), { | ||
method: 'POST', | ||
headers: { | ||
Authorization: "Bearer ".concat(options.projectToken), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: body, | ||
}).catch(function (e) { | ||
throw e; | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
Object.defineProperty(LocalazyAPI, "put", { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var body, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (options.rawData) { | ||
body = options.rawData; | ||
} | ||
else if (options.options) { | ||
body = JSON.stringify(options.options); | ||
} | ||
return [4 /*yield*/, fetch("".concat(options.url), { | ||
method: 'PUT', | ||
headers: { | ||
Authorization: "Bearer ".concat(options.projectToken), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: body, | ||
}).catch(function (e) { | ||
throw e; | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.json()]; | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
Object.defineProperty(LocalazyAPI, "delete", { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response; | ||
@@ -89,8 +157,6 @@ return __generator(this, function (_a) { | ||
case 0: return [4 /*yield*/, fetch("".concat(options.url), { | ||
method: 'POST', | ||
method: 'DELETE', | ||
headers: { | ||
Authorization: "Bearer ".concat(options.projectToken), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: options.options ? JSON.stringify(options.options) : undefined, | ||
}).catch(function (e) { | ||
@@ -97,0 +163,0 @@ throw e; |
@@ -16,2 +16,14 @@ import Constructor from './models/arguments/constructor'; | ||
import PostWebhooksResult from './models/responses/post-webhooks-result'; | ||
import ListScreenshots from './models/arguments/list-screenshots'; | ||
import ListScreenshotsResult from './models/responses/list-screenshots-result'; | ||
import ListScreenshotsTags from './models/arguments/list-screenshots-tags'; | ||
import ListScreenshotsTagsResult from './models/responses/list-screenshots-tags-result'; | ||
import PostScreenshots from './models/arguments/post-screenshots'; | ||
import PostScreenshotsResult from './models/responses/post-screenshots-result'; | ||
import PostScreenshot from './models/arguments/post-screenshot'; | ||
import PostScreenshotResult from './models/responses/post-screenshot-result'; | ||
import PutScreenshot from './models/arguments/put-screenshot'; | ||
import PutScreenshotResult from './models/responses/put-screenshot-result'; | ||
import DeleteScreenshot from './models/arguments/delete-screenshot'; | ||
import DeleteScreenshotResult from './models/responses/delete-screenshot-result'; | ||
declare class LocalazyService { | ||
@@ -56,4 +68,30 @@ private projectToken; | ||
postWebhooks(options: PostWebhooks, config?: CommonConfig): Promise<PostWebhooksResult>; | ||
/** | ||
* Retrieve list of screenshots for project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
listScreenshots(options: ListScreenshots, config?: CommonConfig): Promise<ListScreenshotsResult>; | ||
/** | ||
* Retrive list of screenshots tags for project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
listScreenshotsTags(options: ListScreenshotsTags, config?: CommonConfig): Promise<ListScreenshotsTagsResult>; | ||
/** | ||
* Upload a new screenshot for the project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
postScreenshots(options: PostScreenshots, config?: CommonConfig): Promise<PostScreenshotsResult>; | ||
/** | ||
* Change image data of existing screenshot. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
postScreenshot(options: PostScreenshot, config?: CommonConfig): Promise<PostScreenshotResult>; | ||
/** | ||
* Change existing screenshot (metadata). | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
putScreenshot(options: PutScreenshot, config?: CommonConfig): Promise<PutScreenshotResult>; | ||
deleteScreenshot(options: DeleteScreenshot, config?: CommonConfig): Promise<DeleteScreenshotResult>; | ||
} | ||
export default function LocalazyServiceFactory(options: Constructor): LocalazyService; | ||
export {}; |
@@ -226,2 +226,133 @@ "use strict"; | ||
}); | ||
/** | ||
* Retrieve list of screenshots for project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "listScreenshots", { | ||
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; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId; | ||
return [2 /*return*/, api_1.default.get({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots"), | ||
projectToken: config.projectToken || this.projectToken, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Retrive list of screenshots tags for project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "listScreenshotsTags", { | ||
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; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId; | ||
return [2 /*return*/, api_1.default.get({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots/tags"), | ||
projectToken: config.projectToken || this.projectToken, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Upload a new screenshot for the project. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "postScreenshots", { | ||
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; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId; | ||
return [2 /*return*/, api_1.default.post({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots"), | ||
projectToken: config.projectToken || this.projectToken, | ||
rawData: options.rawScreenshot, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Change image data of existing screenshot. | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "postScreenshot", { | ||
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, screenshotId; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId, screenshotId = options.screenshotId; | ||
return [2 /*return*/, api_1.default.post({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots/").concat(screenshotId), | ||
projectToken: config.projectToken || this.projectToken, | ||
rawData: options.rawScreenshot, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Change existing screenshot (metadata). | ||
* @see https://localazy.com/docs/api/screenshots | ||
*/ | ||
Object.defineProperty(LocalazyService.prototype, "putScreenshot", { | ||
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, screenshotId; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId, screenshotId = options.screenshotId; | ||
return [2 /*return*/, api_1.default.put({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots/").concat(screenshotId), | ||
projectToken: config.projectToken || this.projectToken, | ||
options: options.screenshot, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
Object.defineProperty(LocalazyService.prototype, "deleteScreenshot", { | ||
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, screenshotId; | ||
return __generator(this, function (_a) { | ||
projectId = options.projectId, screenshotId = options.screenshotId; | ||
return [2 /*return*/, api_1.default.delete({ | ||
url: "".concat(config.baseUrl || this.baseUrl, "/projects/").concat(projectId, "/screenshots/").concat(screenshotId), | ||
projectToken: config.projectToken || this.projectToken, | ||
})]; | ||
}); | ||
}); | ||
} | ||
}); | ||
return LocalazyService; | ||
@@ -228,0 +359,0 @@ }()); |
@@ -1,4 +0,3 @@ | ||
declare type PostWebhooksResult = { | ||
result: boolean; | ||
}; | ||
import CommonApiResult from './common-api-result'; | ||
declare type PostWebhooksResult = CommonApiResult; | ||
export default PostWebhooksResult; |
{ | ||
"name": "@localazy/ts-api", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "This is a Typescript library facilitating usage of Localazy's API.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
61248
110
1056
4