-
Notifications
You must be signed in to change notification settings - Fork 5
/
api.go
850 lines (700 loc) · 22.1 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
package confluence
// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
import (
"errors"
"fmt"
"strconv"
"strings"
"time"
)
// ////////////////////////////////////////////////////////////////////////////////// //
// Content type
const (
CONTENT_TYPE_ATTACHMENT = "attachment"
CONTENT_TYPE_BLOGPOST = "blogpost"
CONTENT_TYPE_COMMENT = "comment"
CONTENT_TYPE_PAGE = "page"
)
// Excerpt values
const (
SEARCH_EXCERPT_INDEXED = "indexed"
SEARCH_EXCERPT_HIGHLIGHT = "highlight"
SEARCH_EXCERPT_NONE = "none"
)
// Space type
const (
SPACE_TYPE_PERSONAL = "personal"
SPACE_TYPE_GLOBAL = "global"
)
// Content status
const (
SPACE_STATUS_CURRENT = "current"
SPACE_STATUS_ARCHIVED = "archived"
)
// Space status
const (
CONTENT_STATUS_CURRENT = "current"
CONTENT_STATUS_TRASHED = "trashed"
CONTENT_STATUS_DRAFT = "draft"
)
// Units
const (
UNITS_MINUTES = "minutes"
UNITS_HOURS = "hours"
UNITS_DAYS = "days"
UNITS_MONTHS = "months"
UNITS_YEARS = "years"
)
// Operations types
const (
OPERATION_READ = "read"
OPERATION_UPDATE = "update"
)
// ////////////////////////////////////////////////////////////////////////////////// //
// Parameters is interface for parameters structs
type Parameters interface {
ToQuery() string
Validate() error
}
// ////////////////////////////////////////////////////////////////////////////////// //
// Date is RFC3339 encoded date
type Date struct {
time.Time
}
// Timestamp is UNIX timestamp in ms
type Timestamp struct {
time.Time
}
// ContainerID is container ID
type ContainerID string
// ExtensionPosition is extension position
type ExtensionPosition int
// EmptyParameters is empty parameters
type EmptyParameters struct {
// nothing
}
// ExpandParameters is params with field expand info
type ExpandParameters struct {
Expand []string `query:"expand"`
}
// CollectionParameters is params with pagination info
type CollectionParameters struct {
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// AUDIT ///////////////////////////////////////////////////////////////////////////////
// AuditParameters is params for fetching audit data
type AuditParameters struct {
StartDate time.Time `query:"startDate"`
EndDate time.Time `query:"endDate"`
SearchString string `query:"searchString"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// AuditSinceParameters is params for fetching audit data
type AuditSinceParameters struct {
Number int `query:"number"`
Units string `query:"units"`
SearchString string `query:"searchString"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// AuditRecord represents audit record
type AuditRecord struct {
Author *User `json:"author"`
RemoteAddress string `json:"remoteAddress"`
CreationDate *Timestamp `json:"creationDate"`
Summary string `json:"summary"`
Description string `json:"description"`
Category string `json:"category"`
IsSysAdmin bool `json:"sysAdmin"`
}
// AuditRecordCollection contains paginated list of audit record
type AuditRecordCollection struct {
Results []*AuditRecord `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// AuditRetentionInfo contains info about retention time
type AuditRetentionInfo struct {
Number int `json:"number"`
Units string `json:"units"`
}
// ATTACHMENTS /////////////////////////////////////////////////////////////////////////
// AttachmentParameters is params for fetching attachments info
type AttachmentParameters struct {
Filename string `query:"filename"`
MediaType string `query:"mediaType"`
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// CONTENT /////////////////////////////////////////////////////////////////////////////
// ContentParameters is params for fetching content info
type ContentParameters struct {
Type string `query:"type"`
SpaceKey string `query:"spaceKey"`
Title string `query:"title"`
Status string `query:"status"`
PostingDay time.Time `query:"postingDay"`
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// ContentIDParameters is params for fetching content info
type ContentIDParameters struct {
Status string `query:"status"`
Version int `query:"version"`
Expand []string `query:"expand"`
}
// ContentSearchParameters is params for searching content
type ContentSearchParameters struct {
CQL string `query:"cql"`
CQLContext string `query:"cqlcontext"`
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// ChildrenParameters is params for fetching content child info
type ChildrenParameters struct {
ParentVersion int `query:"parentVersion"`
Location string `query:"location"`
Depth string `query:"depth"`
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// Content contains content info
type Content struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status"`
Title string `json:"title"`
Extensions *Extensions `json:"extensions"`
Metadata *Metadata `json:"metadata"`
Container *Container `json:"container"`
Space *Space `json:"space"`
Version *Version `json:"version"`
Operations []*Operation `json:"operations"`
Children *Contents `json:"children"`
Ancestors []*Content `json:"ancestors"`
Descendants *Contents `json:"descendants"`
Body *Body `json:"body"`
Links *Links `json:"_links"`
}
// ContentCollection represents paginated list of content
type ContentCollection struct {
Results []*Content `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// Contents contains all types of content
type Contents struct {
Attachments *ContentCollection `json:"attachment"`
Comments *ContentCollection `json:"comment"`
Pages *ContentCollection `json:"page"`
Blogposts *ContentCollection `json:"blogposts"`
}
// Body contains content data
type Body struct {
View *View `json:"view"`
ExportView *View `json:"export_view"`
StyledView *View `json:"styled_view"`
StorageView *View `json:"storage"`
}
// View is data view
type View struct {
Representation string `json:"representation"`
Value string `json:"value"`
}
// Version contains info about content version
type Version struct {
Message string `json:"message"`
By *User `json:"by"`
When *Date `json:"when"`
Number int `json:"number"`
Content *Content `json:"content"`
IsMinorEdit bool `json:"minorEdit"`
IsHidden bool `json:"hidden"`
}
// Extensions contains info about content extensions
type Extensions struct {
Position ExtensionPosition `json:"position"` // Page
MediaType string `json:"mediaType"` // Attachment
FileSize int `json:"fileSize"` // Attachment
Comment string `json:"comment"` // Attachment
Location string `json:"location"` // Comment
Resolution *Resolution `json:"resolution"` // Comment
}
// Resolution contains resolution info
type Resolution struct {
Status string `json:"status"`
LastModifier *User `json:"lastModifier"`
LastModifiedDate *Date `json:"lastModifiedDate"`
}
// Operation contains operation info
type Operation struct {
Name string `json:"operation"`
TargetType string `json:"targetType"`
}
// Metadata contains metadata records
type Metadata struct {
Labels *LabelCollection `json:"labels"` // Page
MediaType string `json:"mediaType"` // Attachment
}
// History contains info about content history
type History struct {
CreatedBy *User `json:"createdBy"`
CreatedDate *Date `json:"createdDate"`
LastUpdated *Version `json:"lastUpdated"`
PreviousVersion *Version `json:"previousVersion"`
NextVersion *Version `json:"nextVersion"`
Contributors *Contributors `json:"contributors"`
IsLatest bool `json:"latest"`
}
// Contributors contains contributors list
type Contributors struct {
Publishers *Publishers `json:"publishers"`
}
// Publishers contains info about users
type Publishers struct {
Users []*User `json:"users"`
UserKeys []string `json:"userKeys"`
}
// Container contains basic container info
type Container struct {
ID ContainerID `json:"id"`
Key string `json:"key"` // Space
Name string `json:"name"` // Space
Title string `json:"title"` // Page or blogpost
Links *Links `json:"_links"`
}
// LABELS //////////////////////////////////////////////////////////////////////////////
// LabelParameters is params for fetching labels
type LabelParameters struct {
Prefix string `query:"prefix"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// LabelCollection contains paginated list of labels
type LabelCollection struct {
Result []*Label `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// Label contains label info
type Label struct {
Prefix string `json:"prefix"`
Name string `json:"name"`
ID string `json:"id"`
}
// GROUPS //////////////////////////////////////////////////////////////////////////////
// Group contains group info
type Group struct {
Type string `json:"type"`
Name string `json:"name"`
}
// GroupCollection contains paginated list of groups
type GroupCollection struct {
Results []*Group `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// RESTRICTIONS ////////////////////////////////////////////////////////////////////////
// Restrictions contains info about all restrictions
type Restrictions struct {
Read *Restriction `json:"read"`
Update *Restriction `json:"update"`
}
// Restriction contains restriction info for single operation
type Restriction struct {
Operation string `json:"operation"`
Data *RestrictionData `json:"restrictions"`
}
// RestrictionData contains restrictions data
type RestrictionData struct {
User *UserCollection `json:"user"`
Group *GroupCollection `json:"group"`
}
// SEARCH //////////////////////////////////////////////////////////////////////////////
// SearchParameters is params for fetching search results
type SearchParameters struct {
Expand []string `query:"expand"`
CQL string `query:"cql"`
CQLContext string `query:"cqlcontext"`
Excerpt string `query:"excerpt"`
Start int `query:"start"`
Limit int `query:"limit"`
IncludeArchivedSpaces bool `query:"includeArchivedSpaces"`
}
// SearchResult contains contains paginated list of search results
type SearchResult struct {
Results []*SearchEntity `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
TotalSize int `json:"totalSize"`
CQLQuery string `json:"cqlQuery"`
SearchDuration int `json:"searchDuration"`
}
// SearchEntity contains search result
type SearchEntity struct {
Content *Content `json:"content"`
Space *Space `json:"space"`
User *User `json:"user"`
Title string `json:"title"`
Excerpt string `json:"excerpt"`
URL string `json:"url"`
EntityType string `json:"entityType"`
LastModified *Date `json:"lastModified"`
}
// SPACE ///////////////////////////////////////////////////////////////////////////////
// SpaceParameters is params for fetching info about space
type SpaceParameters struct {
SpaceKey []string `query:"spaceKey,unwrap"`
Expand []string `query:"expand"`
Type string `query:"type"`
Status string `query:"status"`
Label string `query:"label"`
Depth string `query:"depth"`
Start int `query:"start"`
Limit int `query:"limit"`
Favourite bool `query:"favourite"`
}
// Space contains info about space
type Space struct {
ID int `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Icon *Icon `json:"icon"`
Type string `json:"type"`
Links *Links `json:"_links"`
}
// SpaceCollection contains paginated list of spaces
type SpaceCollection struct {
Results []*Space `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// Icon contains icon info
type Icon struct {
Path string `json:"path"`
Width int `json:"width"`
Height int `json:"height"`
IsDefault bool `json:"isDefault"`
}
// USER ////////////////////////////////////////////////////////////////////////////////
// UserParameters is params for fetching info about user
type UserParameters struct {
Key string `query:"key"`
Username string `query:"username"`
Expand []string `query:"expand"`
Start int `query:"start"`
Limit int `query:"limit"`
}
// User contains user info
type User struct {
Type string `json:"type"`
Name string `json:"username"`
Key string `json:"userKey"`
ProfilePicture *Icon `json:"profilePicture"`
DisplayName string `json:"displayName"`
}
// UserCollection contains paginated list of users
type UserCollection struct {
Results []*User `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
// LINKS ///////////////////////////////////////////////////////////////////////////////
// Links contains links
type Links struct {
WebUI string `json:"webui"`
TinyUI string `json:"tinyui"`
Base string `json:"base"`
}
// WATCH ///////////////////////////////////////////////////////////////////////////////
// WatchParameters is params for fetching info about watchers
type WatchParameters struct {
Key string `query:"key"`
Username string `query:"username"`
ContentType string `query:"contentType"`
}
// ListWatchersParameters is params for fetching info about page watchers
type ListWatchersParameters struct {
PageID string `query:"pageId"`
}
// WatchStatus contains watching status
type WatchStatus struct {
IsWatching bool `json:"watching"`
}
// WatchInfo contains info about watchers
type WatchInfo struct {
PageWatchers []*Watcher `json:"pageWatchers"`
SpaceWatchers []*Watcher `json:"spaceWatchers"`
}
// Watcher contains watcher info
type Watcher struct {
AvatarURL string `json:"avatarUrl"`
Name string `json:"name"`
Key string `json:"userKey"`
DisplayName string `json:"fullName"`
Type string `json:"type"`
}
// ////////////////////////////////////////////////////////////////////////////////// //
// IsAttachment return true if content is attachment
func (c *Content) IsAttachment() bool {
return c.Type == CONTENT_TYPE_ATTACHMENT
}
// IsComment return true if content is comment
func (c *Content) IsComment() bool {
return c.Type == CONTENT_TYPE_COMMENT
}
// IsPage return true if content is page
func (c *Content) IsPage() bool {
return c.Type == CONTENT_TYPE_PAGE
}
// IsTrashed return true if content is trashed
func (c *Content) IsTrashed() bool {
return c.Status == CONTENT_STATUS_TRASHED
}
// IsDraft return true if content is draft
func (c *Content) IsDraft() bool {
return c.Status == CONTENT_STATUS_DRAFT
}
// IsGlobal return true if space is global
func (s *Space) IsGlobal() bool {
return s.Type == SPACE_TYPE_GLOBAL
}
// IsPersonal return true if space is personal
func (s *Space) IsPersonal() bool {
return s.Type == SPACE_TYPE_PERSONAL
}
// IsArchived return true if space is archived
func (s *Space) IsArchived() bool {
return s.Type == SPACE_STATUS_ARCHIVED
}
// IsPage return true if container is page
func (c *Container) IsPage() bool {
return c.Title != ""
}
// IsSpace return true if container is space
func (c *Container) IsSpace() bool {
return c.Key != ""
}
// Combined return united slice with all watchers
func (wi *WatchInfo) Combined() []*Watcher {
var result []*Watcher
result = append(result, wi.PageWatchers...)
MAINLOOP:
for _, watcher := range wi.SpaceWatchers {
for _, pageWatcher := range wi.PageWatchers {
if watcher.Key == pageWatcher.Key {
continue MAINLOOP
}
}
result = append(result, watcher)
}
return result
}
// ////////////////////////////////////////////////////////////////////////////////// //
// UnmarshalJSON is custom Date format unmarshaler
func (d *Date) UnmarshalJSON(b []byte) error {
var err error
d.Time, err = time.Parse(time.RFC3339, strings.Trim(string(b), "\""))
if err != nil {
return fmt.Errorf("Cannot unmarshal Date value: %v", err)
}
return nil
}
// UnmarshalJSON is custom container ID unmarshaler
func (c *ContainerID) UnmarshalJSON(b []byte) error {
switch {
case len(b) == 0:
// nop
case b[0] == '"':
*c = ContainerID(strings.ReplaceAll(string(b), `"`, ""))
default:
*c = ContainerID(string(b))
}
return nil
}
// UnmarshalJSON is custom position unmarshaler
func (ep *ExtensionPosition) UnmarshalJSON(b []byte) error {
if string(b) == "\"none\"" {
*ep = ExtensionPosition(-1)
return nil
}
v, err := strconv.Atoi(string(b))
if err != nil {
return fmt.Errorf("Cannot unmarshal ExtensionPosition value: %v", err)
}
*ep = ExtensionPosition(v)
return nil
}
// UnmarshalJSON is custom Timestamp format unmarshaler
func (d *Timestamp) UnmarshalJSON(b []byte) error {
ts, err := strconv.ParseInt(string(b), 10, 64)
if err != nil {
return err
}
d.Time = time.Unix(ts/1000, (ts%1000)*1000000)
if err != nil {
return fmt.Errorf("Cannot unmarshal Timestamp value: %v", err)
}
return nil
}
// ////////////////////////////////////////////////////////////////////////////////// //
// Validate validates parameters
func (p EmptyParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p ExpandParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p CollectionParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p AuditParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p AuditSinceParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p ContentParameters) Validate() error {
if p.SpaceKey == "" {
return errors.New("SpaceKey is mandatory and must be set")
}
return nil
}
// Validate validates parameters
func (p ContentIDParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p ContentSearchParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p ChildrenParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p AttachmentParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p LabelParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p SearchParameters) Validate() error {
if p.CQL == "" {
return errors.New("CQL is mandatory and must be set")
}
return nil
}
// Validate validates parameters
func (p SpaceParameters) Validate() error {
if len(p.SpaceKey) == 0 {
return errors.New("SpaceKey is mandatory and must be set")
}
return nil
}
// Validate validates parameters
func (p UserParameters) Validate() error {
if p.Key == "" && p.Username == "" {
return errors.New("Key or Username must be set")
}
return nil
}
// Validate validates parameters
func (p WatchParameters) Validate() error {
return nil
}
// Validate validates parameters
func (p ListWatchersParameters) Validate() error {
return nil
}
// ////////////////////////////////////////////////////////////////////////////////// //
// ToQuery convert params to URL query
func (p EmptyParameters) ToQuery() string {
return ""
}
// ToQuery convert params to URL query
func (p ExpandParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p CollectionParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p AuditParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p AuditSinceParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p ContentParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p ContentIDParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p ContentSearchParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p ChildrenParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p AttachmentParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p LabelParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p SearchParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p SpaceParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p UserParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p WatchParameters) ToQuery() string {
return paramsToQuery(p)
}
// ToQuery convert params to URL query
func (p ListWatchersParameters) ToQuery() string {
return paramsToQuery(p)
}