@pipedream/linkedin_ads 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/linkedin_ads.app.mjs +105 -0
- package/package.json +1 -1
package/linkedin_ads.app.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import app from "../linkedin/linkedin.app.mjs";
|
|
2
|
+
import utils from "./common/utils.mjs";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
...app,
|
|
@@ -71,6 +72,57 @@ export default {
|
|
|
71
72
|
}));
|
|
72
73
|
},
|
|
73
74
|
},
|
|
75
|
+
eventId: {
|
|
76
|
+
type: "string",
|
|
77
|
+
label: "Event ID",
|
|
78
|
+
description: "The ID of the event to retrieve registrations for.",
|
|
79
|
+
async options({
|
|
80
|
+
organizationId, page,
|
|
81
|
+
}) {
|
|
82
|
+
if (!organizationId) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
const count = 20;
|
|
86
|
+
const { elements } = await this.searchEvents({
|
|
87
|
+
params: {
|
|
88
|
+
q: "organizerLeadGenFormEnabledEvents",
|
|
89
|
+
organizer: this.getOrganizationUrn(organizationId),
|
|
90
|
+
count,
|
|
91
|
+
start: page * count,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
return elements?.map(({
|
|
95
|
+
id: value, localizedName: label,
|
|
96
|
+
}) => ({
|
|
97
|
+
label,
|
|
98
|
+
value,
|
|
99
|
+
}));
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
conversionId: {
|
|
103
|
+
type: "string",
|
|
104
|
+
label: "Conversion ID",
|
|
105
|
+
description: "The ID of the conversion event.",
|
|
106
|
+
async options({
|
|
107
|
+
adAccountId, page,
|
|
108
|
+
}) {
|
|
109
|
+
const count = 20;
|
|
110
|
+
const { elements } = await this.searchConversions({
|
|
111
|
+
params: {
|
|
112
|
+
q: "account",
|
|
113
|
+
account: this.getSponsoredAccountUrn(adAccountId),
|
|
114
|
+
count,
|
|
115
|
+
start: page * count,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
return elements?.map(({
|
|
119
|
+
id: value, name: label,
|
|
120
|
+
}) => ({
|
|
121
|
+
label,
|
|
122
|
+
value,
|
|
123
|
+
}));
|
|
124
|
+
},
|
|
125
|
+
},
|
|
74
126
|
},
|
|
75
127
|
methods: {
|
|
76
128
|
...app.methods,
|
|
@@ -80,6 +132,15 @@ export default {
|
|
|
80
132
|
getSponsoredCampaignUrn(id) {
|
|
81
133
|
return `urn:li:sponsoredCampaign:${id}`;
|
|
82
134
|
},
|
|
135
|
+
getOrganizationUrn(id) {
|
|
136
|
+
return `urn:li:organization:${id}`;
|
|
137
|
+
},
|
|
138
|
+
getConversionUrn(id) {
|
|
139
|
+
return `urn:lla:llaPartnerConversion:${id}`;
|
|
140
|
+
},
|
|
141
|
+
getEventUrn(id) {
|
|
142
|
+
return `urn:li:event:${id}`;
|
|
143
|
+
},
|
|
83
144
|
searchCampaigns({
|
|
84
145
|
adAccountId, ...args
|
|
85
146
|
} = {}) {
|
|
@@ -88,5 +149,49 @@ export default {
|
|
|
88
149
|
...args,
|
|
89
150
|
});
|
|
90
151
|
},
|
|
152
|
+
searchLeadForms(args = {}) {
|
|
153
|
+
const keys = [
|
|
154
|
+
"owner",
|
|
155
|
+
];
|
|
156
|
+
return this._makeRequest({
|
|
157
|
+
debug: true,
|
|
158
|
+
path: "/leadForms",
|
|
159
|
+
paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
|
|
160
|
+
...args,
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
searchEvents(args = {}) {
|
|
164
|
+
const keys = [
|
|
165
|
+
"organizer",
|
|
166
|
+
];
|
|
167
|
+
return this._makeRequest({
|
|
168
|
+
debug: true,
|
|
169
|
+
path: "/events",
|
|
170
|
+
paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
|
|
171
|
+
transformResponse: utils.transformResponse,
|
|
172
|
+
...args,
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
searchConversions(args = {}) {
|
|
176
|
+
return this._makeRequest({
|
|
177
|
+
debug: true,
|
|
178
|
+
path: "/conversions",
|
|
179
|
+
paramsSerializer: utils.getParamsSerializer(utils.encodeFn),
|
|
180
|
+
...args,
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
searchLeadFormResponses(args = {}) {
|
|
184
|
+
const keys = [
|
|
185
|
+
"owner",
|
|
186
|
+
"versionedLeadGenFormUrn",
|
|
187
|
+
"associatedEntity",
|
|
188
|
+
];
|
|
189
|
+
return this._makeRequest({
|
|
190
|
+
debug: true,
|
|
191
|
+
path: "/leadFormResponses",
|
|
192
|
+
paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
|
|
193
|
+
...args,
|
|
194
|
+
});
|
|
195
|
+
},
|
|
91
196
|
},
|
|
92
197
|
};
|