@@ -44,26 +44,7 @@ async function run(): Promise<void> {
4444 let nextCreatedAt : string | undefined ;
4545
4646 do {
47- const params = new URLSearchParams ( ) ;
48- if ( limit ) {
49- params . append ( 'limit' , limit ) ;
50- }
51- if ( nextId ) {
52- params . append ( 'nextId' , nextId ) ;
53- }
54- if ( nextCreatedAt ) {
55- params . append ( 'nextCreatedAt' , nextCreatedAt ) ;
56- }
57- if ( connectivity ) {
58- connectivity . split ( ',' ) . map ( value => value . trim ( ) ) . forEach ( value => {
59- params . append ( 'connectivity[]' , value ) ;
60- } ) ;
61- }
62- if ( status ) {
63- status . split ( ',' ) . map ( value => value . trim ( ) ) . forEach ( value => {
64- params . append ( 'status[]' , value ) ;
65- } ) ;
66- }
47+ const params = buildUrlParams ( limit , nextId , nextCreatedAt , connectivity , status ) ;
6748
6849 const response = await client . get (
6950 `${ baseUrl } /api/v2/projects/${ projectId } /entry-points${ params . toString ( ) ? `?${ params . toString ( ) } ` : '' } `
@@ -95,4 +76,35 @@ async function run(): Promise<void> {
9576 }
9677}
9778
79+ function buildUrlParams (
80+ limit : string ,
81+ nextId : string | undefined ,
82+ nextCreatedAt : string | undefined ,
83+ connectivity : string ,
84+ status : string
85+ ) : URLSearchParams {
86+ const params = new URLSearchParams ( ) ;
87+ if ( limit ) {
88+ params . append ( 'limit' , limit ) ;
89+ }
90+ if ( nextId ) {
91+ params . append ( 'nextId' , nextId ) ;
92+ }
93+ if ( nextCreatedAt ) {
94+ params . append ( 'nextCreatedAt' , nextCreatedAt ) ;
95+ }
96+ if ( connectivity ) {
97+ connectivity . split ( ',' ) . map ( value => value . trim ( ) ) . forEach ( value => {
98+ params . append ( 'connectivity[]' , value ) ;
99+ } ) ;
100+ }
101+ if ( status ) {
102+ status . split ( ',' ) . map ( value => value . trim ( ) ) . forEach ( value => {
103+ params . append ( 'status[]' , value ) ;
104+ } ) ;
105+ }
106+
107+ return params ;
108+ }
109+
98110void run ( ) ;
0 commit comments