@trycourier/courier
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
## [v1.5.0] - 2020-07-08 | ||
### Added | ||
- Support for [Brands API](https://docs.trycourier.com/reference/brands-api) by @aydrian | ||
- `GET /brands` via `client.getBrands(params)` | ||
- `GET /brands/:brand_id` via `client.getBrand(brandId)` | ||
- `POST /brands` via `client.createBrand({…})` | ||
- `PUT /brands/:brand_id` via `client.replaceBrand({…})` | ||
- `DELETE /brands/:brand_id` via `client.deleteBrand(brandId)` | ||
- Support for specifying notification brand during [send](https://docs.trycourier.com/reference/send-api#sendmessage) by @aydrian | ||
## [v1.4.0] - 2020-06-29 | ||
@@ -11,3 +22,3 @@ | ||
- Support /messages/:messageId via client.getMessage(:messageId) @rileylnapier | ||
- Support `GET /messages/:messageId` via `client.getMessage(messageId)` @rileylnapier | ||
@@ -59,2 +70,18 @@ ## [v1.3.0] - 2020-03-10 | ||
## [v1.0.1] - 2019-07-12 | ||
## v1.0.1 - 2019-07-12 | ||
[v1.5.0]: https://github.com/trycourier/courier-python/compare/v1.4.0...v1.5.0 | ||
[v1.4.0]: https://github.com/trycourier/courier-python/compare/v1.3.0...v1.4.0 | ||
[v1.3.0]: https://github.com/trycourier/courier-python/compare/v1.2.1...v1.3.0 | ||
[v1.2.1]: https://github.com/trycourier/courier-python/compare/v1.2.0...v1.2.1 | ||
[v1.2.0]: https://github.com/trycourier/courier-python/compare/v1.1.6...v1.2.0 | ||
[v1.1.6]: https://github.com/trycourier/courier-python/compare/v1.1.5...v1.1.6 | ||
[v1.1.5]: https://github.com/trycourier/courier-python/compare/v1.1.4...v1.1.5 | ||
[v1.1.4]: https://github.com/trycourier/courier-python/compare/v1.1.3...v1.1.4 | ||
[v1.1.3]: https://github.com/trycourier/courier-python/compare/v1.1.2...v1.1.3 | ||
[v1.1.2]: https://github.com/trycourier/courier-python/compare/v1.1.1...v1.1.2 | ||
[v1.1.1]: https://github.com/trycourier/courier-python/compare/v1.1.0...v1.1.1 | ||
[v1.1.0]: https://github.com/trycourier/courier-python/compare/v1.0.4...v1.1.0 | ||
[v1.0.4]: https://github.com/trycourier/courier-python/compare/v1.0.3...v1.0.4 | ||
[v1.0.3]: https://github.com/trycourier/courier-python/compare/v1.0.2...v1.0.3 | ||
[v1.0.2]: https://github.com/trycourier/courier-python/compare/v1.0.1...v1.0.2 |
@@ -39,2 +39,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.client = void 0; | ||
var brands_1 = require("./brands"); | ||
var send = function (options) { | ||
@@ -46,2 +48,3 @@ return function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
case 0: return [4 /*yield*/, options.httpClient.post("/send", { | ||
brand: params.brand, | ||
data: params.data, | ||
@@ -119,5 +122,10 @@ event: params.eventId, | ||
return { | ||
createBrand: brands_1.createBrand(options), | ||
deleteBrand: brands_1.deleteBrand(options), | ||
getBrand: brands_1.getBrand(options), | ||
getBrands: brands_1.getBrands(options), | ||
getMessage: getMessage(options), | ||
getProfile: getProfile(options), | ||
mergeProfile: mergeProfile(options), | ||
replaceBrand: brands_1.replaceBrand(options), | ||
replaceProfile: replaceProfile(options), | ||
@@ -124,0 +132,0 @@ send: send(options) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CourierClient = void 0; | ||
var axios_1 = require("axios"); | ||
@@ -4,0 +5,0 @@ var client_1 = require("./client"); |
@@ -9,2 +9,3 @@ export declare type HttpMethodClient = <T>(url: string, body?: object) => Promise<{ | ||
get: HttpMethodClient; | ||
delete: HttpMethodClient; | ||
} | ||
@@ -22,2 +23,3 @@ export interface ICourierClientOptions { | ||
data?: object; | ||
brand?: string; | ||
preferences?: ICourierProfilePreferences; | ||
@@ -71,2 +73,47 @@ profile?: object; | ||
} | ||
interface ICourierBrandSettings { | ||
colors?: { | ||
primary: string; | ||
secondary: string; | ||
tertiary: string; | ||
}; | ||
email?: { | ||
footer: object; | ||
header: object; | ||
}; | ||
} | ||
interface ICourierBrandSnippets { | ||
items: Array<{ | ||
format: string; | ||
name: string; | ||
value: string; | ||
}>; | ||
} | ||
export interface ICourierBrand { | ||
created: number; | ||
id?: string; | ||
name: string; | ||
published: number; | ||
settings: ICourierBrandSettings; | ||
updated: number; | ||
snippets?: ICourierBrandSnippets; | ||
version: string; | ||
} | ||
export interface ICourierPaging { | ||
cursor?: string; | ||
more: boolean; | ||
} | ||
export interface ICourierBrandParameters { | ||
id?: string; | ||
name: string; | ||
settings: ICourierBrandSettings; | ||
snippets?: ICourierBrandSnippets; | ||
} | ||
export interface ICourierBrandPutParameters extends ICourierBrandParameters { | ||
id: string; | ||
} | ||
export interface ICourierBrandGetAllResponse { | ||
paging: ICourierPaging; | ||
results: ICourierBrand[]; | ||
} | ||
export declare type ICourierChannelClassification = "direct_message" | "email" | "push" | "webhook"; | ||
@@ -82,2 +129,10 @@ export interface ICourierProfilePreferences { | ||
getProfile: (params: ICourierProfileGetParameters) => Promise<ICourierProfileGetResponse>; | ||
getBrands: (params?: { | ||
cursor: string; | ||
}) => Promise<ICourierBrandGetAllResponse>; | ||
getBrand: (brandId: string) => Promise<ICourierBrand>; | ||
createBrand: (params: ICourierBrandParameters) => Promise<ICourierBrand>; | ||
replaceBrand: (params: ICourierBrandPutParameters) => Promise<ICourierBrand>; | ||
deleteBrand: (brandId: string) => Promise<void>; | ||
} | ||
export {}; |
{ | ||
"name": "@trycourier/courier", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "A node.js module for communicating with the Courier REST API.", | ||
@@ -36,2 +36,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
@@ -53,2 +53,3 @@ # `@trycourier/courier` | ||
data: {}, // optional | ||
brand: "<BRAND_ID>", //optional | ||
preferences: {}, // optional | ||
@@ -86,2 +87,42 @@ override: {} // optional | ||
console.log(profile); | ||
// Example: get all brands | ||
const {paging, results} = await courier.getBrands({ | ||
cursor: "<CURSOR>" // optional | ||
}); | ||
console.log(results); | ||
// Example: get a specific brand | ||
const brand = await courier.getBrand("<BRAND_ID>"); | ||
console.log(brand); | ||
// Example: create a brand | ||
const newBrand = await courier.createBrand({ | ||
name: "My Brand", | ||
settings: { | ||
color: { | ||
primary: "#0000FF", | ||
secondary: "#FF0000", | ||
tertiary: "#00FF00" | ||
} | ||
} | ||
}); | ||
console.log(newBrand); | ||
// Example: replace a brand | ||
const replacedBrand = await courier.replaceBrand({ | ||
id: "<BRAND_ID>", | ||
name: "My New Brand", | ||
settings: { | ||
color: { | ||
primary: "#FF0000", | ||
secondary: "#00FF00", | ||
tertiary: "#0000FF" | ||
} | ||
} | ||
}); | ||
console.log(replacedBrand); | ||
// Example: delete a brand | ||
await courier.deleteBrand("<BRAND_ID>"); | ||
} | ||
@@ -88,0 +129,0 @@ |
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
26291
12
425
138