Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added note to use v5.7.0 in the interim
- Loading branch information
Showing
61 changed files
with
3,420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ICourierClientConfiguration } from "../types"; | ||
import * as AudienceTypes from "./types"; | ||
export declare const audiences: (options: ICourierClientConfiguration) => { | ||
delete: (audienceId: string) => Promise<void>; | ||
get: (audienceId: string) => Promise<AudienceTypes.IAudience>; | ||
listAudiences: (params?: { | ||
cursor: string; | ||
} | undefined) => Promise<AudienceTypes.IAudienceListResponse>; | ||
listMembers: (audienceId: string, params?: { | ||
cursor: string; | ||
} | undefined) => Promise<AudienceTypes.IAudienceMemberListResponse>; | ||
put: (audience: Omit<AudienceTypes.IAudience, "created_at" | "updated_at">) => Promise<AudienceTypes.IAudience>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) 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; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.audiences = void 0; | ||
var deleteAudience = function (options) { return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.delete("/audiences/" + audienceId)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; }; | ||
var getAudience = function (options) { | ||
return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId)]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.data.audience]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
var listAudiences = function (options) { | ||
return function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/audiences", params)]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.data]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
var listMembers = function (options) { | ||
return function (audienceId, params) { return __awaiter(void 0, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId + "/members", params)]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.data]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
var putAudience = function (options) { | ||
return function (audience) { return __awaiter(void 0, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.put("/audiences/" + audience.id, audience)]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response.data.audience]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
exports.audiences = function (options) { return ({ | ||
delete: deleteAudience(options), | ||
get: getAudience(options), | ||
listAudiences: listAudiences(options), | ||
listMembers: listMembers(options), | ||
put: putAudience(options) | ||
}); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export declare type ComparisonOperator = "EQ" | "GT" | "GTE" | "INCLUDES" | "LT" | "LTE" | "NEQ" | "OMIT"; | ||
export declare type LogicalOperator = "AND" | "OR"; | ||
export declare type Operator = ComparisonOperator | LogicalOperator; | ||
declare type Without<T, U> = { | ||
[P in Exclude<keyof T, keyof U>]?: never; | ||
}; | ||
declare type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U; | ||
interface IBaseFilterConfig { | ||
operator: Operator; | ||
} | ||
interface ISingleFilterConfig extends IBaseFilterConfig { | ||
path: string; | ||
value: string; | ||
} | ||
interface INestedFilterConfig extends IBaseFilterConfig { | ||
rules: FilterConfig[]; | ||
} | ||
export declare type FilterConfig = XOR<ISingleFilterConfig, INestedFilterConfig>; | ||
export interface IAudience { | ||
created_at: string; | ||
description?: string; | ||
id: string; | ||
name?: string; | ||
filter: FilterConfig; | ||
updated_at: string; | ||
} | ||
export interface IAudienceMember { | ||
added_at: string; | ||
audience_id: string; | ||
audience_version: number; | ||
member_id: string; | ||
reason: string; | ||
} | ||
export interface IAudienceListResponse { | ||
items: IAudience[]; | ||
paging: { | ||
cursor: string; | ||
more: boolean; | ||
}; | ||
} | ||
export interface IAudienceMemberGetResponse { | ||
audienceMember: IAudienceMember; | ||
} | ||
export interface IAudienceMemberListResponse { | ||
items: IAudienceMember[]; | ||
paging: { | ||
cursor: string; | ||
more: boolean; | ||
}; | ||
} | ||
export interface IAudiencePutResponse { | ||
audience: IAudience; | ||
} | ||
export interface ICourierClientAudiences { | ||
delete: (id: string) => Promise<void>; | ||
get: (id: string) => Promise<IAudience>; | ||
listAudiences: (params?: { | ||
cursor: string; | ||
}) => Promise<IAudienceListResponse>; | ||
listMembers: (id: string, params?: { | ||
cursor: string; | ||
}) => Promise<IAudienceMemberListResponse>; | ||
put: (audience: Omit<IAudience, "created_at" | "updated_at">) => Promise<IAudience>; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ICourierClientConfiguration } from "../types"; | ||
import { IAuditEvent, ICourierGetAuditEventParams, ICourierListAuditEventsParams, ICourierListAuditEventsResponse } from "./types"; | ||
export declare const auditEvents: (options: ICourierClientConfiguration) => { | ||
get: (params: ICourierGetAuditEventParams) => Promise<IAuditEvent>; | ||
list: (params: ICourierListAuditEventsParams) => Promise<ICourierListAuditEventsResponse>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) 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; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.auditEvents = void 0; | ||
var list = function (options) { | ||
return function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/audit-events", { | ||
params: { | ||
cursor: params.cursor | ||
} | ||
})]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.data]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
var get = function (options) { | ||
return function (params) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, options.httpClient.get("/audit-events/" + params.auditEventId)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.data]; | ||
} | ||
}); | ||
}); }; | ||
}; | ||
exports.auditEvents = function (options) { | ||
return { | ||
get: get(options), | ||
list: list(options) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export interface ICourierListAuditEventsParams { | ||
cursor?: string; | ||
} | ||
export interface ICourierGetAuditEventParams { | ||
auditEventId: string; | ||
} | ||
export interface ICourierListAuditEventsResponse { | ||
paging: { | ||
cursor?: string; | ||
more: boolean; | ||
}; | ||
results: IAuditEvent[]; | ||
} | ||
export interface IAuditEvent { | ||
actor?: { | ||
id?: string; | ||
email?: string; | ||
}; | ||
target?: { | ||
id?: string; | ||
email?: string; | ||
}; | ||
auditEventId: string; | ||
source: string; | ||
timestamp: string; | ||
type: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { ICourierClientConfiguration } from "../types"; | ||
import { ICourierClientAutomations } from "./types"; | ||
export declare const automations: (options: ICourierClientConfiguration) => ICourierClientAutomations; |
Oops, something went wrong.