@@ -226,10 +226,7 @@ export const createEntry = async (
226226 return error ;
227227 }
228228} ;
229- //scheduling publish of entry with respective to the current month
230- const date = new Date ( ) ;
231- const currentMonth = ( "0" + ( date . getMonth ( ) + 1 ) ) . slice ( - 2 ) ;
232- const publishDate = "2023-" + `${ currentMonth } ` + "-13" ;
229+
233230//publish an entry
234231export const publishEntry = async (
235232 authToken : string | undefined ,
@@ -254,45 +251,6 @@ export const publishEntry = async (
254251 } ,
255252 locale : "en-us" ,
256253 version : 1 ,
257- scheduled_at : `${ publishDate } T15:30:00.0002` ,
258- } ,
259- } ;
260- try {
261- let result = await axios ( options ) ;
262- return result . data ;
263- } catch ( error ) {
264- return error ;
265- }
266- } ;
267- //creating releases
268- export const createRelease = async (
269- authToken : string | undefined ,
270- contentTypeId : string | undefined ,
271- entryId : string | undefined ,
272- stackApiKey : string | undefined ,
273- mgmtToken : string | undefined
274- ) => {
275- let generateTitle = `Test Release ${ Math . floor ( Math . random ( ) * 1000 ) } ` ;
276- let options = {
277- url : `https://${ process . env . BASE_API_URL } /v3/releases?include` ,
278- method : "POST" ,
279- headers : {
280- api_key : stackApiKey ,
281- authtoken : authToken ,
282- authorization : mgmtToken ,
283- "Content-type" : "application/json" ,
284- } ,
285- data : {
286- release : {
287- name : generateTitle ,
288- description : "Json editor app e2e testing demo data" ,
289- item : {
290- uid : entryId ,
291- content_type_uid : contentTypeId ,
292- action : "publish" ,
293- locale : "en-us" ,
294- } ,
295- } ,
296254 } ,
297255 } ;
298256 try {
@@ -302,6 +260,7 @@ export const createRelease = async (
302260 return error ;
303261 }
304262} ;
263+
305264//adding entry to release
306265export const addEntryToRelease = async (
307266 authToken : string | undefined ,
@@ -336,62 +295,4 @@ export const addEntryToRelease = async (
336295 } catch ( error ) {
337296 return error ;
338297 }
339- } ;
340- //deploy the release
341- export const deployRelease = async (
342- authToken : string | undefined ,
343- stackApiKey : string | undefined ,
344- mgmtToken : string | undefined ,
345- releaseID : string | undefined
346- ) => {
347- let options = {
348- url : `https://${ process . env . BASE_API_URL } /v3/releases/${ releaseID } /deploy` ,
349- method : "POST" ,
350- headers : {
351- api_key : stackApiKey ,
352- authtoken : authToken ,
353- authorization : mgmtToken ,
354- "Content-type" : "application/json" ,
355- } ,
356- data : {
357- release : {
358- scheduled_at : `${ publishDate } T15:27:29.0002` ,
359- action : "publish" ,
360- environments : [ "preview" ] ,
361- locales : [ "en-us" ] ,
362- } ,
363- } ,
364- } ;
365- try {
366- let result = await axios ( options ) ;
367- return result . data ;
368- } catch ( error ) {
369- return error ;
370- }
371- } ;
372- // get list of apps/extension IDs
373- export const getExtensionFieldUid = async (
374- authToken : string ,
375- stackApiKey : string | undefined
376- ) : Promise < ExtensionUid [ ] > => {
377- let options = {
378- url : `https://${ process . env . BASE_API_URL } /v3/extensions` ,
379- method : "GET" ,
380- params : {
381- query : {
382- type : "field" ,
383- } ,
384- include_marketplace_extensions : true ,
385- } ,
386- headers : {
387- api_key : stackApiKey ,
388- authtoken : authToken ,
389- } ,
390- } ;
391- try {
392- let result = await axios ( options ) ;
393- return result . data . extensions [ 0 ] . uid ;
394- } catch ( error ) {
395- return error ;
396- }
397298} ;
0 commit comments