2017-05-26 14:18:57 +00:00
|
|
|
export default class AdRequest {
|
|
|
|
constructor() {
|
|
|
|
this._props = {
|
|
|
|
keywords: [],
|
2017-06-05 13:12:49 +00:00
|
|
|
testDevices: [],
|
2017-05-26 14:18:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
return this._props;
|
|
|
|
}
|
|
|
|
|
2017-06-05 13:12:49 +00:00
|
|
|
addTestDevice(deviceId?: string) {
|
2018-01-25 18:25:39 +00:00
|
|
|
this._props.testDevices.push(deviceId || 'DEVICE_ID_EMULATOR');
|
2017-05-26 14:18:57 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-05-27 16:02:03 +00:00
|
|
|
addKeyword(keyword: string) {
|
|
|
|
this._props.keywords.push(keyword);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
setBirthday() {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
setContentUrl(url: string) {
|
|
|
|
this._props.contentUrl = url;
|
2017-05-31 15:33:08 +00:00
|
|
|
return this;
|
2017-05-27 16:02:03 +00:00
|
|
|
}
|
|
|
|
|
2017-05-31 15:33:08 +00:00
|
|
|
setGender(gender: 'male | female | unknown') {
|
2017-06-01 10:15:37 +00:00
|
|
|
const genders = ['male', 'female', 'unknown'];
|
2017-05-31 15:33:08 +00:00
|
|
|
if (genders.includes(gender)) {
|
|
|
|
this._props.gender = gender;
|
|
|
|
}
|
|
|
|
return this;
|
2017-05-27 16:02:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setLocation() {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2017-05-31 15:33:08 +00:00
|
|
|
setRequestAgent(requestAgent: string) {
|
|
|
|
this._props.requestAgent = requestAgent;
|
|
|
|
return this;
|
2017-05-27 16:02:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setIsDesignedForFamilies(isDesignedForFamilies: boolean) {
|
|
|
|
this._props.isDesignedForFamilies = isDesignedForFamilies;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
tagForChildDirectedTreatment(tagForChildDirectedTreatment: boolean) {
|
|
|
|
this._props.tagForChildDirectedTreatment = tagForChildDirectedTreatment;
|
2017-05-26 14:18:57 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|