This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClubAPI.Script.txt
2927 lines (2685 loc) · 109 KB
/
ClubAPI.Script.txt
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
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* API for Clubs
*/
#Const Version "2021-09-22"
#Const ScriptName "Libs/Nadeo/TMNext/TrackMania/API/ClubAPI.Script.txt"
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Libraries
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
#Include "Libs/Nadeo/MenuLibs/Common/Manialink/ManiaView2.Script.txt" as MV
#Include "Libs/Nadeo/CommonLibs/Common/Http.Script.txt" as Http
#Include "Libs/Nadeo/TMNext/TrackMania/Structures/ClubStruct.Script.txt" as ClubStruct
#Include "Libs/Nadeo/TMNext/TrackMania/Structures/CampaignStruct.Script.txt" as CampaignStruct
#Include "Libs/Nadeo/TMNext/TrackMania/Config.Script.txt" as Config
#Include "Libs/Nadeo/TMNext/TrackMania/Structures/HttpStruct.Script.txt" as HttpStruct
#Include "Libs/Nadeo/TMNext/TrackMania/API/MapReviewAPI.Script.txt" as MapReviewAPI
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Constants
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
#Const C_Name "component-club-api" //< Component name
#Const P "ComponentClubAPI_" //< Prefix use to differentiate functions/variables in the script
#Const C_API_Club "/api/token/club"
#Const C_Headers [
"Accept" => "application/json",
"Content-Type" => "application/json"
]
#Const C_RouteParameter_ClubId "ClubId"
#Const C_RouteParameter_CampaignId "CampaignId"
#Const C_RouteParameter_AccountId "AccountId"
#Const C_RouteParameter_ActivityId "ActivityId"
#Const C_RouteParameter_ItemId "ItemId"
#Const C_RouteParameter_MapUid "MapUid"
#Const C_RouteParameter_Position "Position"
#Const C_RouteParameter_BucketType "BucketType"
#Const C_RouteParameter_Login "Login"
#Const C_QueryParameter_Offset "offset"
#Const C_QueryParameter_Length "length"
#Const C_QueryParameter_Sort "sort"
#Const C_QueryParameter_Order "order"
#Const C_QueryParameter_Name "name"
#Const C_QueryParameter_Active "active"
#Const C_QueryParameter_SeasonUid "seasonUid"
#Const C_QueryParameter_Format "format"
#Const C_QueryParameter_WithFeedback "withFeedback"
#Const C_QueryParameter_WithMapInfo "withMapInfo"
#Const C_Route_GetClubs ""
#Const C_Route_GetClubsMine "/mine"
#Const C_Route_GetClub "/:ClubId"
#Const C_Route_PostClubCreate "/create"
#Const C_Route_PostClubDelete "/:ClubId/delete"
#Const C_Route_GetClubMembers "/:ClubId/member"
#Const C_Route_GetClubMemberRequests "/:ClubId/member/request"
#Const C_Route_PostClubMemberRequestAccept "/:ClubId/member/request/:AccountId/accept"
#Const C_Route_PostClubMemberRequestDecline "/:ClubId/member/request/:AccountId/decline"
#Const C_Route_GetClubMemberWithId "/:ClubId/member/:AccountId"
#Const C_Route_GetClubMemberFromLogin "/:ClubId/member/:Login/from-login"
#Const C_Route_DeleteClubMemberWithId "/:ClubId/member/:AccountId/delete"
#Const C_Route_EditClubMemberWithId "/:ClubId/member/:AccountId/edit"
#Const C_Route_PostCreateClubMember "/:ClubId/member/create"
#Const C_Route_GetAllClubRooms "/room"
#Const C_Route_GetAllClubCampaigns "/campaign"
#Const C_Route_GetClubCampaignList "/:ClubId/campaign"
#Const C_Route_GetClubCampaign "/:ClubId/campaign/:CampaignId"
#Const C_Route_GetClubActivities "/:ClubId/activity"
#Const C_Route_PostEditActivity "/:ClubId/activity/:ActivityId/edit"
#Const C_Route_PostDeleteActivity "/:ClubId/activity/:ActivityId/delete"
#Const C_Route_PostUploadMediaActivity "/:ClubId/activity/:ActivityId/upload"
#Const C_Route_PostClubRoomCreate "/:ClubId/room/create"
#Const C_Route_PostClubRoomEdit "/:ClubId/room/:ActivityId/edit"
#Const C_Route_PostCreateCampaign "/:ClubId/campaign/create"
#Const C_Route_PostEditCampaign "/:ClubId/campaign/:CampaignId/edit"
#Const C_Route_GetClubRoomDetail "/:ClubId/room/:ActivityId"
#Const C_Route_PostJoinLink "/:ClubId/room/:ActivityId/join"
#Const C_Route_PostClubRoomCreateFromServer "/:ClubId/room/create-from-server"
#Const C_Route_PostClubRoomEditFromServer "/:ClubId/room/:ActivityId/edit-from-server"
#Const C_Route_GetClubRoomPassword "/:ClubId/room/:ActivityId/get-password"
#Const C_Route_PostClubRoomPasswordGenerate "/:ClubId/room/:ActivityId/generate-password"
#Const C_Route_PostEditClub "/:ClubId/edit"
#Const C_Route_PostDeleteClubMedia "/:ClubId/media/delete"
#Const C_Route_PostUploadClubMedia "/:ClubId/media/upload"
#Const C_Route_PostDeleteClub "/:ClubId/delete"
#Const C_Route_PostSetVIP "/:ClubId/vip/:AccountId/set"
#Const C_Route_PostUnsetVIP "/:ClubId/vip/:AccountId/unset"
#Const C_Route_GetVIPListOnMap "/:ClubId/vip/map/:MapUid"
#Const C_Route_GetGlobalVIPListOnMap "/player-vip/map/:MapUid"
#Const C_Route_GetFollowersListOnMap "/follower/map/:MapUid"
#Const C_Route_PostCreateBucket "/:ClubId/bucket/create"
#Const C_Route_PostEditBucket "/:ClubId/bucket/:ActivityId/edit"
#Const C_Route_PostAddBucketItems "/:ClubId/bucket/:ActivityId/add"
#Const C_Route_PostRemoveBucketItems "/:ClubId/bucket/:ActivityId/remove"
#Const C_Route_GetBucketActivity "/:ClubId/bucket/:ActivityId"
#Const C_Route_GetMapReviewActivities "/map-review"
#Const C_Route_PostCreateMapReviewActivity "/:ClubId/map-review/create"
#Const C_Route_PostEditMapReviewActivity "/:ClubId/map-review/:ActivityId/edit"
#Const C_Route_PostJoinMapReviewActivity "/:ClubId/map-review/:ActivityId/join"
#Const C_Route_PostAddMapQueueMapReviewActivity "/:ClubId/map-review/:ActivityId/add-map-queue"
#Const C_Route_PostRemoveSubmittedMap "/:ClubId/map-review/:ActivityId/map/:MapUid/delete"
#Const C_Route_GetMapReviewActivity "/:ClubId/map-review/:ActivityId"
#Const C_Route_GetMapReviewActivityPlayerSubmittedMaps "/:ClubId/map-review/:ActivityId/map/mine"
#Const C_Route_GetMapReviewActivityAllSubmittedMaps "/:ClubId/map-review/:ActivityId/map"
#Const C_Route_GetMapReviewActivityWaitingTime "/:ClubId/map-review/:ActivityId/waiting-time"
#Const C_Route_PostEditBucketItem "/:ClubId/bucket/:ActivityId/item/:ItemId/edit"
#Const C_Route_PostBucketItemAddMedia "/:ClubId/bucket/:ActivityId/item/:ItemId/add-media"
#Const C_Route_PostBucketItemDeleteMedia "/:ClubId/bucket/:ActivityId/item/:ItemId/delete-media/:Position"
#Const C_Route_GetAllBucketActivities "/bucket/:BucketType/all"
#Const C_Route_PostCreateNews "/:ClubId/news/create"
#Const C_Route_PostEditNews "/:ClubId/news/:ActivityId/edit"
#Const C_Route_PostUploadNewsMedia "/:ClubId/news/:ActivityId/upload"
#Const C_Route_PostDeleteNewsMedia "/:ClubId/news/:ActivityId/delete-media"
#Const C_Route_GetNewsActivity "/:ClubId/news/:ActivityId"
#Const C_Route_PostCreateRanking "/:ClubId/ranking/create"
#Const C_Route_PostSetFeatured "/:ClubId/featured/set"
#Const C_Route_PostUnsetFeatured "/:ClubId/featured/unset"
// Values are from LIVE, do not change them
#Const C_QueryValue_Sort_Popularity "popularity" //< This is the default value
#Const C_QueryValue_Sort_Date "date"
#Const C_QueryValue_Sort_Name "name"
#Const C_QueryValue_Order_ASC "ASC" //< This is the default value for C_QueryValue_Sort_Name
#Const C_QueryValue_Order_DESC "DESC" //< This is the default value for C_QueryValue_Sort_Popularity and C_QueryValue_Sort_Date
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Structures
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
#Struct ComponentClubAPI_K_HttpClub {
Integer id;
Text name;
Text tag;
Text description;
Text iconUrl;
Text logoUrl;
Text decalUrl;
Text backgroundUrl;
Text verticalUrl;
Text decalSponsor4x1Url;
Text screen16x9Url;
Text screen8x1Url;
Text screen16x1Url;
Integer creationTimestamp;
Integer popularityLevel;
Text state;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubs {
ComponentClubAPI_K_HttpClub[] clubList;
Integer maxPage;
Integer clubCount;
}
#Struct ComponentClubAPI_K_ResponseGetClubs {
ClubStruct::LibStructuresClub_K_Club[] Clubs;
Integer ClubsTotal;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubMemberId {
Text accountId;
Integer clubId;
Text role;
Integer creationTimestamp;
Boolean vip;
Boolean moderator;
Boolean hasFeatured;
}
#Struct ComponentClubAPI_K_HttpClubMember {
Text accountId;
Text role;
Integer creationTimestamp;
Boolean vip;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubMembers {
ComponentClubAPI_K_HttpClubMember[] clubMemberList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseGetClubMembers {
ClubStruct::LibStructuresClub_K_Member[] Members;
Integer MembersTotal;
}
#Struct ComponentClubAPI_K_HttpSetting {
Text key;
Text value;
Text type;
}
#Struct ComponentClubAPI_K_HttpRoomCreationWithCampaignId {
Text name;
Text region;
Integer maxPlayersPerServer;
Text script;
ComponentClubAPI_K_HttpSetting[] settings;
Integer campaignId;
Integer scalable;
Integer password;
}
#Struct ComponentClubAPI_K_HttpRoomCreationWithMapList {
Text name;
Text region;
Integer maxPlayersPerServer;
Text script;
ComponentClubAPI_K_HttpSetting[] settings;
Text[] maps;
Integer scalable;
Integer password;
}
#Struct ComponentClubAPI_K_HttpClubRoomCreationFromServer {
Text name;
Text login;
}
#Struct ComponentClubAPI_K_HttpRoomModel {
Integer id;
Text[] maps;
Text script;
}
#Struct ComponentClubAPI_K_HttpRoomCreated {
Integer clubId;
Integer roomId;
Integer campaignId;
ComponentClubAPI_K_HttpRoomModel roomModel;
}
#Struct ComponentClubAPI_K_HttpServerInfo {
Text joinLink;
Integer playerCount;
Text currentMapUid;
Boolean starting;
}
#Struct ComponentClubAPI_K_HttpRoom {
Integer id;
Text name;
Text region;
Text serverAccountId;
Integer maxPlayers;
Integer playerCount;
Text[] maps;
Text script;
Boolean scalable;
Integer creationTimestamp;
ComponentClubAPI_K_HttpSetting[Text] scriptSettings;
ComponentClubAPI_K_HttpServerInfo serverInfo;
}
#Struct ComponentClubAPI_K_HttpClubRoom {
Integer id;
Integer clubId;
Text clubName;
Boolean nadeo;
Integer campaignId;
Text playerServerLogin;
Integer activityId;
Text mediaUrl;
Text name;
Integer popularityLevel;
Integer creationTimestamp;
Boolean password;
ComponentClubAPI_K_HttpRoom room;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubRooms {
ComponentClubAPI_K_HttpClubRoom[] clubRoomList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseGetClubRooms {
ClubStruct::LibStructuresClub_K_Room[] Rooms;
Integer ClubsRoomsTotal;
}
#Struct ComponentClubAPI_K_HttpClubRoomPassword {
Text password;
}
#Struct ComponentClubAPI_K_HttpClubCampaign {
Integer clubId;
Text clubName;
Text clubDecalUrl;
Integer campaignId;
Integer publicationTimestamp;
Integer activityId;
Text mediaUrl;
Text name;
HttpStruct::LibHttpStruct_K_HttpCampaign campaign;
Integer popularityLevel;
Boolean trophies;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubCampaignList {
ComponentClubAPI_K_HttpClubCampaign[] clubCampaignList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseGetClubCampaignList {
CampaignStruct::LibCampaignStruct_K_Campaign[] CampaignList;
Integer CampaignsTotal;
}
#Struct ComponentClubAPI_K_HttpActivity {
Integer id;
Text name;
Text activityType;
Integer externalId;
Integer position;
Boolean public;
Boolean active;
Text mediaUrl;
Boolean password;
}
#Struct ComponentClubAPI_K_HttpResponseGetClubActivities {
ComponentClubAPI_K_HttpActivity[] activityList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseGetClubActivities {
ClubStruct::LibStructuresClub_K_Activity[] Activities;
Integer ActivitiesTotal;
}
#Struct ComponentClubAPI_K_HttpRole {
Text role;
}
// We can edit only one parameter of the activity at once
// So we need a struct for each parameter
#Struct ComponentClubAPI_K_HttpMoveActivity {
Integer position;
}
#Struct ComponentClubAPI_K_HttpActivateActivity {
Integer active; //< 1 to activate, 0 to deactivate
}
#Struct ComponentClubAPI_K_HttpUpdatePrivacyActivity {
Integer public;
}
#Struct ComponentClubAPI_K_HttpUpdateActivityName {
Text name;
}
#Struct ComponentClubAPI_K_HttpMapCreation {
Integer position;
Text mapUid;
}
#Struct ComponentClubAPI_K_HttpCampaignCreation {
Text name;
ComponentClubAPI_K_HttpMapCreation[] playlist;
}
#Struct ComponentClubAPI_K_HttpResponseFromPostCreateCampaign {
Integer clubId;
Integer campaignId;
Integer publicationTimestamp;
Integer activityId;
HttpStruct::LibHttpStruct_K_HttpCampaign campaign;
}
#Struct ComponentClubAPI_K_ResponseFromPostCreateCampaign {
CampaignStruct::LibCampaignStruct_K_Campaign Campaign;
Integer ActivityId;
}
#Struct ComponentClubAPI_K_HttpClubCreation {
Text name;
Text tag;
Text description;
Text state;
}
#Struct ComponentClubAPI_K_HttpResponseFromGetVIPListOnMap {
Text[] accountIdList;
}
#Struct ComponentClubAPI_K_HttpCreateBucket {
Text name;
Text type;
}
#Struct ComponentClubAPI_K_HttpEditBucket {
Text name;
}
#Struct ComponentClubAPI_K_HttpBucketItem {
Text itemId;
Integer position;
Text description;
Text[] mediaUrls;
}
#Struct ComponentClubAPI_K_HttpBucketItemList {
Text[] itemIdList;
}
#Struct ComponentClubAPI_K_HttpBucketItemDesc {
Integer position;
Text description;
}
#Struct ComponentClubAPI_K_HttpBucketActivity {
Text type;
ComponentClubAPI_K_HttpBucketItem[] bucketItemList;
Integer bucketItemCount;
Integer popularityLevel;
Integer popularityValue;
Integer id;
Text mediaUrl;
Integer clubId;
Text clubName;
Text name;
Integer creationTimestamp;
}
#Struct ComponentClubAPI_K_HttpCreateMapReviewActivity {
Text name;
Integer timeLimit;
Integer scalable;
Integer maxPlayer;
Integer allowVoteSkipMap;
Integer submissionLimitation;
}
#Struct ComponentClubAPI_K_HttpMapReviewActivity {
Integer activityId;
Text mapReviewUid;
Text mediaUrl;
Integer timeLimit;
Boolean scalable;
Boolean allowVoteSkipMap;
Boolean submissionLimitation;
Integer maxPlayer;
Boolean public;
Text game2webUrl;
Integer popularityValue;
Integer popularityValueBonus;
Integer popularityLevel;
Integer playerCount;
Integer submittedMapCount;
Integer id;
Integer clubId;
Text clubName;
Text name;
Integer creationTimestamp;
}
#Struct ComponentClubAPI_K_HttpResponseGetMapReviews {
ComponentClubAPI_K_HttpMapReviewActivity[] clubMapReviewList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseGetMapReviews {
ClubStruct::LibStructuresClub_K_MapReview[] ClubMapReviews;
Integer ClubMapReviewsTotal;
}
#Struct ComponentClubAPI_K_HttpCreateNews {
Text name;
Text headline;
Text body;
}
#Struct ComponentClubAPI_K_HttpNews {
Text headline;
Text body;
Text mediaUrl;
Integer id;
Integer clubId;
Text name;
Integer creationTimestamp;
}
#Struct ComponentClubAPI_K_HttpResponseFromGetAllBucketActivities{
ComponentClubAPI_K_HttpBucketActivity[] clubBucketList;
Integer maxPage;
Integer itemCount;
}
#Struct ComponentClubAPI_K_ResponseFromGetBucketActivities {
ClubStruct::LibStructuresClub_K_BucketActivity[] BucketActivities;
Integer BucketActivitiesTotal;
}
#Struct ComponentClubAPI_K_HttpCreateRankings {
Text name;
Text useCase;
Integer campaignId;
}
#Struct ComponentClubAPI_K_ResponseFromPostCreateRanking {
Text useCase;
Integer campaignId;
Integer id;
Integer clubId;
Text name;
Integer creationTimestamp;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of clubs
*
* @param _Sort The sort option
* @param _Order The sort order
* @param _FilterName The name to filter
* @param _IsMember True to return clubs of the main user, False for all clubs
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubs(Text _Sort, Text _Order, Text _FilterName, Boolean _IsMember, Integer _Offset, Integer _Length) {
declare Text[Text] Query = [
C_QueryParameter_Offset => ""^_Offset,
C_QueryParameter_Length => ""^_Length
];
if (!_IsMember) {
if (_Sort != "") {
Query[C_QueryParameter_Sort] = _Sort;
}
if (_Order != "") {
Query[C_QueryParameter_Order] = _Order;
}
if (_FilterName != "") {
Query[C_QueryParameter_Name] = _FilterName;
}
}
declare Text QueryString = Http::CreateQueryString(Query);
declare Text Url;
if (_IsMember) {
Url = Config::Get().APIBaseUrl^C_API_Club^C_Route_GetClubsMine^QueryString;
} else {
Url = Config::Get().APIBaseUrl^C_API_Club^C_Route_GetClubs^QueryString;
}
return Http::CreateGet(Url, C_Headers);
}
Http::LibCommonHttp_K_Request GetClubs(Boolean _IsMember, Integer _Offset, Integer _Length) {
return GetClubs("", "", "", _IsMember, _Offset, _Length);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of all clubs
*
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubs(Integer _Offset, Integer _Length) {
return GetClubs(False, _Offset, _Length);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubs request
ComponentClubAPI_K_ResponseGetClubs GetResponseFromGetClubs(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_ResponseGetClubs ResponseGetClubs;
declare ComponentClubAPI_K_HttpResponseGetClubs HttpResponseGetClubs;
HttpResponseGetClubs.fromjson(Http::GetResult(_Request));
foreach (Club in HttpResponseGetClubs.clubList) {
ResponseGetClubs.Clubs.add(ClubStruct::LibStructuresClub_K_Club {
Id = Club.id,
Name = Club.name,
Tag = Club.tag,
Description = Club.description,
IconUrl = Club.iconUrl,
LogoUrl = Club.logoUrl,
DecalUrl = Club.decalUrl,
BgUrl = Club.backgroundUrl,
VerticalUrl = Club.verticalUrl,
DecoImageUrl_DecalSponsor4x1 = Club.decalSponsor4x1Url,
DecoImageUrl_Screen16x9 = Club.screen16x9Url,
DecoImageUrl_Screen8x1 = Club.screen8x1Url,
DecoImageUrl_Screen16x1 = Club.screen16x1Url,
PopularityLevel = Club.popularityLevel,
PrivacyState = Club.state
});
}
ResponseGetClubs.ClubsTotal = HttpResponseGetClubs.clubCount;
return ResponseGetClubs;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a specific club
*
* @param _ClubId The id of the club to fetch
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClub(Integer _ClubId) {
declare Text Route = Http::InjectRouteParameters(C_Route_GetClub, [C_RouteParameter_ClubId => ""^_ClubId]);
return Http::CreateGet(Config::Get().APIBaseUrl^C_API_Club^Route, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClub request
ClubStruct::LibStructuresClub_K_Club GetResponseFromGetClub(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpClub HttpResponseGetClub;
HttpResponseGetClub.fromjson(Http::GetResult(_Request));
return ClubStruct::LibStructuresClub_K_Club {
Id = HttpResponseGetClub.id,
Name = HttpResponseGetClub.name,
Tag = HttpResponseGetClub.tag,
Description = HttpResponseGetClub.description,
IconUrl = HttpResponseGetClub.iconUrl,
LogoUrl = HttpResponseGetClub.logoUrl,
DecalUrl = HttpResponseGetClub.decalUrl,
BgUrl = HttpResponseGetClub.backgroundUrl,
VerticalUrl = HttpResponseGetClub.verticalUrl,
DecoImageUrl_DecalSponsor4x1 = HttpResponseGetClub.decalSponsor4x1Url,
DecoImageUrl_Screen16x9 = HttpResponseGetClub.screen16x9Url,
DecoImageUrl_Screen8x1 = HttpResponseGetClub.screen8x1Url,
DecoImageUrl_Screen16x1 = HttpResponseGetClub.screen16x1Url,
PopularityLevel = HttpResponseGetClub.popularityLevel,
PrivacyState = HttpResponseGetClub.state
};
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to create a club
*
* @param _Name Name of the club to create
* @param _Tag Tag of the club
* @param _Description Description of the club
*
* @return The request
*/
Http::LibCommonHttp_K_Request PostClubCreate(Text _Name, Text _Tag, Text _Description, Text _PrivacyState) {
declare ComponentClubAPI_K_HttpClubCreation Club = ComponentClubAPI_K_HttpClubCreation {
name = _Name,
tag = _Tag,
description = _Description,
state = _PrivacyState
};
return Http::CreatePost(Config::Get().APIBaseUrl^C_API_Club^C_Route_PostClubCreate, Club.tojson(), C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the PostClubCreate request
ClubStruct::LibStructuresClub_K_Club GetResponseFromPostClubCreate(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpClub ClubCreated;
ClubCreated.fromjson(Http::GetResult(_Request));
return ClubStruct::LibStructuresClub_K_Club {
Id = ClubCreated.id,
Name = ClubCreated.name,
Tag = ClubCreated.tag,
Description = ClubCreated.description,
IconUrl = ClubCreated.iconUrl,
LogoUrl = ClubCreated.logoUrl,
DecalUrl = ClubCreated.decalUrl,
BgUrl = ClubCreated.backgroundUrl,
VerticalUrl = ClubCreated.verticalUrl,
DecoImageUrl_DecalSponsor4x1 = ClubCreated.decalSponsor4x1Url,
DecoImageUrl_Screen16x9 = ClubCreated.screen16x9Url,
DecoImageUrl_Screen8x1 = ClubCreated.screen8x1Url,
DecoImageUrl_Screen16x1 = ClubCreated.screen16x1Url,
PopularityLevel = ClubCreated.popularityLevel,
PrivacyState = ClubCreated.state
};
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to delete a club
*
* @param _ClubId Id of the club to delete
*
* @return The request
*/
Http::LibCommonHttp_K_Request PostClubDelete(Integer _ClubId) {
declare Text Route = Http::InjectRouteParameters(C_Route_PostClubDelete, [C_RouteParameter_ClubId => ""^_ClubId]);
return Http::CreatePost(Config::Get().APIBaseUrl^C_API_Club^Route, "", C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of
* all members of a club
*
* @param _ClubId The club id
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubMembers(Integer _ClubId, Integer _Offset, Integer _Length) {
declare Text Route = Http::InjectRouteParameters(C_Route_GetClubMembers, [C_RouteParameter_ClubId => ""^_ClubId]);
declare Text QueryString = Http::CreateQueryString([
C_QueryParameter_Offset => ""^_Offset,
C_QueryParameter_Length => ""^_Length
]);
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Route^QueryString;
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubMembers request
ComponentClubAPI_K_ResponseGetClubMembers GetResponseFromGetClubMembers(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_ResponseGetClubMembers ResponseGetClubMembers;
declare ComponentClubAPI_K_HttpResponseGetClubMembers HttpResponseGetClubMembers;
HttpResponseGetClubMembers.fromjson(Http::GetResult(_Request));
foreach (Member in HttpResponseGetClubMembers.clubMemberList) {
ResponseGetClubMembers.Members.add(ClubStruct::LibStructuresClub_K_Member {
AccountId = Member.accountId,
Role = Member.role,
JoinDate = Member.creationTimestamp,
VIP = Member.vip
});
}
ResponseGetClubMembers.MembersTotal = HttpResponseGetClubMembers.itemCount;
return ResponseGetClubMembers;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of
* all member requests of a club
*
* @param _ClubId The club id
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubMemberRequests(Integer _ClubId, Integer _Offset, Integer _Length) {
declare Text Route = Http::InjectRouteParameters(C_Route_GetClubMemberRequests, [C_RouteParameter_ClubId => ""^_ClubId]);
declare Text QueryString = Http::CreateQueryString([
C_QueryParameter_Offset => ""^_Offset,
C_QueryParameter_Length => ""^_Length
]);
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Route^QueryString;
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubMemberRequests request
ComponentClubAPI_K_ResponseGetClubMembers GetResponseFromGetClubMemberRequests(Http::LibCommonHttp_K_Request _Request) {
return GetResponseFromGetClubMembers(_Request);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get info on a club member
*
* @param _ClubId The Id of the club to fetch
* @param _AccountId The account Id of the member to fetch
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubMemberWithId(Integer _ClubId, Text _AccountId) {
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Http::InjectRouteParameters(
C_Route_GetClubMemberWithId,
[C_RouteParameter_ClubId => ""^_ClubId, C_RouteParameter_AccountId => _AccountId]
);
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubMemberId request
ClubStruct::LibStructuresClub_K_Member GetResponseFromGetClubMemberWithId(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpResponseGetClubMemberId HttpResponseGetClubMemberId;
HttpResponseGetClubMemberId.fromjson(Http::GetResult(_Request));
return ClubStruct::LibStructuresClub_K_Member {
AccountId = HttpResponseGetClubMemberId.accountId,
Role = HttpResponseGetClubMemberId.role,
JoinDate = HttpResponseGetClubMemberId.creationTimestamp,
VIP = HttpResponseGetClubMemberId.vip,
Moderator = HttpResponseGetClubMemberId.moderator,
HasFeatured = HttpResponseGetClubMemberId.hasFeatured
};
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get info on a club member
*
* @param _ClubId The Id of the club to fetch
* @param _Login The login of the member to fetch
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubMemberFromLogin(Integer _ClubId, Text _Login) {
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Http::InjectRouteParameters(
C_Route_GetClubMemberFromLogin,
[
C_RouteParameter_ClubId => ""^_ClubId,
C_RouteParameter_Login => _Login
]
);
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubMemberFromLogin request
ClubStruct::LibStructuresClub_K_Member GetResponseFromGetClubMemberFromLogin(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpResponseGetClubMemberId HttpResponseGetClubMemberId;
HttpResponseGetClubMemberId.fromjson(Http::GetResult(_Request));
return ClubStruct::LibStructuresClub_K_Member {
AccountId = HttpResponseGetClubMemberId.accountId,
Role = HttpResponseGetClubMemberId.role,
JoinDate = HttpResponseGetClubMemberId.creationTimestamp,
VIP = HttpResponseGetClubMemberId.vip,
Moderator = HttpResponseGetClubMemberId.moderator,
HasFeatured = HttpResponseGetClubMemberId.hasFeatured
};
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to delete a club member
*
* @param _ClubId The Id of the club to delete the user from
* @param _AccountId The account Id of the member to delete
*
* @return The request
*/
Http::LibCommonHttp_K_Request DeleteClubMemberWithId(Integer _ClubId, Text _AccountId) {
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Http::InjectRouteParameters(
C_Route_DeleteClubMemberWithId,
[C_RouteParameter_ClubId => ""^_ClubId, C_RouteParameter_AccountId => _AccountId]
);
return Http::CreatePost(Url, "", C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to edit the role of a club member
*
* @param _ClubId The Id of the club to delete the user from
* @param _AccountId The account Id of the member to delete
* @param _Role The role to set to the club member
*
* @return The request
*/
Http::LibCommonHttp_K_Request EditClubMemberWithId(Integer _ClubId, Text _AccountId, Text _Role) {
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Http::InjectRouteParameters(
C_Route_EditClubMemberWithId,
[C_RouteParameter_ClubId => ""^_ClubId, C_RouteParameter_AccountId => _AccountId]
);
declare ComponentClubAPI_K_HttpRole Role = ComponentClubAPI_K_HttpRole {
role = _Role
};
return Http::CreatePost(Url, Role.tojson(), C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to create a club member with the current user
*
* @param _ClubId The Id of the club to delete the user from
*
* @return The request
*/
Http::LibCommonHttp_K_Request PostCreateClubMember(Integer _ClubId) {
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Http::InjectRouteParameters(
C_Route_PostCreateClubMember,
[C_RouteParameter_ClubId => ""^_ClubId]
);
return Http::CreatePost(Url, "", C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of all club rooms
*
* @param _Sort The sort option
* @param _Order The sort order
* @param _FilterName The name to filter
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetAllClubRooms(Text _Sort, Text _Order, Text _FilterName, Integer _Offset, Integer _Length) {
declare Text[Text] Query = [
C_QueryParameter_Offset => ""^_Offset,
C_QueryParameter_Length => ""^_Length
];
if (_Sort != "") {
Query[C_QueryParameter_Sort] = _Sort;
}
if (_Order != "") {
Query[C_QueryParameter_Order] = _Order;
}
if (_FilterName != "") {
Query[C_QueryParameter_Name] = _FilterName;
}
declare Text QueryString = Http::CreateQueryString(Query);
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^C_Route_GetAllClubRooms^QueryString;
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetAllClubRooms and GetClubRooms request
ComponentClubAPI_K_ResponseGetClubRooms GetResponseFromGetClubRooms(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpResponseGetClubRooms HttpResponseGetClubRooms;
HttpResponseGetClubRooms.fromjson(Http::GetResult(_Request));
declare ComponentClubAPI_K_ResponseGetClubRooms ResponseGetClubRooms;
foreach (HttpClubRoom in HttpResponseGetClubRooms.clubRoomList) {
declare ClubStruct::LibStructuresClub_K_ScriptSetting[] ScriptSettings;
foreach (HttpSetting in HttpClubRoom.room.scriptSettings) {
ScriptSettings.add(ClubStruct::LibStructuresClub_K_ScriptSetting {
Key = HttpSetting.key,
Value = HttpSetting.value,
Type = HttpSetting.type
});
}
ResponseGetClubRooms.Rooms.add(ClubStruct::LibStructuresClub_K_Room {
Id = HttpClubRoom.id,
RoomId = HttpClubRoom.room.id,
ClubId = HttpClubRoom.clubId,
ClubName = HttpClubRoom.clubName,
ActivityId = HttpClubRoom.activityId,
IsHostedByNadeo = HttpClubRoom.nadeo,
PlayerServerLogin = HttpClubRoom.playerServerLogin,
Name = HttpClubRoom.name,
Password = HttpClubRoom.password,
Region = HttpClubRoom.room.region,
MaxPlayers = HttpClubRoom.room.maxPlayers,
ScriptName = HttpClubRoom.room.script,
CampaignId = HttpClubRoom.campaignId,
MapUids = HttpClubRoom.room.maps,
MediaUrl = HttpClubRoom.mediaUrl,
PopularityLevel = HttpClubRoom.popularityLevel,
ScriptSettings = ScriptSettings,
CreationTimestamp = HttpClubRoom.room.creationTimestamp,
Scalable = HttpClubRoom.room.scalable,
ServerInfo = ClubStruct::LibStructuresClub_K_ServerInfo {
JoinLink = HttpClubRoom.room.serverInfo.joinLink,
PlayerCount = HttpClubRoom.room.playerCount,
CurrentMapUid = HttpClubRoom.room.serverInfo.currentMapUid,
IsStarting = HttpClubRoom.room.serverInfo.starting
}
});
}
ResponseGetClubRooms.ClubsRoomsTotal = HttpResponseGetClubRooms.itemCount;
return ResponseGetClubRooms;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to get a list of activities in a specific club
*
* @param _ClubId The Id of the club to fetch
* @param _Offset The starting index
* @param _Length The length of the list
*
* @return The request
*/
Http::LibCommonHttp_K_Request GetClubActivities(Integer _ClubId, Integer _Offset, Integer _Length, Boolean _Active) {
declare Text Route = Http::InjectRouteParameters(C_Route_GetClubActivities, [C_RouteParameter_ClubId => ""^_ClubId]);
declare Text Active = "0";
if (_Active) Active = "1";
declare Text QueryString = Http::CreateQueryString([
C_QueryParameter_Offset => ""^_Offset,
C_QueryParameter_Length => ""^_Length,
C_QueryParameter_Active => Active
]);
declare Text Url = Config::Get().APIBaseUrl^C_API_Club^Route^QueryString;
return Http::CreateGet(Url, C_Headers);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Parse the response to the GetClubActivities request
ComponentClubAPI_K_ResponseGetClubActivities GetResponseFromGetClubActivities(Http::LibCommonHttp_K_Request _Request) {
declare ComponentClubAPI_K_HttpResponseGetClubActivities HttpResponseGetClubActivities;
HttpResponseGetClubActivities.fromjson(Http::GetResult(_Request));
declare ComponentClubAPI_K_ResponseGetClubActivities ResponseGetClubActivities;
foreach (HttpActivity in HttpResponseGetClubActivities.activityList) {
ResponseGetClubActivities.Activities.add(ClubStruct::LibStructuresClub_K_Activity {
Id = HttpActivity.id,
Name = HttpActivity.name,
Type = HttpActivity.activityType,
ExternalId = HttpActivity.externalId,
Position = HttpActivity.position,
Public = HttpActivity.public,
Active = HttpActivity.active,
MediaUrl = HttpActivity.mediaUrl,
Password = HttpActivity.password
});
}
ResponseGetClubActivities.ActivitiesTotal = HttpResponseGetClubActivities.itemCount;
return ResponseGetClubActivities;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/** Start a request to move a club activity
*
* @param _ClubId Id of the club of the campaign
* @param _ActivityId Id of the activity to move