@guardian/bridget
Advanced tools
Comparing version 0.61.0 to 0.62.0
import * as thrift from "@creditkarma/thrift-server-core"; | ||
import * as Rect from "./Rect"; | ||
export interface IAdSlot { | ||
x: number; | ||
y: number; | ||
height?: number; | ||
width?: number; | ||
rect: Rect.IRect; | ||
targetingParams?: Map<string, string>; | ||
} | ||
export interface IAdSlotArgs { | ||
x: number; | ||
y: number; | ||
height?: number; | ||
width?: number; | ||
rect: Rect.IRectArgs; | ||
targetingParams?: Map<string, string>; | ||
@@ -18,6 +13,3 @@ } | ||
export declare class AdSlot extends thrift.StructLike implements IAdSlot { | ||
x: number; | ||
y: number; | ||
height?: number; | ||
width?: number; | ||
rect: Rect.IRect; | ||
targetingParams?: Map<string, string>; | ||
@@ -24,0 +16,0 @@ readonly _annotations: thrift.IThriftAnnotations; |
115
AdSlot.js
@@ -17,40 +17,20 @@ "use strict"; | ||
const thrift = __importStar(require("@creditkarma/thrift-server-core")); | ||
const Rect = __importStar(require("./Rect")); | ||
exports.AdSlotCodec = { | ||
encode(args, output) { | ||
const obj = { | ||
x: args.x, | ||
y: args.y, | ||
height: args.height, | ||
width: args.width, | ||
rect: args.rect, | ||
targetingParams: args.targetingParams | ||
}; | ||
output.writeStructBegin("AdSlot"); | ||
if (obj.x != null) { | ||
output.writeFieldBegin("x", thrift.TType.I32, 1); | ||
output.writeI32(obj.x); | ||
if (obj.rect != null) { | ||
output.writeFieldBegin("rect", thrift.TType.STRUCT, 1); | ||
Rect.RectCodec.encode(obj.rect, output); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[x] is unset!"); | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[rect] is unset!"); | ||
} | ||
if (obj.y != null) { | ||
output.writeFieldBegin("y", thrift.TType.I32, 2); | ||
output.writeI32(obj.y); | ||
output.writeFieldEnd(); | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[y] is unset!"); | ||
} | ||
if (obj.height != null) { | ||
output.writeFieldBegin("height", thrift.TType.I32, 3); | ||
output.writeI32(obj.height); | ||
output.writeFieldEnd(); | ||
} | ||
if (obj.width != null) { | ||
output.writeFieldBegin("width", thrift.TType.I32, 4); | ||
output.writeI32(obj.width); | ||
output.writeFieldEnd(); | ||
} | ||
if (obj.targetingParams != null) { | ||
output.writeFieldBegin("targetingParams", thrift.TType.MAP, 5); | ||
output.writeFieldBegin("targetingParams", thrift.TType.MAP, 2); | ||
output.writeMapBegin(thrift.TType.STRING, thrift.TType.STRING, obj.targetingParams.size); | ||
@@ -80,5 +60,5 @@ obj.targetingParams.forEach((value_1, key_1) => { | ||
case 1: | ||
if (fieldType === thrift.TType.I32) { | ||
const value_2 = input.readI32(); | ||
_args.x = value_2; | ||
if (fieldType === thrift.TType.STRUCT) { | ||
const value_2 = Rect.RectCodec.decode(input); | ||
_args.rect = value_2; | ||
} | ||
@@ -90,31 +70,4 @@ else { | ||
case 2: | ||
if (fieldType === thrift.TType.I32) { | ||
const value_3 = input.readI32(); | ||
_args.y = value_3; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 3: | ||
if (fieldType === thrift.TType.I32) { | ||
const value_4 = input.readI32(); | ||
_args.height = value_4; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 4: | ||
if (fieldType === thrift.TType.I32) { | ||
const value_5 = input.readI32(); | ||
_args.width = value_5; | ||
} | ||
else { | ||
input.skip(fieldType); | ||
} | ||
break; | ||
case 5: | ||
if (fieldType === thrift.TType.MAP) { | ||
const value_6 = new Map(); | ||
const value_3 = new Map(); | ||
const metadata_1 = input.readMapBegin(); | ||
@@ -124,7 +77,7 @@ const size_1 = metadata_1.size; | ||
const key_2 = input.readString(); | ||
const value_7 = input.readString(); | ||
value_6.set(key_2, value_7); | ||
const value_4 = input.readString(); | ||
value_3.set(key_2, value_4); | ||
} | ||
input.readMapEnd(); | ||
_args.targetingParams = value_6; | ||
_args.targetingParams = value_3; | ||
} | ||
@@ -142,8 +95,5 @@ else { | ||
input.readStructEnd(); | ||
if (_args.x !== undefined && _args.y !== undefined) { | ||
if (_args.rect !== undefined) { | ||
return { | ||
x: _args.x, | ||
y: _args.y, | ||
height: _args.height, | ||
width: _args.width, | ||
rect: _args.rect, | ||
targetingParams: _args.targetingParams | ||
@@ -162,32 +112,17 @@ }; | ||
this._fieldAnnotations = {}; | ||
if (args.x != null) { | ||
const value_8 = args.x; | ||
this.x = value_8; | ||
if (args.rect != null) { | ||
const value_5 = new Rect.Rect(args.rect); | ||
this.rect = value_5; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[x] is unset!"); | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[rect] is unset!"); | ||
} | ||
if (args.y != null) { | ||
const value_9 = args.y; | ||
this.y = value_9; | ||
} | ||
else { | ||
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[y] is unset!"); | ||
} | ||
if (args.height != null) { | ||
const value_10 = args.height; | ||
this.height = value_10; | ||
} | ||
if (args.width != null) { | ||
const value_11 = args.width; | ||
this.width = value_11; | ||
} | ||
if (args.targetingParams != null) { | ||
const value_12 = new Map(); | ||
args.targetingParams.forEach((value_13, key_3) => { | ||
const value_14 = value_13; | ||
const value_6 = new Map(); | ||
args.targetingParams.forEach((value_7, key_3) => { | ||
const value_8 = value_7; | ||
const key_4 = key_3; | ||
value_12.set(key_4, value_14); | ||
value_6.set(key_4, value_8); | ||
}); | ||
this.targetingParams = value_12; | ||
this.targetingParams = value_6; | ||
} | ||
@@ -194,0 +129,0 @@ } |
@@ -0,1 +1,2 @@ | ||
export * from "./Rect"; | ||
export * from "./AdSlot"; | ||
@@ -6,2 +7,3 @@ export * from "./Topic"; | ||
export * from "./MaybeEpic"; | ||
export * from "./VideoSlot"; | ||
import * as Environment from "./Environment"; | ||
@@ -19,1 +21,3 @@ export { Environment as Environment }; | ||
export { Gallery as Gallery }; | ||
import * as Videos from "./Videos"; | ||
export { Videos as Videos }; |
@@ -19,2 +19,3 @@ "use strict"; | ||
*/ | ||
__export(require("./Rect")); | ||
__export(require("./AdSlot")); | ||
@@ -25,2 +26,3 @@ __export(require("./Topic")); | ||
__export(require("./MaybeEpic")); | ||
__export(require("./VideoSlot")); | ||
const Environment = __importStar(require("./Environment")); | ||
@@ -38,1 +40,3 @@ exports.Environment = Environment; | ||
exports.Gallery = Gallery; | ||
const Videos = __importStar(require("./Videos")); | ||
exports.Videos = Videos; |
{ | ||
"name": "@guardian/bridget", | ||
"version": "0.61.0", | ||
"version": "0.62.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
204252
32
5215