GroupsApi.php 187 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740
  1. <?php
  2. /**
  3. * GroupsApi
  4. * PHP version 8.1
  5. *
  6. * @category Class
  7. * @package WikipaliApi
  8. * @author OpenAPI Generator team
  9. * @link https://openapi-generator.tech
  10. */
  11. /**
  12. * MINT API
  13. *
  14. * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
  15. *
  16. * The version of the OpenAPI document: 1.0.0
  17. * Generated by: https://openapi-generator.tech
  18. * Generator version: 7.25.0
  19. */
  20. /**
  21. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  22. * https://openapi-generator.tech
  23. * Do not edit the class manually.
  24. */
  25. namespace WikipaliApi\Api;
  26. use GuzzleHttp\Client;
  27. use GuzzleHttp\ClientInterface;
  28. use GuzzleHttp\Exception\ConnectException;
  29. use GuzzleHttp\Exception\RequestException;
  30. use GuzzleHttp\Psr7\MultipartStream;
  31. use GuzzleHttp\Psr7\Request;
  32. use GuzzleHttp\RequestOptions;
  33. use Psr\Http\Message\RequestInterface;
  34. use Psr\Http\Message\ResponseInterface;
  35. use WikipaliApi\ApiException;
  36. use WikipaliApi\Configuration;
  37. use WikipaliApi\FormDataProcessor;
  38. use WikipaliApi\HeaderSelector;
  39. use WikipaliApi\ObjectSerializer;
  40. /**
  41. * GroupsApi Class Doc Comment
  42. *
  43. * @category Class
  44. * @package WikipaliApi
  45. * @author OpenAPI Generator team
  46. * @link https://openapi-generator.tech
  47. */
  48. class GroupsApi
  49. {
  50. /**
  51. * @var ClientInterface
  52. */
  53. protected $client;
  54. /**
  55. * @var Configuration
  56. */
  57. protected $config;
  58. /**
  59. * @var HeaderSelector
  60. */
  61. protected $headerSelector;
  62. /**
  63. * @var int Host index
  64. */
  65. protected $hostIndex;
  66. /** @var string[] $contentTypes **/
  67. public const contentTypes = [
  68. 'deleteApiV3GroupsGroup' => [
  69. 'application/json',
  70. ],
  71. 'deleteApiV3GroupsGroupMembersMember' => [
  72. 'application/json',
  73. ],
  74. 'deleteApiV3GroupsGroupSharesShare' => [
  75. 'application/json',
  76. ],
  77. 'getApiV3Groups' => [
  78. 'application/json',
  79. ],
  80. 'getApiV3GroupsGroup' => [
  81. 'application/json',
  82. ],
  83. 'getApiV3GroupsGroupMembers' => [
  84. 'application/json',
  85. ],
  86. 'getApiV3GroupsGroupShares' => [
  87. 'application/json',
  88. ],
  89. 'getApiV3MeGroups' => [
  90. 'application/json',
  91. ],
  92. 'patchApiV3GroupsGroup' => [
  93. 'application/json',
  94. ],
  95. 'patchApiV3GroupsGroupMembersMember' => [
  96. 'application/json',
  97. ],
  98. 'postApiV3Groups' => [
  99. 'application/json',
  100. ],
  101. 'postApiV3GroupsGroupInviteLinks' => [
  102. 'application/json',
  103. ],
  104. 'postApiV3GroupsGroupMembers' => [
  105. 'application/json',
  106. ],
  107. 'postApiV3MeGroups' => [
  108. 'application/json',
  109. ],
  110. ];
  111. /**
  112. * @param ClientInterface $client
  113. * @param Configuration $config
  114. * @param HeaderSelector $selector
  115. * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
  116. */
  117. public function __construct(
  118. ?ClientInterface $client = null,
  119. ?Configuration $config = null,
  120. ?HeaderSelector $selector = null,
  121. int $hostIndex = 0
  122. ) {
  123. $this->client = $client ?: new Client();
  124. $this->config = $config ?: Configuration::getDefaultConfiguration();
  125. $this->headerSelector = $selector ?: new HeaderSelector();
  126. $this->hostIndex = $hostIndex;
  127. }
  128. /**
  129. * Set the host index
  130. *
  131. * @param int $hostIndex Host index (required)
  132. */
  133. public function setHostIndex($hostIndex): void
  134. {
  135. $this->hostIndex = $hostIndex;
  136. }
  137. /**
  138. * Get the host index
  139. *
  140. * @return int Host index
  141. */
  142. public function getHostIndex()
  143. {
  144. return $this->hostIndex;
  145. }
  146. /**
  147. * @return Configuration
  148. */
  149. public function getConfig()
  150. {
  151. return $this->config;
  152. }
  153. /**
  154. * Operation deleteApiV3GroupsGroup
  155. *
  156. * 删团队
  157. *
  158. * @param string $group 团队 uid (required)
  159. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
  160. *
  161. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  162. * @throws \InvalidArgumentException
  163. * @return void
  164. */
  165. public function deleteApiV3GroupsGroup($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
  166. {
  167. $this->deleteApiV3GroupsGroupWithHttpInfo($group, $contentType);
  168. }
  169. /**
  170. * Operation deleteApiV3GroupsGroupWithHttpInfo
  171. *
  172. * 删团队
  173. *
  174. * @param string $group 团队 uid (required)
  175. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
  176. *
  177. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  178. * @throws \InvalidArgumentException
  179. * @return array of null, HTTP status code, HTTP response headers (array of strings)
  180. */
  181. public function deleteApiV3GroupsGroupWithHttpInfo($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
  182. {
  183. $request = $this->deleteApiV3GroupsGroupRequest($group, $contentType);
  184. try {
  185. $options = $this->createHttpClientOption();
  186. try {
  187. $response = $this->client->send($request, $options);
  188. } catch (RequestException $e) {
  189. throw new ApiException(
  190. "[{$e->getCode()}] {$e->getMessage()}",
  191. (int) $e->getCode(),
  192. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  193. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  194. );
  195. } catch (ConnectException $e) {
  196. throw new ApiException(
  197. "[{$e->getCode()}] {$e->getMessage()}",
  198. (int) $e->getCode(),
  199. null,
  200. null
  201. );
  202. }
  203. $statusCode = $response->getStatusCode();
  204. return [null, $statusCode, $response->getHeaders()];
  205. } catch (ApiException $e) {
  206. switch ($e->getCode()) {
  207. case 401:
  208. $data = ObjectSerializer::deserialize(
  209. $e->getResponseBody(),
  210. '\WikipaliApi\Model\ProblemDetails',
  211. $e->getResponseHeaders()
  212. );
  213. $e->setResponseObject($data);
  214. throw $e;
  215. case 403:
  216. $data = ObjectSerializer::deserialize(
  217. $e->getResponseBody(),
  218. '\WikipaliApi\Model\ProblemDetails',
  219. $e->getResponseHeaders()
  220. );
  221. $e->setResponseObject($data);
  222. throw $e;
  223. case 409:
  224. $data = ObjectSerializer::deserialize(
  225. $e->getResponseBody(),
  226. '\WikipaliApi\Model\ProblemDetails',
  227. $e->getResponseHeaders()
  228. );
  229. $e->setResponseObject($data);
  230. throw $e;
  231. case 422:
  232. $data = ObjectSerializer::deserialize(
  233. $e->getResponseBody(),
  234. '\WikipaliApi\Model\ProblemDetails',
  235. $e->getResponseHeaders()
  236. );
  237. $e->setResponseObject($data);
  238. throw $e;
  239. }
  240. throw $e;
  241. }
  242. }
  243. /**
  244. * Operation deleteApiV3GroupsGroupAsync
  245. *
  246. * 删团队
  247. *
  248. * @param string $group 团队 uid (required)
  249. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
  250. *
  251. * @throws \InvalidArgumentException
  252. * @return \GuzzleHttp\Promise\PromiseInterface
  253. */
  254. public function deleteApiV3GroupsGroupAsync($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
  255. {
  256. return $this->deleteApiV3GroupsGroupAsyncWithHttpInfo($group, $contentType)
  257. ->then(
  258. function ($response) {
  259. return $response[0];
  260. }
  261. );
  262. }
  263. /**
  264. * Operation deleteApiV3GroupsGroupAsyncWithHttpInfo
  265. *
  266. * 删团队
  267. *
  268. * @param string $group 团队 uid (required)
  269. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
  270. *
  271. * @throws \InvalidArgumentException
  272. * @return \GuzzleHttp\Promise\PromiseInterface
  273. */
  274. public function deleteApiV3GroupsGroupAsyncWithHttpInfo($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
  275. {
  276. $returnType = '';
  277. $request = $this->deleteApiV3GroupsGroupRequest($group, $contentType);
  278. return $this->client
  279. ->sendAsync($request, $this->createHttpClientOption())
  280. ->then(
  281. function ($response) use ($returnType) {
  282. return [null, $response->getStatusCode(), $response->getHeaders()];
  283. },
  284. function ($exception) {
  285. $response = $exception->getResponse();
  286. $statusCode = $response->getStatusCode();
  287. throw new ApiException(
  288. sprintf(
  289. '[%d] Error connecting to the API (%s)',
  290. $statusCode,
  291. $exception->getRequest()->getUri()
  292. ),
  293. $statusCode,
  294. $response->getHeaders(),
  295. (string) $response->getBody()
  296. );
  297. }
  298. );
  299. }
  300. /**
  301. * Create request for operation 'deleteApiV3GroupsGroup'
  302. *
  303. * @param string $group 团队 uid (required)
  304. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroup'] to see the possible values for this operation
  305. *
  306. * @throws \InvalidArgumentException
  307. * @return \GuzzleHttp\Psr7\Request
  308. */
  309. public function deleteApiV3GroupsGroupRequest($group, string $contentType = self::contentTypes['deleteApiV3GroupsGroup'][0])
  310. {
  311. // verify the required parameter 'group' is set
  312. if ($group === null || (is_array($group) && count($group) === 0)) {
  313. throw new \InvalidArgumentException(
  314. 'Missing the required parameter $group when calling deleteApiV3GroupsGroup'
  315. );
  316. }
  317. $resourcePath = '/v3/groups/{group}';
  318. $formParams = [];
  319. $queryParams = [];
  320. $headerParams = [];
  321. $httpBody = '';
  322. $multipart = false;
  323. // path params
  324. if ($group !== null) {
  325. $resourcePath = str_replace(
  326. '{group}',
  327. ObjectSerializer::toPathValue($group),
  328. $resourcePath
  329. );
  330. }
  331. $headers = $this->headerSelector->selectHeaders(
  332. ['application/problem+json', ],
  333. $contentType,
  334. $multipart
  335. );
  336. // for model (json/xml)
  337. if (count($formParams) > 0) {
  338. if ($multipart) {
  339. $multipartContents = [];
  340. foreach ($formParams as $formParamName => $formParamValue) {
  341. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  342. foreach ($formParamValueItems as $formParamValueItem) {
  343. $multipartContents[] = [
  344. 'name' => $formParamName,
  345. 'contents' => $formParamValueItem
  346. ];
  347. }
  348. }
  349. // for HTTP post (form)
  350. $httpBody = new MultipartStream($multipartContents);
  351. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  352. # if Content-Type contains "application/json", json_encode the form parameters
  353. try {
  354. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  355. } catch (\JsonException $e) {
  356. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  357. }
  358. } else {
  359. // for HTTP post (form)
  360. $httpBody = ObjectSerializer::buildQuery($formParams);
  361. }
  362. }
  363. // this endpoint requires Bearer authentication (access token)
  364. if (!empty($this->config->getAccessToken())) {
  365. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  366. }
  367. $defaultHeaders = [];
  368. if ($this->config->getUserAgent()) {
  369. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  370. }
  371. $headers = array_merge(
  372. $defaultHeaders,
  373. $headerParams,
  374. $headers
  375. );
  376. $operationHost = $this->config->getHost();
  377. $query = ObjectSerializer::buildQuery($queryParams);
  378. return new Request(
  379. 'DELETE',
  380. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  381. $headers,
  382. $httpBody
  383. );
  384. }
  385. /**
  386. * Operation deleteApiV3GroupsGroupMembersMember
  387. *
  388. * 移除成员 / 退出团队
  389. *
  390. * @param string $group 团队 uid (required)
  391. * @param string $member 成员记录 id (required)
  392. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  393. *
  394. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  395. * @throws \InvalidArgumentException
  396. * @return void
  397. */
  398. public function deleteApiV3GroupsGroupMembersMember($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
  399. {
  400. $this->deleteApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $contentType);
  401. }
  402. /**
  403. * Operation deleteApiV3GroupsGroupMembersMemberWithHttpInfo
  404. *
  405. * 移除成员 / 退出团队
  406. *
  407. * @param string $group 团队 uid (required)
  408. * @param string $member 成员记录 id (required)
  409. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  410. *
  411. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  412. * @throws \InvalidArgumentException
  413. * @return array of null, HTTP status code, HTTP response headers (array of strings)
  414. */
  415. public function deleteApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
  416. {
  417. $request = $this->deleteApiV3GroupsGroupMembersMemberRequest($group, $member, $contentType);
  418. try {
  419. $options = $this->createHttpClientOption();
  420. try {
  421. $response = $this->client->send($request, $options);
  422. } catch (RequestException $e) {
  423. throw new ApiException(
  424. "[{$e->getCode()}] {$e->getMessage()}",
  425. (int) $e->getCode(),
  426. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  427. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  428. );
  429. } catch (ConnectException $e) {
  430. throw new ApiException(
  431. "[{$e->getCode()}] {$e->getMessage()}",
  432. (int) $e->getCode(),
  433. null,
  434. null
  435. );
  436. }
  437. $statusCode = $response->getStatusCode();
  438. return [null, $statusCode, $response->getHeaders()];
  439. } catch (ApiException $e) {
  440. switch ($e->getCode()) {
  441. case 401:
  442. $data = ObjectSerializer::deserialize(
  443. $e->getResponseBody(),
  444. '\WikipaliApi\Model\ProblemDetails',
  445. $e->getResponseHeaders()
  446. );
  447. $e->setResponseObject($data);
  448. throw $e;
  449. case 403:
  450. $data = ObjectSerializer::deserialize(
  451. $e->getResponseBody(),
  452. '\WikipaliApi\Model\ProblemDetails',
  453. $e->getResponseHeaders()
  454. );
  455. $e->setResponseObject($data);
  456. throw $e;
  457. case 422:
  458. $data = ObjectSerializer::deserialize(
  459. $e->getResponseBody(),
  460. '\WikipaliApi\Model\ProblemDetails',
  461. $e->getResponseHeaders()
  462. );
  463. $e->setResponseObject($data);
  464. throw $e;
  465. }
  466. throw $e;
  467. }
  468. }
  469. /**
  470. * Operation deleteApiV3GroupsGroupMembersMemberAsync
  471. *
  472. * 移除成员 / 退出团队
  473. *
  474. * @param string $group 团队 uid (required)
  475. * @param string $member 成员记录 id (required)
  476. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  477. *
  478. * @throws \InvalidArgumentException
  479. * @return \GuzzleHttp\Promise\PromiseInterface
  480. */
  481. public function deleteApiV3GroupsGroupMembersMemberAsync($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
  482. {
  483. return $this->deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $contentType)
  484. ->then(
  485. function ($response) {
  486. return $response[0];
  487. }
  488. );
  489. }
  490. /**
  491. * Operation deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo
  492. *
  493. * 移除成员 / 退出团队
  494. *
  495. * @param string $group 团队 uid (required)
  496. * @param string $member 成员记录 id (required)
  497. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  498. *
  499. * @throws \InvalidArgumentException
  500. * @return \GuzzleHttp\Promise\PromiseInterface
  501. */
  502. public function deleteApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
  503. {
  504. $returnType = '';
  505. $request = $this->deleteApiV3GroupsGroupMembersMemberRequest($group, $member, $contentType);
  506. return $this->client
  507. ->sendAsync($request, $this->createHttpClientOption())
  508. ->then(
  509. function ($response) use ($returnType) {
  510. return [null, $response->getStatusCode(), $response->getHeaders()];
  511. },
  512. function ($exception) {
  513. $response = $exception->getResponse();
  514. $statusCode = $response->getStatusCode();
  515. throw new ApiException(
  516. sprintf(
  517. '[%d] Error connecting to the API (%s)',
  518. $statusCode,
  519. $exception->getRequest()->getUri()
  520. ),
  521. $statusCode,
  522. $response->getHeaders(),
  523. (string) $response->getBody()
  524. );
  525. }
  526. );
  527. }
  528. /**
  529. * Create request for operation 'deleteApiV3GroupsGroupMembersMember'
  530. *
  531. * @param string $group 团队 uid (required)
  532. * @param string $member 成员记录 id (required)
  533. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  534. *
  535. * @throws \InvalidArgumentException
  536. * @return \GuzzleHttp\Psr7\Request
  537. */
  538. public function deleteApiV3GroupsGroupMembersMemberRequest($group, $member, string $contentType = self::contentTypes['deleteApiV3GroupsGroupMembersMember'][0])
  539. {
  540. // verify the required parameter 'group' is set
  541. if ($group === null || (is_array($group) && count($group) === 0)) {
  542. throw new \InvalidArgumentException(
  543. 'Missing the required parameter $group when calling deleteApiV3GroupsGroupMembersMember'
  544. );
  545. }
  546. // verify the required parameter 'member' is set
  547. if ($member === null || (is_array($member) && count($member) === 0)) {
  548. throw new \InvalidArgumentException(
  549. 'Missing the required parameter $member when calling deleteApiV3GroupsGroupMembersMember'
  550. );
  551. }
  552. $resourcePath = '/v3/groups/{group}/members/{member}';
  553. $formParams = [];
  554. $queryParams = [];
  555. $headerParams = [];
  556. $httpBody = '';
  557. $multipart = false;
  558. // path params
  559. if ($group !== null) {
  560. $resourcePath = str_replace(
  561. '{group}',
  562. ObjectSerializer::toPathValue($group),
  563. $resourcePath
  564. );
  565. }
  566. // path params
  567. if ($member !== null) {
  568. $resourcePath = str_replace(
  569. '{member}',
  570. ObjectSerializer::toPathValue($member),
  571. $resourcePath
  572. );
  573. }
  574. $headers = $this->headerSelector->selectHeaders(
  575. ['application/problem+json', ],
  576. $contentType,
  577. $multipart
  578. );
  579. // for model (json/xml)
  580. if (count($formParams) > 0) {
  581. if ($multipart) {
  582. $multipartContents = [];
  583. foreach ($formParams as $formParamName => $formParamValue) {
  584. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  585. foreach ($formParamValueItems as $formParamValueItem) {
  586. $multipartContents[] = [
  587. 'name' => $formParamName,
  588. 'contents' => $formParamValueItem
  589. ];
  590. }
  591. }
  592. // for HTTP post (form)
  593. $httpBody = new MultipartStream($multipartContents);
  594. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  595. # if Content-Type contains "application/json", json_encode the form parameters
  596. try {
  597. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  598. } catch (\JsonException $e) {
  599. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  600. }
  601. } else {
  602. // for HTTP post (form)
  603. $httpBody = ObjectSerializer::buildQuery($formParams);
  604. }
  605. }
  606. // this endpoint requires Bearer authentication (access token)
  607. if (!empty($this->config->getAccessToken())) {
  608. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  609. }
  610. $defaultHeaders = [];
  611. if ($this->config->getUserAgent()) {
  612. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  613. }
  614. $headers = array_merge(
  615. $defaultHeaders,
  616. $headerParams,
  617. $headers
  618. );
  619. $operationHost = $this->config->getHost();
  620. $query = ObjectSerializer::buildQuery($queryParams);
  621. return new Request(
  622. 'DELETE',
  623. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  624. $headers,
  625. $httpBody
  626. );
  627. }
  628. /**
  629. * Operation deleteApiV3GroupsGroupSharesShare
  630. *
  631. * 把资源移出团队
  632. *
  633. * @param string $group 团队 uid (required)
  634. * @param string $share 共享记录 id (required)
  635. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
  636. *
  637. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  638. * @throws \InvalidArgumentException
  639. * @return void
  640. */
  641. public function deleteApiV3GroupsGroupSharesShare($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
  642. {
  643. $this->deleteApiV3GroupsGroupSharesShareWithHttpInfo($group, $share, $contentType);
  644. }
  645. /**
  646. * Operation deleteApiV3GroupsGroupSharesShareWithHttpInfo
  647. *
  648. * 把资源移出团队
  649. *
  650. * @param string $group 团队 uid (required)
  651. * @param string $share 共享记录 id (required)
  652. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
  653. *
  654. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  655. * @throws \InvalidArgumentException
  656. * @return array of null, HTTP status code, HTTP response headers (array of strings)
  657. */
  658. public function deleteApiV3GroupsGroupSharesShareWithHttpInfo($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
  659. {
  660. $request = $this->deleteApiV3GroupsGroupSharesShareRequest($group, $share, $contentType);
  661. try {
  662. $options = $this->createHttpClientOption();
  663. try {
  664. $response = $this->client->send($request, $options);
  665. } catch (RequestException $e) {
  666. throw new ApiException(
  667. "[{$e->getCode()}] {$e->getMessage()}",
  668. (int) $e->getCode(),
  669. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  670. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  671. );
  672. } catch (ConnectException $e) {
  673. throw new ApiException(
  674. "[{$e->getCode()}] {$e->getMessage()}",
  675. (int) $e->getCode(),
  676. null,
  677. null
  678. );
  679. }
  680. $statusCode = $response->getStatusCode();
  681. return [null, $statusCode, $response->getHeaders()];
  682. } catch (ApiException $e) {
  683. switch ($e->getCode()) {
  684. case 401:
  685. $data = ObjectSerializer::deserialize(
  686. $e->getResponseBody(),
  687. '\WikipaliApi\Model\ProblemDetails',
  688. $e->getResponseHeaders()
  689. );
  690. $e->setResponseObject($data);
  691. throw $e;
  692. case 403:
  693. $data = ObjectSerializer::deserialize(
  694. $e->getResponseBody(),
  695. '\WikipaliApi\Model\ProblemDetails',
  696. $e->getResponseHeaders()
  697. );
  698. $e->setResponseObject($data);
  699. throw $e;
  700. case 422:
  701. $data = ObjectSerializer::deserialize(
  702. $e->getResponseBody(),
  703. '\WikipaliApi\Model\ProblemDetails',
  704. $e->getResponseHeaders()
  705. );
  706. $e->setResponseObject($data);
  707. throw $e;
  708. }
  709. throw $e;
  710. }
  711. }
  712. /**
  713. * Operation deleteApiV3GroupsGroupSharesShareAsync
  714. *
  715. * 把资源移出团队
  716. *
  717. * @param string $group 团队 uid (required)
  718. * @param string $share 共享记录 id (required)
  719. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
  720. *
  721. * @throws \InvalidArgumentException
  722. * @return \GuzzleHttp\Promise\PromiseInterface
  723. */
  724. public function deleteApiV3GroupsGroupSharesShareAsync($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
  725. {
  726. return $this->deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo($group, $share, $contentType)
  727. ->then(
  728. function ($response) {
  729. return $response[0];
  730. }
  731. );
  732. }
  733. /**
  734. * Operation deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo
  735. *
  736. * 把资源移出团队
  737. *
  738. * @param string $group 团队 uid (required)
  739. * @param string $share 共享记录 id (required)
  740. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
  741. *
  742. * @throws \InvalidArgumentException
  743. * @return \GuzzleHttp\Promise\PromiseInterface
  744. */
  745. public function deleteApiV3GroupsGroupSharesShareAsyncWithHttpInfo($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
  746. {
  747. $returnType = '';
  748. $request = $this->deleteApiV3GroupsGroupSharesShareRequest($group, $share, $contentType);
  749. return $this->client
  750. ->sendAsync($request, $this->createHttpClientOption())
  751. ->then(
  752. function ($response) use ($returnType) {
  753. return [null, $response->getStatusCode(), $response->getHeaders()];
  754. },
  755. function ($exception) {
  756. $response = $exception->getResponse();
  757. $statusCode = $response->getStatusCode();
  758. throw new ApiException(
  759. sprintf(
  760. '[%d] Error connecting to the API (%s)',
  761. $statusCode,
  762. $exception->getRequest()->getUri()
  763. ),
  764. $statusCode,
  765. $response->getHeaders(),
  766. (string) $response->getBody()
  767. );
  768. }
  769. );
  770. }
  771. /**
  772. * Create request for operation 'deleteApiV3GroupsGroupSharesShare'
  773. *
  774. * @param string $group 团队 uid (required)
  775. * @param string $share 共享记录 id (required)
  776. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3GroupsGroupSharesShare'] to see the possible values for this operation
  777. *
  778. * @throws \InvalidArgumentException
  779. * @return \GuzzleHttp\Psr7\Request
  780. */
  781. public function deleteApiV3GroupsGroupSharesShareRequest($group, $share, string $contentType = self::contentTypes['deleteApiV3GroupsGroupSharesShare'][0])
  782. {
  783. // verify the required parameter 'group' is set
  784. if ($group === null || (is_array($group) && count($group) === 0)) {
  785. throw new \InvalidArgumentException(
  786. 'Missing the required parameter $group when calling deleteApiV3GroupsGroupSharesShare'
  787. );
  788. }
  789. // verify the required parameter 'share' is set
  790. if ($share === null || (is_array($share) && count($share) === 0)) {
  791. throw new \InvalidArgumentException(
  792. 'Missing the required parameter $share when calling deleteApiV3GroupsGroupSharesShare'
  793. );
  794. }
  795. $resourcePath = '/v3/groups/{group}/shares/{share}';
  796. $formParams = [];
  797. $queryParams = [];
  798. $headerParams = [];
  799. $httpBody = '';
  800. $multipart = false;
  801. // path params
  802. if ($group !== null) {
  803. $resourcePath = str_replace(
  804. '{group}',
  805. ObjectSerializer::toPathValue($group),
  806. $resourcePath
  807. );
  808. }
  809. // path params
  810. if ($share !== null) {
  811. $resourcePath = str_replace(
  812. '{share}',
  813. ObjectSerializer::toPathValue($share),
  814. $resourcePath
  815. );
  816. }
  817. $headers = $this->headerSelector->selectHeaders(
  818. ['application/problem+json', ],
  819. $contentType,
  820. $multipart
  821. );
  822. // for model (json/xml)
  823. if (count($formParams) > 0) {
  824. if ($multipart) {
  825. $multipartContents = [];
  826. foreach ($formParams as $formParamName => $formParamValue) {
  827. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  828. foreach ($formParamValueItems as $formParamValueItem) {
  829. $multipartContents[] = [
  830. 'name' => $formParamName,
  831. 'contents' => $formParamValueItem
  832. ];
  833. }
  834. }
  835. // for HTTP post (form)
  836. $httpBody = new MultipartStream($multipartContents);
  837. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  838. # if Content-Type contains "application/json", json_encode the form parameters
  839. try {
  840. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  841. } catch (\JsonException $e) {
  842. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  843. }
  844. } else {
  845. // for HTTP post (form)
  846. $httpBody = ObjectSerializer::buildQuery($formParams);
  847. }
  848. }
  849. // this endpoint requires Bearer authentication (access token)
  850. if (!empty($this->config->getAccessToken())) {
  851. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  852. }
  853. $defaultHeaders = [];
  854. if ($this->config->getUserAgent()) {
  855. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  856. }
  857. $headers = array_merge(
  858. $defaultHeaders,
  859. $headerParams,
  860. $headers
  861. );
  862. $operationHost = $this->config->getHost();
  863. $query = ObjectSerializer::buildQuery($queryParams);
  864. return new Request(
  865. 'DELETE',
  866. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  867. $headers,
  868. $httpBody
  869. );
  870. }
  871. /**
  872. * Operation getApiV3Groups
  873. *
  874. * 搜公开团队
  875. *
  876. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  877. * @param string|null $search 按团队名模糊匹配 (optional)
  878. * @param int|null $page 页码 (optional, default to 1)
  879. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
  880. *
  881. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  882. * @throws \InvalidArgumentException
  883. * @return \WikipaliApi\Model\GetApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  884. */
  885. public function getApiV3Groups($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
  886. {
  887. list($response) = $this->getApiV3GroupsWithHttpInfo($per_page, $search, $page, $contentType);
  888. return $response;
  889. }
  890. /**
  891. * Operation getApiV3GroupsWithHttpInfo
  892. *
  893. * 搜公开团队
  894. *
  895. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  896. * @param string|null $search 按团队名模糊匹配 (optional)
  897. * @param int|null $page 页码 (optional, default to 1)
  898. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
  899. *
  900. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  901. * @throws \InvalidArgumentException
  902. * @return array of \WikipaliApi\Model\GetApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  903. */
  904. public function getApiV3GroupsWithHttpInfo($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
  905. {
  906. $request = $this->getApiV3GroupsRequest($per_page, $search, $page, $contentType);
  907. try {
  908. $options = $this->createHttpClientOption();
  909. try {
  910. $response = $this->client->send($request, $options);
  911. } catch (RequestException $e) {
  912. throw new ApiException(
  913. "[{$e->getCode()}] {$e->getMessage()}",
  914. (int) $e->getCode(),
  915. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  916. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  917. );
  918. } catch (ConnectException $e) {
  919. throw new ApiException(
  920. "[{$e->getCode()}] {$e->getMessage()}",
  921. (int) $e->getCode(),
  922. null,
  923. null
  924. );
  925. }
  926. $statusCode = $response->getStatusCode();
  927. switch($statusCode) {
  928. case 200:
  929. return $this->handleResponseWithDataType(
  930. '\WikipaliApi\Model\GetApiV3Groups200Response',
  931. $request,
  932. $response,
  933. );
  934. case 401:
  935. return $this->handleResponseWithDataType(
  936. '\WikipaliApi\Model\ProblemDetails',
  937. $request,
  938. $response,
  939. );
  940. case 422:
  941. return $this->handleResponseWithDataType(
  942. '\WikipaliApi\Model\ProblemDetails',
  943. $request,
  944. $response,
  945. );
  946. }
  947. if ($statusCode < 200 || $statusCode > 299) {
  948. throw new ApiException(
  949. sprintf(
  950. '[%d] Error connecting to the API (%s)',
  951. $statusCode,
  952. (string) $request->getUri()
  953. ),
  954. $statusCode,
  955. $response->getHeaders(),
  956. (string) $response->getBody()
  957. );
  958. }
  959. return $this->handleResponseWithDataType(
  960. '\WikipaliApi\Model\GetApiV3Groups200Response',
  961. $request,
  962. $response,
  963. );
  964. } catch (ApiException $e) {
  965. switch ($e->getCode()) {
  966. case 200:
  967. $data = ObjectSerializer::deserialize(
  968. $e->getResponseBody(),
  969. '\WikipaliApi\Model\GetApiV3Groups200Response',
  970. $e->getResponseHeaders()
  971. );
  972. $e->setResponseObject($data);
  973. throw $e;
  974. case 401:
  975. $data = ObjectSerializer::deserialize(
  976. $e->getResponseBody(),
  977. '\WikipaliApi\Model\ProblemDetails',
  978. $e->getResponseHeaders()
  979. );
  980. $e->setResponseObject($data);
  981. throw $e;
  982. case 422:
  983. $data = ObjectSerializer::deserialize(
  984. $e->getResponseBody(),
  985. '\WikipaliApi\Model\ProblemDetails',
  986. $e->getResponseHeaders()
  987. );
  988. $e->setResponseObject($data);
  989. throw $e;
  990. }
  991. throw $e;
  992. }
  993. }
  994. /**
  995. * Operation getApiV3GroupsAsync
  996. *
  997. * 搜公开团队
  998. *
  999. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1000. * @param string|null $search 按团队名模糊匹配 (optional)
  1001. * @param int|null $page 页码 (optional, default to 1)
  1002. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
  1003. *
  1004. * @throws \InvalidArgumentException
  1005. * @return \GuzzleHttp\Promise\PromiseInterface
  1006. */
  1007. public function getApiV3GroupsAsync($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
  1008. {
  1009. return $this->getApiV3GroupsAsyncWithHttpInfo($per_page, $search, $page, $contentType)
  1010. ->then(
  1011. function ($response) {
  1012. return $response[0];
  1013. }
  1014. );
  1015. }
  1016. /**
  1017. * Operation getApiV3GroupsAsyncWithHttpInfo
  1018. *
  1019. * 搜公开团队
  1020. *
  1021. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1022. * @param string|null $search 按团队名模糊匹配 (optional)
  1023. * @param int|null $page 页码 (optional, default to 1)
  1024. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
  1025. *
  1026. * @throws \InvalidArgumentException
  1027. * @return \GuzzleHttp\Promise\PromiseInterface
  1028. */
  1029. public function getApiV3GroupsAsyncWithHttpInfo($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
  1030. {
  1031. $returnType = '\WikipaliApi\Model\GetApiV3Groups200Response';
  1032. $request = $this->getApiV3GroupsRequest($per_page, $search, $page, $contentType);
  1033. return $this->client
  1034. ->sendAsync($request, $this->createHttpClientOption())
  1035. ->then(
  1036. function ($response) use ($returnType) {
  1037. if ($returnType === '\SplFileObject') {
  1038. $content = $response->getBody(); //stream goes to serializer
  1039. } else {
  1040. $content = (string) $response->getBody();
  1041. if ($returnType !== 'string') {
  1042. $content = json_decode($content);
  1043. }
  1044. }
  1045. return [
  1046. ObjectSerializer::deserialize($content, $returnType, []),
  1047. $response->getStatusCode(),
  1048. $response->getHeaders()
  1049. ];
  1050. },
  1051. function ($exception) {
  1052. $response = $exception->getResponse();
  1053. $statusCode = $response->getStatusCode();
  1054. throw new ApiException(
  1055. sprintf(
  1056. '[%d] Error connecting to the API (%s)',
  1057. $statusCode,
  1058. $exception->getRequest()->getUri()
  1059. ),
  1060. $statusCode,
  1061. $response->getHeaders(),
  1062. (string) $response->getBody()
  1063. );
  1064. }
  1065. );
  1066. }
  1067. /**
  1068. * Create request for operation 'getApiV3Groups'
  1069. *
  1070. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1071. * @param string|null $search 按团队名模糊匹配 (optional)
  1072. * @param int|null $page 页码 (optional, default to 1)
  1073. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Groups'] to see the possible values for this operation
  1074. *
  1075. * @throws \InvalidArgumentException
  1076. * @return \GuzzleHttp\Psr7\Request
  1077. */
  1078. public function getApiV3GroupsRequest($per_page = 20, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3Groups'][0])
  1079. {
  1080. $resourcePath = '/v3/groups';
  1081. $formParams = [];
  1082. $queryParams = [];
  1083. $headerParams = [];
  1084. $httpBody = '';
  1085. $multipart = false;
  1086. // query params
  1087. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1088. $per_page,
  1089. 'per_page', // param base name
  1090. 'integer', // openApiType
  1091. 'form', // style
  1092. true, // explode
  1093. false // required
  1094. ) ?? []);
  1095. // query params
  1096. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1097. $search,
  1098. 'search', // param base name
  1099. 'string', // openApiType
  1100. 'form', // style
  1101. true, // explode
  1102. false // required
  1103. ) ?? []);
  1104. // query params
  1105. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1106. $page,
  1107. 'page', // param base name
  1108. 'integer', // openApiType
  1109. 'form', // style
  1110. true, // explode
  1111. false // required
  1112. ) ?? []);
  1113. $headers = $this->headerSelector->selectHeaders(
  1114. ['application/json', 'application/problem+json', ],
  1115. $contentType,
  1116. $multipart
  1117. );
  1118. // for model (json/xml)
  1119. if (count($formParams) > 0) {
  1120. if ($multipart) {
  1121. $multipartContents = [];
  1122. foreach ($formParams as $formParamName => $formParamValue) {
  1123. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  1124. foreach ($formParamValueItems as $formParamValueItem) {
  1125. $multipartContents[] = [
  1126. 'name' => $formParamName,
  1127. 'contents' => $formParamValueItem
  1128. ];
  1129. }
  1130. }
  1131. // for HTTP post (form)
  1132. $httpBody = new MultipartStream($multipartContents);
  1133. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  1134. # if Content-Type contains "application/json", json_encode the form parameters
  1135. try {
  1136. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  1137. } catch (\JsonException $e) {
  1138. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  1139. }
  1140. } else {
  1141. // for HTTP post (form)
  1142. $httpBody = ObjectSerializer::buildQuery($formParams);
  1143. }
  1144. }
  1145. // this endpoint requires Bearer authentication (access token)
  1146. if (!empty($this->config->getAccessToken())) {
  1147. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  1148. }
  1149. $defaultHeaders = [];
  1150. if ($this->config->getUserAgent()) {
  1151. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1152. }
  1153. $headers = array_merge(
  1154. $defaultHeaders,
  1155. $headerParams,
  1156. $headers
  1157. );
  1158. $operationHost = $this->config->getHost();
  1159. $query = ObjectSerializer::buildQuery($queryParams);
  1160. return new Request(
  1161. 'GET',
  1162. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  1163. $headers,
  1164. $httpBody
  1165. );
  1166. }
  1167. /**
  1168. * Operation getApiV3GroupsGroup
  1169. *
  1170. * 团队详情
  1171. *
  1172. * @param string $group 团队 uid (required)
  1173. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
  1174. *
  1175. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1176. * @throws \InvalidArgumentException
  1177. * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  1178. */
  1179. public function getApiV3GroupsGroup($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
  1180. {
  1181. list($response) = $this->getApiV3GroupsGroupWithHttpInfo($group, $contentType);
  1182. return $response;
  1183. }
  1184. /**
  1185. * Operation getApiV3GroupsGroupWithHttpInfo
  1186. *
  1187. * 团队详情
  1188. *
  1189. * @param string $group 团队 uid (required)
  1190. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
  1191. *
  1192. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1193. * @throws \InvalidArgumentException
  1194. * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  1195. */
  1196. public function getApiV3GroupsGroupWithHttpInfo($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
  1197. {
  1198. $request = $this->getApiV3GroupsGroupRequest($group, $contentType);
  1199. try {
  1200. $options = $this->createHttpClientOption();
  1201. try {
  1202. $response = $this->client->send($request, $options);
  1203. } catch (RequestException $e) {
  1204. throw new ApiException(
  1205. "[{$e->getCode()}] {$e->getMessage()}",
  1206. (int) $e->getCode(),
  1207. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1208. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  1209. );
  1210. } catch (ConnectException $e) {
  1211. throw new ApiException(
  1212. "[{$e->getCode()}] {$e->getMessage()}",
  1213. (int) $e->getCode(),
  1214. null,
  1215. null
  1216. );
  1217. }
  1218. $statusCode = $response->getStatusCode();
  1219. switch($statusCode) {
  1220. case 200:
  1221. return $this->handleResponseWithDataType(
  1222. '\WikipaliApi\Model\PostApiV3Groups200Response',
  1223. $request,
  1224. $response,
  1225. );
  1226. case 403:
  1227. return $this->handleResponseWithDataType(
  1228. '\WikipaliApi\Model\ProblemDetails',
  1229. $request,
  1230. $response,
  1231. );
  1232. case 422:
  1233. return $this->handleResponseWithDataType(
  1234. '\WikipaliApi\Model\ProblemDetails',
  1235. $request,
  1236. $response,
  1237. );
  1238. }
  1239. if ($statusCode < 200 || $statusCode > 299) {
  1240. throw new ApiException(
  1241. sprintf(
  1242. '[%d] Error connecting to the API (%s)',
  1243. $statusCode,
  1244. (string) $request->getUri()
  1245. ),
  1246. $statusCode,
  1247. $response->getHeaders(),
  1248. (string) $response->getBody()
  1249. );
  1250. }
  1251. return $this->handleResponseWithDataType(
  1252. '\WikipaliApi\Model\PostApiV3Groups200Response',
  1253. $request,
  1254. $response,
  1255. );
  1256. } catch (ApiException $e) {
  1257. switch ($e->getCode()) {
  1258. case 200:
  1259. $data = ObjectSerializer::deserialize(
  1260. $e->getResponseBody(),
  1261. '\WikipaliApi\Model\PostApiV3Groups200Response',
  1262. $e->getResponseHeaders()
  1263. );
  1264. $e->setResponseObject($data);
  1265. throw $e;
  1266. case 403:
  1267. $data = ObjectSerializer::deserialize(
  1268. $e->getResponseBody(),
  1269. '\WikipaliApi\Model\ProblemDetails',
  1270. $e->getResponseHeaders()
  1271. );
  1272. $e->setResponseObject($data);
  1273. throw $e;
  1274. case 422:
  1275. $data = ObjectSerializer::deserialize(
  1276. $e->getResponseBody(),
  1277. '\WikipaliApi\Model\ProblemDetails',
  1278. $e->getResponseHeaders()
  1279. );
  1280. $e->setResponseObject($data);
  1281. throw $e;
  1282. }
  1283. throw $e;
  1284. }
  1285. }
  1286. /**
  1287. * Operation getApiV3GroupsGroupAsync
  1288. *
  1289. * 团队详情
  1290. *
  1291. * @param string $group 团队 uid (required)
  1292. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
  1293. *
  1294. * @throws \InvalidArgumentException
  1295. * @return \GuzzleHttp\Promise\PromiseInterface
  1296. */
  1297. public function getApiV3GroupsGroupAsync($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
  1298. {
  1299. return $this->getApiV3GroupsGroupAsyncWithHttpInfo($group, $contentType)
  1300. ->then(
  1301. function ($response) {
  1302. return $response[0];
  1303. }
  1304. );
  1305. }
  1306. /**
  1307. * Operation getApiV3GroupsGroupAsyncWithHttpInfo
  1308. *
  1309. * 团队详情
  1310. *
  1311. * @param string $group 团队 uid (required)
  1312. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
  1313. *
  1314. * @throws \InvalidArgumentException
  1315. * @return \GuzzleHttp\Promise\PromiseInterface
  1316. */
  1317. public function getApiV3GroupsGroupAsyncWithHttpInfo($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
  1318. {
  1319. $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
  1320. $request = $this->getApiV3GroupsGroupRequest($group, $contentType);
  1321. return $this->client
  1322. ->sendAsync($request, $this->createHttpClientOption())
  1323. ->then(
  1324. function ($response) use ($returnType) {
  1325. if ($returnType === '\SplFileObject') {
  1326. $content = $response->getBody(); //stream goes to serializer
  1327. } else {
  1328. $content = (string) $response->getBody();
  1329. if ($returnType !== 'string') {
  1330. $content = json_decode($content);
  1331. }
  1332. }
  1333. return [
  1334. ObjectSerializer::deserialize($content, $returnType, []),
  1335. $response->getStatusCode(),
  1336. $response->getHeaders()
  1337. ];
  1338. },
  1339. function ($exception) {
  1340. $response = $exception->getResponse();
  1341. $statusCode = $response->getStatusCode();
  1342. throw new ApiException(
  1343. sprintf(
  1344. '[%d] Error connecting to the API (%s)',
  1345. $statusCode,
  1346. $exception->getRequest()->getUri()
  1347. ),
  1348. $statusCode,
  1349. $response->getHeaders(),
  1350. (string) $response->getBody()
  1351. );
  1352. }
  1353. );
  1354. }
  1355. /**
  1356. * Create request for operation 'getApiV3GroupsGroup'
  1357. *
  1358. * @param string $group 团队 uid (required)
  1359. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroup'] to see the possible values for this operation
  1360. *
  1361. * @throws \InvalidArgumentException
  1362. * @return \GuzzleHttp\Psr7\Request
  1363. */
  1364. public function getApiV3GroupsGroupRequest($group, string $contentType = self::contentTypes['getApiV3GroupsGroup'][0])
  1365. {
  1366. // verify the required parameter 'group' is set
  1367. if ($group === null || (is_array($group) && count($group) === 0)) {
  1368. throw new \InvalidArgumentException(
  1369. 'Missing the required parameter $group when calling getApiV3GroupsGroup'
  1370. );
  1371. }
  1372. $resourcePath = '/v3/groups/{group}';
  1373. $formParams = [];
  1374. $queryParams = [];
  1375. $headerParams = [];
  1376. $httpBody = '';
  1377. $multipart = false;
  1378. // path params
  1379. if ($group !== null) {
  1380. $resourcePath = str_replace(
  1381. '{group}',
  1382. ObjectSerializer::toPathValue($group),
  1383. $resourcePath
  1384. );
  1385. }
  1386. $headers = $this->headerSelector->selectHeaders(
  1387. ['application/json', 'application/problem+json', ],
  1388. $contentType,
  1389. $multipart
  1390. );
  1391. // for model (json/xml)
  1392. if (count($formParams) > 0) {
  1393. if ($multipart) {
  1394. $multipartContents = [];
  1395. foreach ($formParams as $formParamName => $formParamValue) {
  1396. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  1397. foreach ($formParamValueItems as $formParamValueItem) {
  1398. $multipartContents[] = [
  1399. 'name' => $formParamName,
  1400. 'contents' => $formParamValueItem
  1401. ];
  1402. }
  1403. }
  1404. // for HTTP post (form)
  1405. $httpBody = new MultipartStream($multipartContents);
  1406. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  1407. # if Content-Type contains "application/json", json_encode the form parameters
  1408. try {
  1409. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  1410. } catch (\JsonException $e) {
  1411. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  1412. }
  1413. } else {
  1414. // for HTTP post (form)
  1415. $httpBody = ObjectSerializer::buildQuery($formParams);
  1416. }
  1417. }
  1418. // this endpoint requires Bearer authentication (access token)
  1419. if (!empty($this->config->getAccessToken())) {
  1420. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  1421. }
  1422. $defaultHeaders = [];
  1423. if ($this->config->getUserAgent()) {
  1424. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1425. }
  1426. $headers = array_merge(
  1427. $defaultHeaders,
  1428. $headerParams,
  1429. $headers
  1430. );
  1431. $operationHost = $this->config->getHost();
  1432. $query = ObjectSerializer::buildQuery($queryParams);
  1433. return new Request(
  1434. 'GET',
  1435. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  1436. $headers,
  1437. $httpBody
  1438. );
  1439. }
  1440. /**
  1441. * Operation getApiV3GroupsGroupMembers
  1442. *
  1443. * 列出团队成员
  1444. *
  1445. * @param string $group 团队 uid (required)
  1446. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  1447. * @param int|null $page 页码 (optional, default to 1)
  1448. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
  1449. *
  1450. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1451. * @throws \InvalidArgumentException
  1452. * @return \WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  1453. */
  1454. public function getApiV3GroupsGroupMembers($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
  1455. {
  1456. list($response) = $this->getApiV3GroupsGroupMembersWithHttpInfo($group, $per_page, $page, $contentType);
  1457. return $response;
  1458. }
  1459. /**
  1460. * Operation getApiV3GroupsGroupMembersWithHttpInfo
  1461. *
  1462. * 列出团队成员
  1463. *
  1464. * @param string $group 团队 uid (required)
  1465. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  1466. * @param int|null $page 页码 (optional, default to 1)
  1467. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
  1468. *
  1469. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1470. * @throws \InvalidArgumentException
  1471. * @return array of \WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  1472. */
  1473. public function getApiV3GroupsGroupMembersWithHttpInfo($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
  1474. {
  1475. $request = $this->getApiV3GroupsGroupMembersRequest($group, $per_page, $page, $contentType);
  1476. try {
  1477. $options = $this->createHttpClientOption();
  1478. try {
  1479. $response = $this->client->send($request, $options);
  1480. } catch (RequestException $e) {
  1481. throw new ApiException(
  1482. "[{$e->getCode()}] {$e->getMessage()}",
  1483. (int) $e->getCode(),
  1484. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1485. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  1486. );
  1487. } catch (ConnectException $e) {
  1488. throw new ApiException(
  1489. "[{$e->getCode()}] {$e->getMessage()}",
  1490. (int) $e->getCode(),
  1491. null,
  1492. null
  1493. );
  1494. }
  1495. $statusCode = $response->getStatusCode();
  1496. switch($statusCode) {
  1497. case 200:
  1498. return $this->handleResponseWithDataType(
  1499. '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
  1500. $request,
  1501. $response,
  1502. );
  1503. case 401:
  1504. return $this->handleResponseWithDataType(
  1505. '\WikipaliApi\Model\ProblemDetails',
  1506. $request,
  1507. $response,
  1508. );
  1509. case 403:
  1510. return $this->handleResponseWithDataType(
  1511. '\WikipaliApi\Model\ProblemDetails',
  1512. $request,
  1513. $response,
  1514. );
  1515. case 422:
  1516. return $this->handleResponseWithDataType(
  1517. '\WikipaliApi\Model\ProblemDetails',
  1518. $request,
  1519. $response,
  1520. );
  1521. }
  1522. if ($statusCode < 200 || $statusCode > 299) {
  1523. throw new ApiException(
  1524. sprintf(
  1525. '[%d] Error connecting to the API (%s)',
  1526. $statusCode,
  1527. (string) $request->getUri()
  1528. ),
  1529. $statusCode,
  1530. $response->getHeaders(),
  1531. (string) $response->getBody()
  1532. );
  1533. }
  1534. return $this->handleResponseWithDataType(
  1535. '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
  1536. $request,
  1537. $response,
  1538. );
  1539. } catch (ApiException $e) {
  1540. switch ($e->getCode()) {
  1541. case 200:
  1542. $data = ObjectSerializer::deserialize(
  1543. $e->getResponseBody(),
  1544. '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response',
  1545. $e->getResponseHeaders()
  1546. );
  1547. $e->setResponseObject($data);
  1548. throw $e;
  1549. case 401:
  1550. $data = ObjectSerializer::deserialize(
  1551. $e->getResponseBody(),
  1552. '\WikipaliApi\Model\ProblemDetails',
  1553. $e->getResponseHeaders()
  1554. );
  1555. $e->setResponseObject($data);
  1556. throw $e;
  1557. case 403:
  1558. $data = ObjectSerializer::deserialize(
  1559. $e->getResponseBody(),
  1560. '\WikipaliApi\Model\ProblemDetails',
  1561. $e->getResponseHeaders()
  1562. );
  1563. $e->setResponseObject($data);
  1564. throw $e;
  1565. case 422:
  1566. $data = ObjectSerializer::deserialize(
  1567. $e->getResponseBody(),
  1568. '\WikipaliApi\Model\ProblemDetails',
  1569. $e->getResponseHeaders()
  1570. );
  1571. $e->setResponseObject($data);
  1572. throw $e;
  1573. }
  1574. throw $e;
  1575. }
  1576. }
  1577. /**
  1578. * Operation getApiV3GroupsGroupMembersAsync
  1579. *
  1580. * 列出团队成员
  1581. *
  1582. * @param string $group 团队 uid (required)
  1583. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  1584. * @param int|null $page 页码 (optional, default to 1)
  1585. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
  1586. *
  1587. * @throws \InvalidArgumentException
  1588. * @return \GuzzleHttp\Promise\PromiseInterface
  1589. */
  1590. public function getApiV3GroupsGroupMembersAsync($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
  1591. {
  1592. return $this->getApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $per_page, $page, $contentType)
  1593. ->then(
  1594. function ($response) {
  1595. return $response[0];
  1596. }
  1597. );
  1598. }
  1599. /**
  1600. * Operation getApiV3GroupsGroupMembersAsyncWithHttpInfo
  1601. *
  1602. * 列出团队成员
  1603. *
  1604. * @param string $group 团队 uid (required)
  1605. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  1606. * @param int|null $page 页码 (optional, default to 1)
  1607. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
  1608. *
  1609. * @throws \InvalidArgumentException
  1610. * @return \GuzzleHttp\Promise\PromiseInterface
  1611. */
  1612. public function getApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
  1613. {
  1614. $returnType = '\WikipaliApi\Model\GetApiV3GroupsGroupMembers200Response';
  1615. $request = $this->getApiV3GroupsGroupMembersRequest($group, $per_page, $page, $contentType);
  1616. return $this->client
  1617. ->sendAsync($request, $this->createHttpClientOption())
  1618. ->then(
  1619. function ($response) use ($returnType) {
  1620. if ($returnType === '\SplFileObject') {
  1621. $content = $response->getBody(); //stream goes to serializer
  1622. } else {
  1623. $content = (string) $response->getBody();
  1624. if ($returnType !== 'string') {
  1625. $content = json_decode($content);
  1626. }
  1627. }
  1628. return [
  1629. ObjectSerializer::deserialize($content, $returnType, []),
  1630. $response->getStatusCode(),
  1631. $response->getHeaders()
  1632. ];
  1633. },
  1634. function ($exception) {
  1635. $response = $exception->getResponse();
  1636. $statusCode = $response->getStatusCode();
  1637. throw new ApiException(
  1638. sprintf(
  1639. '[%d] Error connecting to the API (%s)',
  1640. $statusCode,
  1641. $exception->getRequest()->getUri()
  1642. ),
  1643. $statusCode,
  1644. $response->getHeaders(),
  1645. (string) $response->getBody()
  1646. );
  1647. }
  1648. );
  1649. }
  1650. /**
  1651. * Create request for operation 'getApiV3GroupsGroupMembers'
  1652. *
  1653. * @param string $group 团队 uid (required)
  1654. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  1655. * @param int|null $page 页码 (optional, default to 1)
  1656. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupMembers'] to see the possible values for this operation
  1657. *
  1658. * @throws \InvalidArgumentException
  1659. * @return \GuzzleHttp\Psr7\Request
  1660. */
  1661. public function getApiV3GroupsGroupMembersRequest($group, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupMembers'][0])
  1662. {
  1663. // verify the required parameter 'group' is set
  1664. if ($group === null || (is_array($group) && count($group) === 0)) {
  1665. throw new \InvalidArgumentException(
  1666. 'Missing the required parameter $group when calling getApiV3GroupsGroupMembers'
  1667. );
  1668. }
  1669. $resourcePath = '/v3/groups/{group}/members';
  1670. $formParams = [];
  1671. $queryParams = [];
  1672. $headerParams = [];
  1673. $httpBody = '';
  1674. $multipart = false;
  1675. // query params
  1676. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1677. $per_page,
  1678. 'per_page', // param base name
  1679. 'integer', // openApiType
  1680. 'form', // style
  1681. true, // explode
  1682. false // required
  1683. ) ?? []);
  1684. // query params
  1685. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1686. $page,
  1687. 'page', // param base name
  1688. 'integer', // openApiType
  1689. 'form', // style
  1690. true, // explode
  1691. false // required
  1692. ) ?? []);
  1693. // path params
  1694. if ($group !== null) {
  1695. $resourcePath = str_replace(
  1696. '{group}',
  1697. ObjectSerializer::toPathValue($group),
  1698. $resourcePath
  1699. );
  1700. }
  1701. $headers = $this->headerSelector->selectHeaders(
  1702. ['application/json', 'application/problem+json', ],
  1703. $contentType,
  1704. $multipart
  1705. );
  1706. // for model (json/xml)
  1707. if (count($formParams) > 0) {
  1708. if ($multipart) {
  1709. $multipartContents = [];
  1710. foreach ($formParams as $formParamName => $formParamValue) {
  1711. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  1712. foreach ($formParamValueItems as $formParamValueItem) {
  1713. $multipartContents[] = [
  1714. 'name' => $formParamName,
  1715. 'contents' => $formParamValueItem
  1716. ];
  1717. }
  1718. }
  1719. // for HTTP post (form)
  1720. $httpBody = new MultipartStream($multipartContents);
  1721. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  1722. # if Content-Type contains "application/json", json_encode the form parameters
  1723. try {
  1724. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  1725. } catch (\JsonException $e) {
  1726. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  1727. }
  1728. } else {
  1729. // for HTTP post (form)
  1730. $httpBody = ObjectSerializer::buildQuery($formParams);
  1731. }
  1732. }
  1733. // this endpoint requires Bearer authentication (access token)
  1734. if (!empty($this->config->getAccessToken())) {
  1735. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  1736. }
  1737. $defaultHeaders = [];
  1738. if ($this->config->getUserAgent()) {
  1739. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  1740. }
  1741. $headers = array_merge(
  1742. $defaultHeaders,
  1743. $headerParams,
  1744. $headers
  1745. );
  1746. $operationHost = $this->config->getHost();
  1747. $query = ObjectSerializer::buildQuery($queryParams);
  1748. return new Request(
  1749. 'GET',
  1750. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  1751. $headers,
  1752. $httpBody
  1753. );
  1754. }
  1755. /**
  1756. * Operation getApiV3GroupsGroupShares
  1757. *
  1758. * 列出团队文档
  1759. *
  1760. * @param string $group 团队 uid (required)
  1761. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1762. * @param int|null $page 页码 (optional, default to 1)
  1763. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
  1764. *
  1765. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1766. * @throws \InvalidArgumentException
  1767. * @return \WikipaliApi\Model\GetApiV3GroupsGroupShares200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  1768. */
  1769. public function getApiV3GroupsGroupShares($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
  1770. {
  1771. list($response) = $this->getApiV3GroupsGroupSharesWithHttpInfo($group, $per_page, $page, $contentType);
  1772. return $response;
  1773. }
  1774. /**
  1775. * Operation getApiV3GroupsGroupSharesWithHttpInfo
  1776. *
  1777. * 列出团队文档
  1778. *
  1779. * @param string $group 团队 uid (required)
  1780. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1781. * @param int|null $page 页码 (optional, default to 1)
  1782. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
  1783. *
  1784. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  1785. * @throws \InvalidArgumentException
  1786. * @return array of \WikipaliApi\Model\GetApiV3GroupsGroupShares200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  1787. */
  1788. public function getApiV3GroupsGroupSharesWithHttpInfo($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
  1789. {
  1790. $request = $this->getApiV3GroupsGroupSharesRequest($group, $per_page, $page, $contentType);
  1791. try {
  1792. $options = $this->createHttpClientOption();
  1793. try {
  1794. $response = $this->client->send($request, $options);
  1795. } catch (RequestException $e) {
  1796. throw new ApiException(
  1797. "[{$e->getCode()}] {$e->getMessage()}",
  1798. (int) $e->getCode(),
  1799. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  1800. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  1801. );
  1802. } catch (ConnectException $e) {
  1803. throw new ApiException(
  1804. "[{$e->getCode()}] {$e->getMessage()}",
  1805. (int) $e->getCode(),
  1806. null,
  1807. null
  1808. );
  1809. }
  1810. $statusCode = $response->getStatusCode();
  1811. switch($statusCode) {
  1812. case 200:
  1813. return $this->handleResponseWithDataType(
  1814. '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
  1815. $request,
  1816. $response,
  1817. );
  1818. case 401:
  1819. return $this->handleResponseWithDataType(
  1820. '\WikipaliApi\Model\ProblemDetails',
  1821. $request,
  1822. $response,
  1823. );
  1824. case 403:
  1825. return $this->handleResponseWithDataType(
  1826. '\WikipaliApi\Model\ProblemDetails',
  1827. $request,
  1828. $response,
  1829. );
  1830. case 422:
  1831. return $this->handleResponseWithDataType(
  1832. '\WikipaliApi\Model\ProblemDetails',
  1833. $request,
  1834. $response,
  1835. );
  1836. }
  1837. if ($statusCode < 200 || $statusCode > 299) {
  1838. throw new ApiException(
  1839. sprintf(
  1840. '[%d] Error connecting to the API (%s)',
  1841. $statusCode,
  1842. (string) $request->getUri()
  1843. ),
  1844. $statusCode,
  1845. $response->getHeaders(),
  1846. (string) $response->getBody()
  1847. );
  1848. }
  1849. return $this->handleResponseWithDataType(
  1850. '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
  1851. $request,
  1852. $response,
  1853. );
  1854. } catch (ApiException $e) {
  1855. switch ($e->getCode()) {
  1856. case 200:
  1857. $data = ObjectSerializer::deserialize(
  1858. $e->getResponseBody(),
  1859. '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response',
  1860. $e->getResponseHeaders()
  1861. );
  1862. $e->setResponseObject($data);
  1863. throw $e;
  1864. case 401:
  1865. $data = ObjectSerializer::deserialize(
  1866. $e->getResponseBody(),
  1867. '\WikipaliApi\Model\ProblemDetails',
  1868. $e->getResponseHeaders()
  1869. );
  1870. $e->setResponseObject($data);
  1871. throw $e;
  1872. case 403:
  1873. $data = ObjectSerializer::deserialize(
  1874. $e->getResponseBody(),
  1875. '\WikipaliApi\Model\ProblemDetails',
  1876. $e->getResponseHeaders()
  1877. );
  1878. $e->setResponseObject($data);
  1879. throw $e;
  1880. case 422:
  1881. $data = ObjectSerializer::deserialize(
  1882. $e->getResponseBody(),
  1883. '\WikipaliApi\Model\ProblemDetails',
  1884. $e->getResponseHeaders()
  1885. );
  1886. $e->setResponseObject($data);
  1887. throw $e;
  1888. }
  1889. throw $e;
  1890. }
  1891. }
  1892. /**
  1893. * Operation getApiV3GroupsGroupSharesAsync
  1894. *
  1895. * 列出团队文档
  1896. *
  1897. * @param string $group 团队 uid (required)
  1898. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1899. * @param int|null $page 页码 (optional, default to 1)
  1900. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
  1901. *
  1902. * @throws \InvalidArgumentException
  1903. * @return \GuzzleHttp\Promise\PromiseInterface
  1904. */
  1905. public function getApiV3GroupsGroupSharesAsync($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
  1906. {
  1907. return $this->getApiV3GroupsGroupSharesAsyncWithHttpInfo($group, $per_page, $page, $contentType)
  1908. ->then(
  1909. function ($response) {
  1910. return $response[0];
  1911. }
  1912. );
  1913. }
  1914. /**
  1915. * Operation getApiV3GroupsGroupSharesAsyncWithHttpInfo
  1916. *
  1917. * 列出团队文档
  1918. *
  1919. * @param string $group 团队 uid (required)
  1920. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1921. * @param int|null $page 页码 (optional, default to 1)
  1922. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
  1923. *
  1924. * @throws \InvalidArgumentException
  1925. * @return \GuzzleHttp\Promise\PromiseInterface
  1926. */
  1927. public function getApiV3GroupsGroupSharesAsyncWithHttpInfo($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
  1928. {
  1929. $returnType = '\WikipaliApi\Model\GetApiV3GroupsGroupShares200Response';
  1930. $request = $this->getApiV3GroupsGroupSharesRequest($group, $per_page, $page, $contentType);
  1931. return $this->client
  1932. ->sendAsync($request, $this->createHttpClientOption())
  1933. ->then(
  1934. function ($response) use ($returnType) {
  1935. if ($returnType === '\SplFileObject') {
  1936. $content = $response->getBody(); //stream goes to serializer
  1937. } else {
  1938. $content = (string) $response->getBody();
  1939. if ($returnType !== 'string') {
  1940. $content = json_decode($content);
  1941. }
  1942. }
  1943. return [
  1944. ObjectSerializer::deserialize($content, $returnType, []),
  1945. $response->getStatusCode(),
  1946. $response->getHeaders()
  1947. ];
  1948. },
  1949. function ($exception) {
  1950. $response = $exception->getResponse();
  1951. $statusCode = $response->getStatusCode();
  1952. throw new ApiException(
  1953. sprintf(
  1954. '[%d] Error connecting to the API (%s)',
  1955. $statusCode,
  1956. $exception->getRequest()->getUri()
  1957. ),
  1958. $statusCode,
  1959. $response->getHeaders(),
  1960. (string) $response->getBody()
  1961. );
  1962. }
  1963. );
  1964. }
  1965. /**
  1966. * Create request for operation 'getApiV3GroupsGroupShares'
  1967. *
  1968. * @param string $group 团队 uid (required)
  1969. * @param int|null $per_page 每页数量,最大 200 (optional, default to 20)
  1970. * @param int|null $page 页码 (optional, default to 1)
  1971. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GroupsGroupShares'] to see the possible values for this operation
  1972. *
  1973. * @throws \InvalidArgumentException
  1974. * @return \GuzzleHttp\Psr7\Request
  1975. */
  1976. public function getApiV3GroupsGroupSharesRequest($group, $per_page = 20, $page = 1, string $contentType = self::contentTypes['getApiV3GroupsGroupShares'][0])
  1977. {
  1978. // verify the required parameter 'group' is set
  1979. if ($group === null || (is_array($group) && count($group) === 0)) {
  1980. throw new \InvalidArgumentException(
  1981. 'Missing the required parameter $group when calling getApiV3GroupsGroupShares'
  1982. );
  1983. }
  1984. $resourcePath = '/v3/groups/{group}/shares';
  1985. $formParams = [];
  1986. $queryParams = [];
  1987. $headerParams = [];
  1988. $httpBody = '';
  1989. $multipart = false;
  1990. // query params
  1991. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  1992. $per_page,
  1993. 'per_page', // param base name
  1994. 'integer', // openApiType
  1995. 'form', // style
  1996. true, // explode
  1997. false // required
  1998. ) ?? []);
  1999. // query params
  2000. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  2001. $page,
  2002. 'page', // param base name
  2003. 'integer', // openApiType
  2004. 'form', // style
  2005. true, // explode
  2006. false // required
  2007. ) ?? []);
  2008. // path params
  2009. if ($group !== null) {
  2010. $resourcePath = str_replace(
  2011. '{group}',
  2012. ObjectSerializer::toPathValue($group),
  2013. $resourcePath
  2014. );
  2015. }
  2016. $headers = $this->headerSelector->selectHeaders(
  2017. ['application/json', 'application/problem+json', ],
  2018. $contentType,
  2019. $multipart
  2020. );
  2021. // for model (json/xml)
  2022. if (count($formParams) > 0) {
  2023. if ($multipart) {
  2024. $multipartContents = [];
  2025. foreach ($formParams as $formParamName => $formParamValue) {
  2026. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  2027. foreach ($formParamValueItems as $formParamValueItem) {
  2028. $multipartContents[] = [
  2029. 'name' => $formParamName,
  2030. 'contents' => $formParamValueItem
  2031. ];
  2032. }
  2033. }
  2034. // for HTTP post (form)
  2035. $httpBody = new MultipartStream($multipartContents);
  2036. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  2037. # if Content-Type contains "application/json", json_encode the form parameters
  2038. try {
  2039. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  2040. } catch (\JsonException $e) {
  2041. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2042. }
  2043. } else {
  2044. // for HTTP post (form)
  2045. $httpBody = ObjectSerializer::buildQuery($formParams);
  2046. }
  2047. }
  2048. // this endpoint requires Bearer authentication (access token)
  2049. if (!empty($this->config->getAccessToken())) {
  2050. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  2051. }
  2052. $defaultHeaders = [];
  2053. if ($this->config->getUserAgent()) {
  2054. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2055. }
  2056. $headers = array_merge(
  2057. $defaultHeaders,
  2058. $headerParams,
  2059. $headers
  2060. );
  2061. $operationHost = $this->config->getHost();
  2062. $query = ObjectSerializer::buildQuery($queryParams);
  2063. return new Request(
  2064. 'GET',
  2065. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  2066. $headers,
  2067. $httpBody
  2068. );
  2069. }
  2070. /**
  2071. * Operation getApiV3MeGroups
  2072. *
  2073. * 列出我加入的团队
  2074. *
  2075. * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
  2076. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  2077. * @param string|null $search 按团队名模糊匹配 (optional)
  2078. * @param int|null $page 页码 (optional, default to 1)
  2079. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
  2080. *
  2081. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2082. * @throws \InvalidArgumentException
  2083. * @return \WikipaliApi\Model\GetApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  2084. */
  2085. public function getApiV3MeGroups($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
  2086. {
  2087. list($response) = $this->getApiV3MeGroupsWithHttpInfo($owned, $per_page, $search, $page, $contentType);
  2088. return $response;
  2089. }
  2090. /**
  2091. * Operation getApiV3MeGroupsWithHttpInfo
  2092. *
  2093. * 列出我加入的团队
  2094. *
  2095. * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
  2096. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  2097. * @param string|null $search 按团队名模糊匹配 (optional)
  2098. * @param int|null $page 页码 (optional, default to 1)
  2099. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
  2100. *
  2101. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2102. * @throws \InvalidArgumentException
  2103. * @return array of \WikipaliApi\Model\GetApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  2104. */
  2105. public function getApiV3MeGroupsWithHttpInfo($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
  2106. {
  2107. $request = $this->getApiV3MeGroupsRequest($owned, $per_page, $search, $page, $contentType);
  2108. try {
  2109. $options = $this->createHttpClientOption();
  2110. try {
  2111. $response = $this->client->send($request, $options);
  2112. } catch (RequestException $e) {
  2113. throw new ApiException(
  2114. "[{$e->getCode()}] {$e->getMessage()}",
  2115. (int) $e->getCode(),
  2116. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2117. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  2118. );
  2119. } catch (ConnectException $e) {
  2120. throw new ApiException(
  2121. "[{$e->getCode()}] {$e->getMessage()}",
  2122. (int) $e->getCode(),
  2123. null,
  2124. null
  2125. );
  2126. }
  2127. $statusCode = $response->getStatusCode();
  2128. switch($statusCode) {
  2129. case 200:
  2130. return $this->handleResponseWithDataType(
  2131. '\WikipaliApi\Model\GetApiV3MeGroups200Response',
  2132. $request,
  2133. $response,
  2134. );
  2135. case 401:
  2136. return $this->handleResponseWithDataType(
  2137. '\WikipaliApi\Model\ProblemDetails',
  2138. $request,
  2139. $response,
  2140. );
  2141. case 422:
  2142. return $this->handleResponseWithDataType(
  2143. '\WikipaliApi\Model\ProblemDetails',
  2144. $request,
  2145. $response,
  2146. );
  2147. }
  2148. if ($statusCode < 200 || $statusCode > 299) {
  2149. throw new ApiException(
  2150. sprintf(
  2151. '[%d] Error connecting to the API (%s)',
  2152. $statusCode,
  2153. (string) $request->getUri()
  2154. ),
  2155. $statusCode,
  2156. $response->getHeaders(),
  2157. (string) $response->getBody()
  2158. );
  2159. }
  2160. return $this->handleResponseWithDataType(
  2161. '\WikipaliApi\Model\GetApiV3MeGroups200Response',
  2162. $request,
  2163. $response,
  2164. );
  2165. } catch (ApiException $e) {
  2166. switch ($e->getCode()) {
  2167. case 200:
  2168. $data = ObjectSerializer::deserialize(
  2169. $e->getResponseBody(),
  2170. '\WikipaliApi\Model\GetApiV3MeGroups200Response',
  2171. $e->getResponseHeaders()
  2172. );
  2173. $e->setResponseObject($data);
  2174. throw $e;
  2175. case 401:
  2176. $data = ObjectSerializer::deserialize(
  2177. $e->getResponseBody(),
  2178. '\WikipaliApi\Model\ProblemDetails',
  2179. $e->getResponseHeaders()
  2180. );
  2181. $e->setResponseObject($data);
  2182. throw $e;
  2183. case 422:
  2184. $data = ObjectSerializer::deserialize(
  2185. $e->getResponseBody(),
  2186. '\WikipaliApi\Model\ProblemDetails',
  2187. $e->getResponseHeaders()
  2188. );
  2189. $e->setResponseObject($data);
  2190. throw $e;
  2191. }
  2192. throw $e;
  2193. }
  2194. }
  2195. /**
  2196. * Operation getApiV3MeGroupsAsync
  2197. *
  2198. * 列出我加入的团队
  2199. *
  2200. * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
  2201. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  2202. * @param string|null $search 按团队名模糊匹配 (optional)
  2203. * @param int|null $page 页码 (optional, default to 1)
  2204. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
  2205. *
  2206. * @throws \InvalidArgumentException
  2207. * @return \GuzzleHttp\Promise\PromiseInterface
  2208. */
  2209. public function getApiV3MeGroupsAsync($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
  2210. {
  2211. return $this->getApiV3MeGroupsAsyncWithHttpInfo($owned, $per_page, $search, $page, $contentType)
  2212. ->then(
  2213. function ($response) {
  2214. return $response[0];
  2215. }
  2216. );
  2217. }
  2218. /**
  2219. * Operation getApiV3MeGroupsAsyncWithHttpInfo
  2220. *
  2221. * 列出我加入的团队
  2222. *
  2223. * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
  2224. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  2225. * @param string|null $search 按团队名模糊匹配 (optional)
  2226. * @param int|null $page 页码 (optional, default to 1)
  2227. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
  2228. *
  2229. * @throws \InvalidArgumentException
  2230. * @return \GuzzleHttp\Promise\PromiseInterface
  2231. */
  2232. public function getApiV3MeGroupsAsyncWithHttpInfo($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
  2233. {
  2234. $returnType = '\WikipaliApi\Model\GetApiV3MeGroups200Response';
  2235. $request = $this->getApiV3MeGroupsRequest($owned, $per_page, $search, $page, $contentType);
  2236. return $this->client
  2237. ->sendAsync($request, $this->createHttpClientOption())
  2238. ->then(
  2239. function ($response) use ($returnType) {
  2240. if ($returnType === '\SplFileObject') {
  2241. $content = $response->getBody(); //stream goes to serializer
  2242. } else {
  2243. $content = (string) $response->getBody();
  2244. if ($returnType !== 'string') {
  2245. $content = json_decode($content);
  2246. }
  2247. }
  2248. return [
  2249. ObjectSerializer::deserialize($content, $returnType, []),
  2250. $response->getStatusCode(),
  2251. $response->getHeaders()
  2252. ];
  2253. },
  2254. function ($exception) {
  2255. $response = $exception->getResponse();
  2256. $statusCode = $response->getStatusCode();
  2257. throw new ApiException(
  2258. sprintf(
  2259. '[%d] Error connecting to the API (%s)',
  2260. $statusCode,
  2261. $exception->getRequest()->getUri()
  2262. ),
  2263. $statusCode,
  2264. $response->getHeaders(),
  2265. (string) $response->getBody()
  2266. );
  2267. }
  2268. );
  2269. }
  2270. /**
  2271. * Create request for operation 'getApiV3MeGroups'
  2272. *
  2273. * @param bool|null $owned true 只列我创建的,false 只列我参加的别人的团队;不传列全部 (optional)
  2274. * @param int|null $per_page 每页数量,最大 200 (optional, default to 100)
  2275. * @param string|null $search 按团队名模糊匹配 (optional)
  2276. * @param int|null $page 页码 (optional, default to 1)
  2277. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3MeGroups'] to see the possible values for this operation
  2278. *
  2279. * @throws \InvalidArgumentException
  2280. * @return \GuzzleHttp\Psr7\Request
  2281. */
  2282. public function getApiV3MeGroupsRequest($owned = null, $per_page = 100, $search = null, $page = 1, string $contentType = self::contentTypes['getApiV3MeGroups'][0])
  2283. {
  2284. $resourcePath = '/v3/me/groups';
  2285. $formParams = [];
  2286. $queryParams = [];
  2287. $headerParams = [];
  2288. $httpBody = '';
  2289. $multipart = false;
  2290. // query params
  2291. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  2292. $owned,
  2293. 'owned', // param base name
  2294. 'boolean', // openApiType
  2295. 'form', // style
  2296. true, // explode
  2297. false // required
  2298. ) ?? []);
  2299. // query params
  2300. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  2301. $per_page,
  2302. 'per_page', // param base name
  2303. 'integer', // openApiType
  2304. 'form', // style
  2305. true, // explode
  2306. false // required
  2307. ) ?? []);
  2308. // query params
  2309. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  2310. $search,
  2311. 'search', // param base name
  2312. 'string', // openApiType
  2313. 'form', // style
  2314. true, // explode
  2315. false // required
  2316. ) ?? []);
  2317. // query params
  2318. $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
  2319. $page,
  2320. 'page', // param base name
  2321. 'integer', // openApiType
  2322. 'form', // style
  2323. true, // explode
  2324. false // required
  2325. ) ?? []);
  2326. $headers = $this->headerSelector->selectHeaders(
  2327. ['application/json', 'application/problem+json', ],
  2328. $contentType,
  2329. $multipart
  2330. );
  2331. // for model (json/xml)
  2332. if (count($formParams) > 0) {
  2333. if ($multipart) {
  2334. $multipartContents = [];
  2335. foreach ($formParams as $formParamName => $formParamValue) {
  2336. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  2337. foreach ($formParamValueItems as $formParamValueItem) {
  2338. $multipartContents[] = [
  2339. 'name' => $formParamName,
  2340. 'contents' => $formParamValueItem
  2341. ];
  2342. }
  2343. }
  2344. // for HTTP post (form)
  2345. $httpBody = new MultipartStream($multipartContents);
  2346. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  2347. # if Content-Type contains "application/json", json_encode the form parameters
  2348. try {
  2349. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  2350. } catch (\JsonException $e) {
  2351. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2352. }
  2353. } else {
  2354. // for HTTP post (form)
  2355. $httpBody = ObjectSerializer::buildQuery($formParams);
  2356. }
  2357. }
  2358. // this endpoint requires Bearer authentication (access token)
  2359. if (!empty($this->config->getAccessToken())) {
  2360. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  2361. }
  2362. $defaultHeaders = [];
  2363. if ($this->config->getUserAgent()) {
  2364. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2365. }
  2366. $headers = array_merge(
  2367. $defaultHeaders,
  2368. $headerParams,
  2369. $headers
  2370. );
  2371. $operationHost = $this->config->getHost();
  2372. $query = ObjectSerializer::buildQuery($queryParams);
  2373. return new Request(
  2374. 'GET',
  2375. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  2376. $headers,
  2377. $httpBody
  2378. );
  2379. }
  2380. /**
  2381. * Operation patchApiV3GroupsGroup
  2382. *
  2383. * 改团队信息
  2384. *
  2385. * @param string $group 团队 uid (required)
  2386. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request patch_api_v3_groups_group_request (optional)
  2387. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
  2388. *
  2389. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2390. * @throws \InvalidArgumentException
  2391. * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  2392. */
  2393. public function patchApiV3GroupsGroup($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
  2394. {
  2395. list($response) = $this->patchApiV3GroupsGroupWithHttpInfo($group, $patch_api_v3_groups_group_request, $contentType);
  2396. return $response;
  2397. }
  2398. /**
  2399. * Operation patchApiV3GroupsGroupWithHttpInfo
  2400. *
  2401. * 改团队信息
  2402. *
  2403. * @param string $group 团队 uid (required)
  2404. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
  2405. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
  2406. *
  2407. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2408. * @throws \InvalidArgumentException
  2409. * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  2410. */
  2411. public function patchApiV3GroupsGroupWithHttpInfo($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
  2412. {
  2413. $request = $this->patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request, $contentType);
  2414. try {
  2415. $options = $this->createHttpClientOption();
  2416. try {
  2417. $response = $this->client->send($request, $options);
  2418. } catch (RequestException $e) {
  2419. throw new ApiException(
  2420. "[{$e->getCode()}] {$e->getMessage()}",
  2421. (int) $e->getCode(),
  2422. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2423. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  2424. );
  2425. } catch (ConnectException $e) {
  2426. throw new ApiException(
  2427. "[{$e->getCode()}] {$e->getMessage()}",
  2428. (int) $e->getCode(),
  2429. null,
  2430. null
  2431. );
  2432. }
  2433. $statusCode = $response->getStatusCode();
  2434. switch($statusCode) {
  2435. case 200:
  2436. return $this->handleResponseWithDataType(
  2437. '\WikipaliApi\Model\PostApiV3Groups200Response',
  2438. $request,
  2439. $response,
  2440. );
  2441. case 401:
  2442. return $this->handleResponseWithDataType(
  2443. '\WikipaliApi\Model\ProblemDetails',
  2444. $request,
  2445. $response,
  2446. );
  2447. case 403:
  2448. return $this->handleResponseWithDataType(
  2449. '\WikipaliApi\Model\ProblemDetails',
  2450. $request,
  2451. $response,
  2452. );
  2453. case 422:
  2454. return $this->handleResponseWithDataType(
  2455. '\WikipaliApi\Model\ProblemDetails',
  2456. $request,
  2457. $response,
  2458. );
  2459. }
  2460. if ($statusCode < 200 || $statusCode > 299) {
  2461. throw new ApiException(
  2462. sprintf(
  2463. '[%d] Error connecting to the API (%s)',
  2464. $statusCode,
  2465. (string) $request->getUri()
  2466. ),
  2467. $statusCode,
  2468. $response->getHeaders(),
  2469. (string) $response->getBody()
  2470. );
  2471. }
  2472. return $this->handleResponseWithDataType(
  2473. '\WikipaliApi\Model\PostApiV3Groups200Response',
  2474. $request,
  2475. $response,
  2476. );
  2477. } catch (ApiException $e) {
  2478. switch ($e->getCode()) {
  2479. case 200:
  2480. $data = ObjectSerializer::deserialize(
  2481. $e->getResponseBody(),
  2482. '\WikipaliApi\Model\PostApiV3Groups200Response',
  2483. $e->getResponseHeaders()
  2484. );
  2485. $e->setResponseObject($data);
  2486. throw $e;
  2487. case 401:
  2488. $data = ObjectSerializer::deserialize(
  2489. $e->getResponseBody(),
  2490. '\WikipaliApi\Model\ProblemDetails',
  2491. $e->getResponseHeaders()
  2492. );
  2493. $e->setResponseObject($data);
  2494. throw $e;
  2495. case 403:
  2496. $data = ObjectSerializer::deserialize(
  2497. $e->getResponseBody(),
  2498. '\WikipaliApi\Model\ProblemDetails',
  2499. $e->getResponseHeaders()
  2500. );
  2501. $e->setResponseObject($data);
  2502. throw $e;
  2503. case 422:
  2504. $data = ObjectSerializer::deserialize(
  2505. $e->getResponseBody(),
  2506. '\WikipaliApi\Model\ProblemDetails',
  2507. $e->getResponseHeaders()
  2508. );
  2509. $e->setResponseObject($data);
  2510. throw $e;
  2511. }
  2512. throw $e;
  2513. }
  2514. }
  2515. /**
  2516. * Operation patchApiV3GroupsGroupAsync
  2517. *
  2518. * 改团队信息
  2519. *
  2520. * @param string $group 团队 uid (required)
  2521. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
  2522. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
  2523. *
  2524. * @throws \InvalidArgumentException
  2525. * @return \GuzzleHttp\Promise\PromiseInterface
  2526. */
  2527. public function patchApiV3GroupsGroupAsync($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
  2528. {
  2529. return $this->patchApiV3GroupsGroupAsyncWithHttpInfo($group, $patch_api_v3_groups_group_request, $contentType)
  2530. ->then(
  2531. function ($response) {
  2532. return $response[0];
  2533. }
  2534. );
  2535. }
  2536. /**
  2537. * Operation patchApiV3GroupsGroupAsyncWithHttpInfo
  2538. *
  2539. * 改团队信息
  2540. *
  2541. * @param string $group 团队 uid (required)
  2542. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
  2543. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
  2544. *
  2545. * @throws \InvalidArgumentException
  2546. * @return \GuzzleHttp\Promise\PromiseInterface
  2547. */
  2548. public function patchApiV3GroupsGroupAsyncWithHttpInfo($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
  2549. {
  2550. $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
  2551. $request = $this->patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request, $contentType);
  2552. return $this->client
  2553. ->sendAsync($request, $this->createHttpClientOption())
  2554. ->then(
  2555. function ($response) use ($returnType) {
  2556. if ($returnType === '\SplFileObject') {
  2557. $content = $response->getBody(); //stream goes to serializer
  2558. } else {
  2559. $content = (string) $response->getBody();
  2560. if ($returnType !== 'string') {
  2561. $content = json_decode($content);
  2562. }
  2563. }
  2564. return [
  2565. ObjectSerializer::deserialize($content, $returnType, []),
  2566. $response->getStatusCode(),
  2567. $response->getHeaders()
  2568. ];
  2569. },
  2570. function ($exception) {
  2571. $response = $exception->getResponse();
  2572. $statusCode = $response->getStatusCode();
  2573. throw new ApiException(
  2574. sprintf(
  2575. '[%d] Error connecting to the API (%s)',
  2576. $statusCode,
  2577. $exception->getRequest()->getUri()
  2578. ),
  2579. $statusCode,
  2580. $response->getHeaders(),
  2581. (string) $response->getBody()
  2582. );
  2583. }
  2584. );
  2585. }
  2586. /**
  2587. * Create request for operation 'patchApiV3GroupsGroup'
  2588. *
  2589. * @param string $group 团队 uid (required)
  2590. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupRequest|null $patch_api_v3_groups_group_request (optional)
  2591. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroup'] to see the possible values for this operation
  2592. *
  2593. * @throws \InvalidArgumentException
  2594. * @return \GuzzleHttp\Psr7\Request
  2595. */
  2596. public function patchApiV3GroupsGroupRequest($group, $patch_api_v3_groups_group_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroup'][0])
  2597. {
  2598. // verify the required parameter 'group' is set
  2599. if ($group === null || (is_array($group) && count($group) === 0)) {
  2600. throw new \InvalidArgumentException(
  2601. 'Missing the required parameter $group when calling patchApiV3GroupsGroup'
  2602. );
  2603. }
  2604. $resourcePath = '/v3/groups/{group}';
  2605. $formParams = [];
  2606. $queryParams = [];
  2607. $headerParams = [];
  2608. $httpBody = '';
  2609. $multipart = false;
  2610. // path params
  2611. if ($group !== null) {
  2612. $resourcePath = str_replace(
  2613. '{group}',
  2614. ObjectSerializer::toPathValue($group),
  2615. $resourcePath
  2616. );
  2617. }
  2618. $headers = $this->headerSelector->selectHeaders(
  2619. ['application/json', 'application/problem+json', ],
  2620. $contentType,
  2621. $multipart
  2622. );
  2623. // for model (json/xml)
  2624. if (isset($patch_api_v3_groups_group_request)) {
  2625. if (stripos($headers['Content-Type'], 'application/json') !== false) {
  2626. # if Content-Type contains "application/json", json_encode the body
  2627. try {
  2628. $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_groups_group_request), JSON_THROW_ON_ERROR);
  2629. } catch (\JsonException $e) {
  2630. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2631. }
  2632. } else {
  2633. $httpBody = $patch_api_v3_groups_group_request;
  2634. }
  2635. } elseif (count($formParams) > 0) {
  2636. if ($multipart) {
  2637. $multipartContents = [];
  2638. foreach ($formParams as $formParamName => $formParamValue) {
  2639. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  2640. foreach ($formParamValueItems as $formParamValueItem) {
  2641. $multipartContents[] = [
  2642. 'name' => $formParamName,
  2643. 'contents' => $formParamValueItem
  2644. ];
  2645. }
  2646. }
  2647. // for HTTP post (form)
  2648. $httpBody = new MultipartStream($multipartContents);
  2649. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  2650. # if Content-Type contains "application/json", json_encode the form parameters
  2651. try {
  2652. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  2653. } catch (\JsonException $e) {
  2654. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2655. }
  2656. } else {
  2657. // for HTTP post (form)
  2658. $httpBody = ObjectSerializer::buildQuery($formParams);
  2659. }
  2660. }
  2661. // this endpoint requires Bearer authentication (access token)
  2662. if (!empty($this->config->getAccessToken())) {
  2663. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  2664. }
  2665. $defaultHeaders = [];
  2666. if ($this->config->getUserAgent()) {
  2667. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2668. }
  2669. $headers = array_merge(
  2670. $defaultHeaders,
  2671. $headerParams,
  2672. $headers
  2673. );
  2674. $operationHost = $this->config->getHost();
  2675. $query = ObjectSerializer::buildQuery($queryParams);
  2676. return new Request(
  2677. 'PATCH',
  2678. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  2679. $headers,
  2680. $httpBody
  2681. );
  2682. }
  2683. /**
  2684. * Operation patchApiV3GroupsGroupMembersMember
  2685. *
  2686. * 改成员角色
  2687. *
  2688. * @param string $group 团队 uid (required)
  2689. * @param string $member 成员记录 id (required)
  2690. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request patch_api_v3_groups_group_members_member_request (optional)
  2691. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  2692. *
  2693. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2694. * @throws \InvalidArgumentException
  2695. * @return \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  2696. */
  2697. public function patchApiV3GroupsGroupMembersMember($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
  2698. {
  2699. list($response) = $this->patchApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
  2700. return $response;
  2701. }
  2702. /**
  2703. * Operation patchApiV3GroupsGroupMembersMemberWithHttpInfo
  2704. *
  2705. * 改成员角色
  2706. *
  2707. * @param string $group 团队 uid (required)
  2708. * @param string $member 成员记录 id (required)
  2709. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
  2710. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  2711. *
  2712. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  2713. * @throws \InvalidArgumentException
  2714. * @return array of \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  2715. */
  2716. public function patchApiV3GroupsGroupMembersMemberWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
  2717. {
  2718. $request = $this->patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
  2719. try {
  2720. $options = $this->createHttpClientOption();
  2721. try {
  2722. $response = $this->client->send($request, $options);
  2723. } catch (RequestException $e) {
  2724. throw new ApiException(
  2725. "[{$e->getCode()}] {$e->getMessage()}",
  2726. (int) $e->getCode(),
  2727. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  2728. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  2729. );
  2730. } catch (ConnectException $e) {
  2731. throw new ApiException(
  2732. "[{$e->getCode()}] {$e->getMessage()}",
  2733. (int) $e->getCode(),
  2734. null,
  2735. null
  2736. );
  2737. }
  2738. $statusCode = $response->getStatusCode();
  2739. switch($statusCode) {
  2740. case 200:
  2741. return $this->handleResponseWithDataType(
  2742. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  2743. $request,
  2744. $response,
  2745. );
  2746. case 401:
  2747. return $this->handleResponseWithDataType(
  2748. '\WikipaliApi\Model\ProblemDetails',
  2749. $request,
  2750. $response,
  2751. );
  2752. case 403:
  2753. return $this->handleResponseWithDataType(
  2754. '\WikipaliApi\Model\ProblemDetails',
  2755. $request,
  2756. $response,
  2757. );
  2758. case 422:
  2759. return $this->handleResponseWithDataType(
  2760. '\WikipaliApi\Model\ProblemDetails',
  2761. $request,
  2762. $response,
  2763. );
  2764. }
  2765. if ($statusCode < 200 || $statusCode > 299) {
  2766. throw new ApiException(
  2767. sprintf(
  2768. '[%d] Error connecting to the API (%s)',
  2769. $statusCode,
  2770. (string) $request->getUri()
  2771. ),
  2772. $statusCode,
  2773. $response->getHeaders(),
  2774. (string) $response->getBody()
  2775. );
  2776. }
  2777. return $this->handleResponseWithDataType(
  2778. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  2779. $request,
  2780. $response,
  2781. );
  2782. } catch (ApiException $e) {
  2783. switch ($e->getCode()) {
  2784. case 200:
  2785. $data = ObjectSerializer::deserialize(
  2786. $e->getResponseBody(),
  2787. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  2788. $e->getResponseHeaders()
  2789. );
  2790. $e->setResponseObject($data);
  2791. throw $e;
  2792. case 401:
  2793. $data = ObjectSerializer::deserialize(
  2794. $e->getResponseBody(),
  2795. '\WikipaliApi\Model\ProblemDetails',
  2796. $e->getResponseHeaders()
  2797. );
  2798. $e->setResponseObject($data);
  2799. throw $e;
  2800. case 403:
  2801. $data = ObjectSerializer::deserialize(
  2802. $e->getResponseBody(),
  2803. '\WikipaliApi\Model\ProblemDetails',
  2804. $e->getResponseHeaders()
  2805. );
  2806. $e->setResponseObject($data);
  2807. throw $e;
  2808. case 422:
  2809. $data = ObjectSerializer::deserialize(
  2810. $e->getResponseBody(),
  2811. '\WikipaliApi\Model\ProblemDetails',
  2812. $e->getResponseHeaders()
  2813. );
  2814. $e->setResponseObject($data);
  2815. throw $e;
  2816. }
  2817. throw $e;
  2818. }
  2819. }
  2820. /**
  2821. * Operation patchApiV3GroupsGroupMembersMemberAsync
  2822. *
  2823. * 改成员角色
  2824. *
  2825. * @param string $group 团队 uid (required)
  2826. * @param string $member 成员记录 id (required)
  2827. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
  2828. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  2829. *
  2830. * @throws \InvalidArgumentException
  2831. * @return \GuzzleHttp\Promise\PromiseInterface
  2832. */
  2833. public function patchApiV3GroupsGroupMembersMemberAsync($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
  2834. {
  2835. return $this->patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType)
  2836. ->then(
  2837. function ($response) {
  2838. return $response[0];
  2839. }
  2840. );
  2841. }
  2842. /**
  2843. * Operation patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo
  2844. *
  2845. * 改成员角色
  2846. *
  2847. * @param string $group 团队 uid (required)
  2848. * @param string $member 成员记录 id (required)
  2849. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
  2850. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  2851. *
  2852. * @throws \InvalidArgumentException
  2853. * @return \GuzzleHttp\Promise\PromiseInterface
  2854. */
  2855. public function patchApiV3GroupsGroupMembersMemberAsyncWithHttpInfo($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
  2856. {
  2857. $returnType = '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response';
  2858. $request = $this->patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request, $contentType);
  2859. return $this->client
  2860. ->sendAsync($request, $this->createHttpClientOption())
  2861. ->then(
  2862. function ($response) use ($returnType) {
  2863. if ($returnType === '\SplFileObject') {
  2864. $content = $response->getBody(); //stream goes to serializer
  2865. } else {
  2866. $content = (string) $response->getBody();
  2867. if ($returnType !== 'string') {
  2868. $content = json_decode($content);
  2869. }
  2870. }
  2871. return [
  2872. ObjectSerializer::deserialize($content, $returnType, []),
  2873. $response->getStatusCode(),
  2874. $response->getHeaders()
  2875. ];
  2876. },
  2877. function ($exception) {
  2878. $response = $exception->getResponse();
  2879. $statusCode = $response->getStatusCode();
  2880. throw new ApiException(
  2881. sprintf(
  2882. '[%d] Error connecting to the API (%s)',
  2883. $statusCode,
  2884. $exception->getRequest()->getUri()
  2885. ),
  2886. $statusCode,
  2887. $response->getHeaders(),
  2888. (string) $response->getBody()
  2889. );
  2890. }
  2891. );
  2892. }
  2893. /**
  2894. * Create request for operation 'patchApiV3GroupsGroupMembersMember'
  2895. *
  2896. * @param string $group 团队 uid (required)
  2897. * @param string $member 成员记录 id (required)
  2898. * @param \WikipaliApi\Model\PatchApiV3GroupsGroupMembersMemberRequest|null $patch_api_v3_groups_group_members_member_request (optional)
  2899. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3GroupsGroupMembersMember'] to see the possible values for this operation
  2900. *
  2901. * @throws \InvalidArgumentException
  2902. * @return \GuzzleHttp\Psr7\Request
  2903. */
  2904. public function patchApiV3GroupsGroupMembersMemberRequest($group, $member, $patch_api_v3_groups_group_members_member_request = null, string $contentType = self::contentTypes['patchApiV3GroupsGroupMembersMember'][0])
  2905. {
  2906. // verify the required parameter 'group' is set
  2907. if ($group === null || (is_array($group) && count($group) === 0)) {
  2908. throw new \InvalidArgumentException(
  2909. 'Missing the required parameter $group when calling patchApiV3GroupsGroupMembersMember'
  2910. );
  2911. }
  2912. // verify the required parameter 'member' is set
  2913. if ($member === null || (is_array($member) && count($member) === 0)) {
  2914. throw new \InvalidArgumentException(
  2915. 'Missing the required parameter $member when calling patchApiV3GroupsGroupMembersMember'
  2916. );
  2917. }
  2918. $resourcePath = '/v3/groups/{group}/members/{member}';
  2919. $formParams = [];
  2920. $queryParams = [];
  2921. $headerParams = [];
  2922. $httpBody = '';
  2923. $multipart = false;
  2924. // path params
  2925. if ($group !== null) {
  2926. $resourcePath = str_replace(
  2927. '{group}',
  2928. ObjectSerializer::toPathValue($group),
  2929. $resourcePath
  2930. );
  2931. }
  2932. // path params
  2933. if ($member !== null) {
  2934. $resourcePath = str_replace(
  2935. '{member}',
  2936. ObjectSerializer::toPathValue($member),
  2937. $resourcePath
  2938. );
  2939. }
  2940. $headers = $this->headerSelector->selectHeaders(
  2941. ['application/json', 'application/problem+json', ],
  2942. $contentType,
  2943. $multipart
  2944. );
  2945. // for model (json/xml)
  2946. if (isset($patch_api_v3_groups_group_members_member_request)) {
  2947. if (stripos($headers['Content-Type'], 'application/json') !== false) {
  2948. # if Content-Type contains "application/json", json_encode the body
  2949. try {
  2950. $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_groups_group_members_member_request), JSON_THROW_ON_ERROR);
  2951. } catch (\JsonException $e) {
  2952. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2953. }
  2954. } else {
  2955. $httpBody = $patch_api_v3_groups_group_members_member_request;
  2956. }
  2957. } elseif (count($formParams) > 0) {
  2958. if ($multipart) {
  2959. $multipartContents = [];
  2960. foreach ($formParams as $formParamName => $formParamValue) {
  2961. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  2962. foreach ($formParamValueItems as $formParamValueItem) {
  2963. $multipartContents[] = [
  2964. 'name' => $formParamName,
  2965. 'contents' => $formParamValueItem
  2966. ];
  2967. }
  2968. }
  2969. // for HTTP post (form)
  2970. $httpBody = new MultipartStream($multipartContents);
  2971. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  2972. # if Content-Type contains "application/json", json_encode the form parameters
  2973. try {
  2974. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  2975. } catch (\JsonException $e) {
  2976. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  2977. }
  2978. } else {
  2979. // for HTTP post (form)
  2980. $httpBody = ObjectSerializer::buildQuery($formParams);
  2981. }
  2982. }
  2983. // this endpoint requires Bearer authentication (access token)
  2984. if (!empty($this->config->getAccessToken())) {
  2985. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  2986. }
  2987. $defaultHeaders = [];
  2988. if ($this->config->getUserAgent()) {
  2989. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  2990. }
  2991. $headers = array_merge(
  2992. $defaultHeaders,
  2993. $headerParams,
  2994. $headers
  2995. );
  2996. $operationHost = $this->config->getHost();
  2997. $query = ObjectSerializer::buildQuery($queryParams);
  2998. return new Request(
  2999. 'PATCH',
  3000. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  3001. $headers,
  3002. $httpBody
  3003. );
  3004. }
  3005. /**
  3006. * Operation postApiV3Groups
  3007. *
  3008. * 建团队
  3009. *
  3010. * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request post_api_v3_groups_request (required)
  3011. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
  3012. *
  3013. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3014. * @throws \InvalidArgumentException
  3015. * @return \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  3016. */
  3017. public function postApiV3Groups($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
  3018. {
  3019. list($response) = $this->postApiV3GroupsWithHttpInfo($post_api_v3_groups_request, $contentType);
  3020. return $response;
  3021. }
  3022. /**
  3023. * Operation postApiV3GroupsWithHttpInfo
  3024. *
  3025. * 建团队
  3026. *
  3027. * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
  3028. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
  3029. *
  3030. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3031. * @throws \InvalidArgumentException
  3032. * @return array of \WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\PostApiV3Groups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  3033. */
  3034. public function postApiV3GroupsWithHttpInfo($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
  3035. {
  3036. $request = $this->postApiV3GroupsRequest($post_api_v3_groups_request, $contentType);
  3037. try {
  3038. $options = $this->createHttpClientOption();
  3039. try {
  3040. $response = $this->client->send($request, $options);
  3041. } catch (RequestException $e) {
  3042. throw new ApiException(
  3043. "[{$e->getCode()}] {$e->getMessage()}",
  3044. (int) $e->getCode(),
  3045. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3046. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  3047. );
  3048. } catch (ConnectException $e) {
  3049. throw new ApiException(
  3050. "[{$e->getCode()}] {$e->getMessage()}",
  3051. (int) $e->getCode(),
  3052. null,
  3053. null
  3054. );
  3055. }
  3056. $statusCode = $response->getStatusCode();
  3057. switch($statusCode) {
  3058. case 200:
  3059. return $this->handleResponseWithDataType(
  3060. '\WikipaliApi\Model\PostApiV3Groups200Response',
  3061. $request,
  3062. $response,
  3063. );
  3064. case 201:
  3065. return $this->handleResponseWithDataType(
  3066. '\WikipaliApi\Model\PostApiV3Groups200Response',
  3067. $request,
  3068. $response,
  3069. );
  3070. case 401:
  3071. return $this->handleResponseWithDataType(
  3072. '\WikipaliApi\Model\ProblemDetails',
  3073. $request,
  3074. $response,
  3075. );
  3076. case 422:
  3077. return $this->handleResponseWithDataType(
  3078. '\WikipaliApi\Model\ProblemDetails',
  3079. $request,
  3080. $response,
  3081. );
  3082. }
  3083. if ($statusCode < 200 || $statusCode > 299) {
  3084. throw new ApiException(
  3085. sprintf(
  3086. '[%d] Error connecting to the API (%s)',
  3087. $statusCode,
  3088. (string) $request->getUri()
  3089. ),
  3090. $statusCode,
  3091. $response->getHeaders(),
  3092. (string) $response->getBody()
  3093. );
  3094. }
  3095. return $this->handleResponseWithDataType(
  3096. '\WikipaliApi\Model\PostApiV3Groups200Response',
  3097. $request,
  3098. $response,
  3099. );
  3100. } catch (ApiException $e) {
  3101. switch ($e->getCode()) {
  3102. case 200:
  3103. $data = ObjectSerializer::deserialize(
  3104. $e->getResponseBody(),
  3105. '\WikipaliApi\Model\PostApiV3Groups200Response',
  3106. $e->getResponseHeaders()
  3107. );
  3108. $e->setResponseObject($data);
  3109. throw $e;
  3110. case 201:
  3111. $data = ObjectSerializer::deserialize(
  3112. $e->getResponseBody(),
  3113. '\WikipaliApi\Model\PostApiV3Groups200Response',
  3114. $e->getResponseHeaders()
  3115. );
  3116. $e->setResponseObject($data);
  3117. throw $e;
  3118. case 401:
  3119. $data = ObjectSerializer::deserialize(
  3120. $e->getResponseBody(),
  3121. '\WikipaliApi\Model\ProblemDetails',
  3122. $e->getResponseHeaders()
  3123. );
  3124. $e->setResponseObject($data);
  3125. throw $e;
  3126. case 422:
  3127. $data = ObjectSerializer::deserialize(
  3128. $e->getResponseBody(),
  3129. '\WikipaliApi\Model\ProblemDetails',
  3130. $e->getResponseHeaders()
  3131. );
  3132. $e->setResponseObject($data);
  3133. throw $e;
  3134. }
  3135. throw $e;
  3136. }
  3137. }
  3138. /**
  3139. * Operation postApiV3GroupsAsync
  3140. *
  3141. * 建团队
  3142. *
  3143. * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
  3144. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
  3145. *
  3146. * @throws \InvalidArgumentException
  3147. * @return \GuzzleHttp\Promise\PromiseInterface
  3148. */
  3149. public function postApiV3GroupsAsync($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
  3150. {
  3151. return $this->postApiV3GroupsAsyncWithHttpInfo($post_api_v3_groups_request, $contentType)
  3152. ->then(
  3153. function ($response) {
  3154. return $response[0];
  3155. }
  3156. );
  3157. }
  3158. /**
  3159. * Operation postApiV3GroupsAsyncWithHttpInfo
  3160. *
  3161. * 建团队
  3162. *
  3163. * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
  3164. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
  3165. *
  3166. * @throws \InvalidArgumentException
  3167. * @return \GuzzleHttp\Promise\PromiseInterface
  3168. */
  3169. public function postApiV3GroupsAsyncWithHttpInfo($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
  3170. {
  3171. $returnType = '\WikipaliApi\Model\PostApiV3Groups200Response';
  3172. $request = $this->postApiV3GroupsRequest($post_api_v3_groups_request, $contentType);
  3173. return $this->client
  3174. ->sendAsync($request, $this->createHttpClientOption())
  3175. ->then(
  3176. function ($response) use ($returnType) {
  3177. if ($returnType === '\SplFileObject') {
  3178. $content = $response->getBody(); //stream goes to serializer
  3179. } else {
  3180. $content = (string) $response->getBody();
  3181. if ($returnType !== 'string') {
  3182. $content = json_decode($content);
  3183. }
  3184. }
  3185. return [
  3186. ObjectSerializer::deserialize($content, $returnType, []),
  3187. $response->getStatusCode(),
  3188. $response->getHeaders()
  3189. ];
  3190. },
  3191. function ($exception) {
  3192. $response = $exception->getResponse();
  3193. $statusCode = $response->getStatusCode();
  3194. throw new ApiException(
  3195. sprintf(
  3196. '[%d] Error connecting to the API (%s)',
  3197. $statusCode,
  3198. $exception->getRequest()->getUri()
  3199. ),
  3200. $statusCode,
  3201. $response->getHeaders(),
  3202. (string) $response->getBody()
  3203. );
  3204. }
  3205. );
  3206. }
  3207. /**
  3208. * Create request for operation 'postApiV3Groups'
  3209. *
  3210. * @param \WikipaliApi\Model\PostApiV3GroupsRequest $post_api_v3_groups_request (required)
  3211. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3Groups'] to see the possible values for this operation
  3212. *
  3213. * @throws \InvalidArgumentException
  3214. * @return \GuzzleHttp\Psr7\Request
  3215. */
  3216. public function postApiV3GroupsRequest($post_api_v3_groups_request, string $contentType = self::contentTypes['postApiV3Groups'][0])
  3217. {
  3218. // verify the required parameter 'post_api_v3_groups_request' is set
  3219. if ($post_api_v3_groups_request === null || (is_array($post_api_v3_groups_request) && count($post_api_v3_groups_request) === 0)) {
  3220. throw new \InvalidArgumentException(
  3221. 'Missing the required parameter $post_api_v3_groups_request when calling postApiV3Groups'
  3222. );
  3223. }
  3224. $resourcePath = '/v3/groups';
  3225. $formParams = [];
  3226. $queryParams = [];
  3227. $headerParams = [];
  3228. $httpBody = '';
  3229. $multipart = false;
  3230. $headers = $this->headerSelector->selectHeaders(
  3231. ['application/json', 'application/problem+json', ],
  3232. $contentType,
  3233. $multipart
  3234. );
  3235. // for model (json/xml)
  3236. if (isset($post_api_v3_groups_request)) {
  3237. if (stripos($headers['Content-Type'], 'application/json') !== false) {
  3238. # if Content-Type contains "application/json", json_encode the body
  3239. try {
  3240. $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_groups_request), JSON_THROW_ON_ERROR);
  3241. } catch (\JsonException $e) {
  3242. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  3243. }
  3244. } else {
  3245. $httpBody = $post_api_v3_groups_request;
  3246. }
  3247. } elseif (count($formParams) > 0) {
  3248. if ($multipart) {
  3249. $multipartContents = [];
  3250. foreach ($formParams as $formParamName => $formParamValue) {
  3251. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  3252. foreach ($formParamValueItems as $formParamValueItem) {
  3253. $multipartContents[] = [
  3254. 'name' => $formParamName,
  3255. 'contents' => $formParamValueItem
  3256. ];
  3257. }
  3258. }
  3259. // for HTTP post (form)
  3260. $httpBody = new MultipartStream($multipartContents);
  3261. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  3262. # if Content-Type contains "application/json", json_encode the form parameters
  3263. try {
  3264. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  3265. } catch (\JsonException $e) {
  3266. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  3267. }
  3268. } else {
  3269. // for HTTP post (form)
  3270. $httpBody = ObjectSerializer::buildQuery($formParams);
  3271. }
  3272. }
  3273. // this endpoint requires Bearer authentication (access token)
  3274. if (!empty($this->config->getAccessToken())) {
  3275. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  3276. }
  3277. $defaultHeaders = [];
  3278. if ($this->config->getUserAgent()) {
  3279. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3280. }
  3281. $headers = array_merge(
  3282. $defaultHeaders,
  3283. $headerParams,
  3284. $headers
  3285. );
  3286. $operationHost = $this->config->getHost();
  3287. $query = ObjectSerializer::buildQuery($queryParams);
  3288. return new Request(
  3289. 'POST',
  3290. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  3291. $headers,
  3292. $httpBody
  3293. );
  3294. }
  3295. /**
  3296. * Operation postApiV3GroupsGroupInviteLinks
  3297. *
  3298. * 签一张团队邀请链接
  3299. *
  3300. * @param string $group 团队 uid (required)
  3301. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupInviteLinks'] to see the possible values for this operation
  3302. *
  3303. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3304. * @throws \InvalidArgumentException
  3305. * @return \WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response|\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  3306. */
  3307. public function postApiV3GroupsGroupInviteLinks($group, string $contentType = self::contentTypes['postApiV3GroupsGroupInviteLinks'][0])
  3308. {
  3309. list($response) = $this->postApiV3GroupsGroupInviteLinksWithHttpInfo($group, $contentType);
  3310. return $response;
  3311. }
  3312. /**
  3313. * Operation postApiV3GroupsGroupInviteLinksWithHttpInfo
  3314. *
  3315. * 签一张团队邀请链接
  3316. *
  3317. * @param string $group 团队 uid (required)
  3318. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupInviteLinks'] to see the possible values for this operation
  3319. *
  3320. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3321. * @throws \InvalidArgumentException
  3322. * @return array of \WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response|\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  3323. */
  3324. public function postApiV3GroupsGroupInviteLinksWithHttpInfo($group, string $contentType = self::contentTypes['postApiV3GroupsGroupInviteLinks'][0])
  3325. {
  3326. $request = $this->postApiV3GroupsGroupInviteLinksRequest($group, $contentType);
  3327. try {
  3328. $options = $this->createHttpClientOption();
  3329. try {
  3330. $response = $this->client->send($request, $options);
  3331. } catch (RequestException $e) {
  3332. throw new ApiException(
  3333. "[{$e->getCode()}] {$e->getMessage()}",
  3334. (int) $e->getCode(),
  3335. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3336. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  3337. );
  3338. } catch (ConnectException $e) {
  3339. throw new ApiException(
  3340. "[{$e->getCode()}] {$e->getMessage()}",
  3341. (int) $e->getCode(),
  3342. null,
  3343. null
  3344. );
  3345. }
  3346. $statusCode = $response->getStatusCode();
  3347. switch($statusCode) {
  3348. case 200:
  3349. return $this->handleResponseWithDataType(
  3350. '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response',
  3351. $request,
  3352. $response,
  3353. );
  3354. case 201:
  3355. return $this->handleResponseWithDataType(
  3356. '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response',
  3357. $request,
  3358. $response,
  3359. );
  3360. case 401:
  3361. return $this->handleResponseWithDataType(
  3362. '\WikipaliApi\Model\ProblemDetails',
  3363. $request,
  3364. $response,
  3365. );
  3366. case 403:
  3367. return $this->handleResponseWithDataType(
  3368. '\WikipaliApi\Model\ProblemDetails',
  3369. $request,
  3370. $response,
  3371. );
  3372. case 422:
  3373. return $this->handleResponseWithDataType(
  3374. '\WikipaliApi\Model\ProblemDetails',
  3375. $request,
  3376. $response,
  3377. );
  3378. }
  3379. if ($statusCode < 200 || $statusCode > 299) {
  3380. throw new ApiException(
  3381. sprintf(
  3382. '[%d] Error connecting to the API (%s)',
  3383. $statusCode,
  3384. (string) $request->getUri()
  3385. ),
  3386. $statusCode,
  3387. $response->getHeaders(),
  3388. (string) $response->getBody()
  3389. );
  3390. }
  3391. return $this->handleResponseWithDataType(
  3392. '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response',
  3393. $request,
  3394. $response,
  3395. );
  3396. } catch (ApiException $e) {
  3397. switch ($e->getCode()) {
  3398. case 200:
  3399. $data = ObjectSerializer::deserialize(
  3400. $e->getResponseBody(),
  3401. '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response',
  3402. $e->getResponseHeaders()
  3403. );
  3404. $e->setResponseObject($data);
  3405. throw $e;
  3406. case 201:
  3407. $data = ObjectSerializer::deserialize(
  3408. $e->getResponseBody(),
  3409. '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response',
  3410. $e->getResponseHeaders()
  3411. );
  3412. $e->setResponseObject($data);
  3413. throw $e;
  3414. case 401:
  3415. $data = ObjectSerializer::deserialize(
  3416. $e->getResponseBody(),
  3417. '\WikipaliApi\Model\ProblemDetails',
  3418. $e->getResponseHeaders()
  3419. );
  3420. $e->setResponseObject($data);
  3421. throw $e;
  3422. case 403:
  3423. $data = ObjectSerializer::deserialize(
  3424. $e->getResponseBody(),
  3425. '\WikipaliApi\Model\ProblemDetails',
  3426. $e->getResponseHeaders()
  3427. );
  3428. $e->setResponseObject($data);
  3429. throw $e;
  3430. case 422:
  3431. $data = ObjectSerializer::deserialize(
  3432. $e->getResponseBody(),
  3433. '\WikipaliApi\Model\ProblemDetails',
  3434. $e->getResponseHeaders()
  3435. );
  3436. $e->setResponseObject($data);
  3437. throw $e;
  3438. }
  3439. throw $e;
  3440. }
  3441. }
  3442. /**
  3443. * Operation postApiV3GroupsGroupInviteLinksAsync
  3444. *
  3445. * 签一张团队邀请链接
  3446. *
  3447. * @param string $group 团队 uid (required)
  3448. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupInviteLinks'] to see the possible values for this operation
  3449. *
  3450. * @throws \InvalidArgumentException
  3451. * @return \GuzzleHttp\Promise\PromiseInterface
  3452. */
  3453. public function postApiV3GroupsGroupInviteLinksAsync($group, string $contentType = self::contentTypes['postApiV3GroupsGroupInviteLinks'][0])
  3454. {
  3455. return $this->postApiV3GroupsGroupInviteLinksAsyncWithHttpInfo($group, $contentType)
  3456. ->then(
  3457. function ($response) {
  3458. return $response[0];
  3459. }
  3460. );
  3461. }
  3462. /**
  3463. * Operation postApiV3GroupsGroupInviteLinksAsyncWithHttpInfo
  3464. *
  3465. * 签一张团队邀请链接
  3466. *
  3467. * @param string $group 团队 uid (required)
  3468. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupInviteLinks'] to see the possible values for this operation
  3469. *
  3470. * @throws \InvalidArgumentException
  3471. * @return \GuzzleHttp\Promise\PromiseInterface
  3472. */
  3473. public function postApiV3GroupsGroupInviteLinksAsyncWithHttpInfo($group, string $contentType = self::contentTypes['postApiV3GroupsGroupInviteLinks'][0])
  3474. {
  3475. $returnType = '\WikipaliApi\Model\PostApiV3GroupsGroupInviteLinks200Response';
  3476. $request = $this->postApiV3GroupsGroupInviteLinksRequest($group, $contentType);
  3477. return $this->client
  3478. ->sendAsync($request, $this->createHttpClientOption())
  3479. ->then(
  3480. function ($response) use ($returnType) {
  3481. if ($returnType === '\SplFileObject') {
  3482. $content = $response->getBody(); //stream goes to serializer
  3483. } else {
  3484. $content = (string) $response->getBody();
  3485. if ($returnType !== 'string') {
  3486. $content = json_decode($content);
  3487. }
  3488. }
  3489. return [
  3490. ObjectSerializer::deserialize($content, $returnType, []),
  3491. $response->getStatusCode(),
  3492. $response->getHeaders()
  3493. ];
  3494. },
  3495. function ($exception) {
  3496. $response = $exception->getResponse();
  3497. $statusCode = $response->getStatusCode();
  3498. throw new ApiException(
  3499. sprintf(
  3500. '[%d] Error connecting to the API (%s)',
  3501. $statusCode,
  3502. $exception->getRequest()->getUri()
  3503. ),
  3504. $statusCode,
  3505. $response->getHeaders(),
  3506. (string) $response->getBody()
  3507. );
  3508. }
  3509. );
  3510. }
  3511. /**
  3512. * Create request for operation 'postApiV3GroupsGroupInviteLinks'
  3513. *
  3514. * @param string $group 团队 uid (required)
  3515. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupInviteLinks'] to see the possible values for this operation
  3516. *
  3517. * @throws \InvalidArgumentException
  3518. * @return \GuzzleHttp\Psr7\Request
  3519. */
  3520. public function postApiV3GroupsGroupInviteLinksRequest($group, string $contentType = self::contentTypes['postApiV3GroupsGroupInviteLinks'][0])
  3521. {
  3522. // verify the required parameter 'group' is set
  3523. if ($group === null || (is_array($group) && count($group) === 0)) {
  3524. throw new \InvalidArgumentException(
  3525. 'Missing the required parameter $group when calling postApiV3GroupsGroupInviteLinks'
  3526. );
  3527. }
  3528. $resourcePath = '/v3/groups/{group}/invite-links';
  3529. $formParams = [];
  3530. $queryParams = [];
  3531. $headerParams = [];
  3532. $httpBody = '';
  3533. $multipart = false;
  3534. // path params
  3535. if ($group !== null) {
  3536. $resourcePath = str_replace(
  3537. '{group}',
  3538. ObjectSerializer::toPathValue($group),
  3539. $resourcePath
  3540. );
  3541. }
  3542. $headers = $this->headerSelector->selectHeaders(
  3543. ['application/json', 'application/problem+json', ],
  3544. $contentType,
  3545. $multipart
  3546. );
  3547. // for model (json/xml)
  3548. if (count($formParams) > 0) {
  3549. if ($multipart) {
  3550. $multipartContents = [];
  3551. foreach ($formParams as $formParamName => $formParamValue) {
  3552. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  3553. foreach ($formParamValueItems as $formParamValueItem) {
  3554. $multipartContents[] = [
  3555. 'name' => $formParamName,
  3556. 'contents' => $formParamValueItem
  3557. ];
  3558. }
  3559. }
  3560. // for HTTP post (form)
  3561. $httpBody = new MultipartStream($multipartContents);
  3562. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  3563. # if Content-Type contains "application/json", json_encode the form parameters
  3564. try {
  3565. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  3566. } catch (\JsonException $e) {
  3567. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  3568. }
  3569. } else {
  3570. // for HTTP post (form)
  3571. $httpBody = ObjectSerializer::buildQuery($formParams);
  3572. }
  3573. }
  3574. // this endpoint requires Bearer authentication (access token)
  3575. if (!empty($this->config->getAccessToken())) {
  3576. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  3577. }
  3578. $defaultHeaders = [];
  3579. if ($this->config->getUserAgent()) {
  3580. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3581. }
  3582. $headers = array_merge(
  3583. $defaultHeaders,
  3584. $headerParams,
  3585. $headers
  3586. );
  3587. $operationHost = $this->config->getHost();
  3588. $query = ObjectSerializer::buildQuery($queryParams);
  3589. return new Request(
  3590. 'POST',
  3591. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  3592. $headers,
  3593. $httpBody
  3594. );
  3595. }
  3596. /**
  3597. * Operation postApiV3GroupsGroupMembers
  3598. *
  3599. * 加一名成员
  3600. *
  3601. * @param string $group 团队 uid (required)
  3602. * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request post_api_v3_groups_group_members_request (required)
  3603. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
  3604. *
  3605. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3606. * @throws \InvalidArgumentException
  3607. * @return \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  3608. */
  3609. public function postApiV3GroupsGroupMembers($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
  3610. {
  3611. list($response) = $this->postApiV3GroupsGroupMembersWithHttpInfo($group, $post_api_v3_groups_group_members_request, $contentType);
  3612. return $response;
  3613. }
  3614. /**
  3615. * Operation postApiV3GroupsGroupMembersWithHttpInfo
  3616. *
  3617. * 加一名成员
  3618. *
  3619. * @param string $group 团队 uid (required)
  3620. * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
  3621. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
  3622. *
  3623. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3624. * @throws \InvalidArgumentException
  3625. * @return array of \WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  3626. */
  3627. public function postApiV3GroupsGroupMembersWithHttpInfo($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
  3628. {
  3629. $request = $this->postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, $contentType);
  3630. try {
  3631. $options = $this->createHttpClientOption();
  3632. try {
  3633. $response = $this->client->send($request, $options);
  3634. } catch (RequestException $e) {
  3635. throw new ApiException(
  3636. "[{$e->getCode()}] {$e->getMessage()}",
  3637. (int) $e->getCode(),
  3638. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3639. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  3640. );
  3641. } catch (ConnectException $e) {
  3642. throw new ApiException(
  3643. "[{$e->getCode()}] {$e->getMessage()}",
  3644. (int) $e->getCode(),
  3645. null,
  3646. null
  3647. );
  3648. }
  3649. $statusCode = $response->getStatusCode();
  3650. switch($statusCode) {
  3651. case 200:
  3652. return $this->handleResponseWithDataType(
  3653. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  3654. $request,
  3655. $response,
  3656. );
  3657. case 201:
  3658. return $this->handleResponseWithDataType(
  3659. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  3660. $request,
  3661. $response,
  3662. );
  3663. case 401:
  3664. return $this->handleResponseWithDataType(
  3665. '\WikipaliApi\Model\ProblemDetails',
  3666. $request,
  3667. $response,
  3668. );
  3669. case 403:
  3670. return $this->handleResponseWithDataType(
  3671. '\WikipaliApi\Model\ProblemDetails',
  3672. $request,
  3673. $response,
  3674. );
  3675. case 422:
  3676. return $this->handleResponseWithDataType(
  3677. '\WikipaliApi\Model\ProblemDetails',
  3678. $request,
  3679. $response,
  3680. );
  3681. }
  3682. if ($statusCode < 200 || $statusCode > 299) {
  3683. throw new ApiException(
  3684. sprintf(
  3685. '[%d] Error connecting to the API (%s)',
  3686. $statusCode,
  3687. (string) $request->getUri()
  3688. ),
  3689. $statusCode,
  3690. $response->getHeaders(),
  3691. (string) $response->getBody()
  3692. );
  3693. }
  3694. return $this->handleResponseWithDataType(
  3695. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  3696. $request,
  3697. $response,
  3698. );
  3699. } catch (ApiException $e) {
  3700. switch ($e->getCode()) {
  3701. case 200:
  3702. $data = ObjectSerializer::deserialize(
  3703. $e->getResponseBody(),
  3704. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  3705. $e->getResponseHeaders()
  3706. );
  3707. $e->setResponseObject($data);
  3708. throw $e;
  3709. case 201:
  3710. $data = ObjectSerializer::deserialize(
  3711. $e->getResponseBody(),
  3712. '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response',
  3713. $e->getResponseHeaders()
  3714. );
  3715. $e->setResponseObject($data);
  3716. throw $e;
  3717. case 401:
  3718. $data = ObjectSerializer::deserialize(
  3719. $e->getResponseBody(),
  3720. '\WikipaliApi\Model\ProblemDetails',
  3721. $e->getResponseHeaders()
  3722. );
  3723. $e->setResponseObject($data);
  3724. throw $e;
  3725. case 403:
  3726. $data = ObjectSerializer::deserialize(
  3727. $e->getResponseBody(),
  3728. '\WikipaliApi\Model\ProblemDetails',
  3729. $e->getResponseHeaders()
  3730. );
  3731. $e->setResponseObject($data);
  3732. throw $e;
  3733. case 422:
  3734. $data = ObjectSerializer::deserialize(
  3735. $e->getResponseBody(),
  3736. '\WikipaliApi\Model\ProblemDetails',
  3737. $e->getResponseHeaders()
  3738. );
  3739. $e->setResponseObject($data);
  3740. throw $e;
  3741. }
  3742. throw $e;
  3743. }
  3744. }
  3745. /**
  3746. * Operation postApiV3GroupsGroupMembersAsync
  3747. *
  3748. * 加一名成员
  3749. *
  3750. * @param string $group 团队 uid (required)
  3751. * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
  3752. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
  3753. *
  3754. * @throws \InvalidArgumentException
  3755. * @return \GuzzleHttp\Promise\PromiseInterface
  3756. */
  3757. public function postApiV3GroupsGroupMembersAsync($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
  3758. {
  3759. return $this->postApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $post_api_v3_groups_group_members_request, $contentType)
  3760. ->then(
  3761. function ($response) {
  3762. return $response[0];
  3763. }
  3764. );
  3765. }
  3766. /**
  3767. * Operation postApiV3GroupsGroupMembersAsyncWithHttpInfo
  3768. *
  3769. * 加一名成员
  3770. *
  3771. * @param string $group 团队 uid (required)
  3772. * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
  3773. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
  3774. *
  3775. * @throws \InvalidArgumentException
  3776. * @return \GuzzleHttp\Promise\PromiseInterface
  3777. */
  3778. public function postApiV3GroupsGroupMembersAsyncWithHttpInfo($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
  3779. {
  3780. $returnType = '\WikipaliApi\Model\PostApiV3GroupsGroupMembers200Response';
  3781. $request = $this->postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, $contentType);
  3782. return $this->client
  3783. ->sendAsync($request, $this->createHttpClientOption())
  3784. ->then(
  3785. function ($response) use ($returnType) {
  3786. if ($returnType === '\SplFileObject') {
  3787. $content = $response->getBody(); //stream goes to serializer
  3788. } else {
  3789. $content = (string) $response->getBody();
  3790. if ($returnType !== 'string') {
  3791. $content = json_decode($content);
  3792. }
  3793. }
  3794. return [
  3795. ObjectSerializer::deserialize($content, $returnType, []),
  3796. $response->getStatusCode(),
  3797. $response->getHeaders()
  3798. ];
  3799. },
  3800. function ($exception) {
  3801. $response = $exception->getResponse();
  3802. $statusCode = $response->getStatusCode();
  3803. throw new ApiException(
  3804. sprintf(
  3805. '[%d] Error connecting to the API (%s)',
  3806. $statusCode,
  3807. $exception->getRequest()->getUri()
  3808. ),
  3809. $statusCode,
  3810. $response->getHeaders(),
  3811. (string) $response->getBody()
  3812. );
  3813. }
  3814. );
  3815. }
  3816. /**
  3817. * Create request for operation 'postApiV3GroupsGroupMembers'
  3818. *
  3819. * @param string $group 团队 uid (required)
  3820. * @param \WikipaliApi\Model\PostApiV3GroupsGroupMembersRequest $post_api_v3_groups_group_members_request (required)
  3821. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3GroupsGroupMembers'] to see the possible values for this operation
  3822. *
  3823. * @throws \InvalidArgumentException
  3824. * @return \GuzzleHttp\Psr7\Request
  3825. */
  3826. public function postApiV3GroupsGroupMembersRequest($group, $post_api_v3_groups_group_members_request, string $contentType = self::contentTypes['postApiV3GroupsGroupMembers'][0])
  3827. {
  3828. // verify the required parameter 'group' is set
  3829. if ($group === null || (is_array($group) && count($group) === 0)) {
  3830. throw new \InvalidArgumentException(
  3831. 'Missing the required parameter $group when calling postApiV3GroupsGroupMembers'
  3832. );
  3833. }
  3834. // verify the required parameter 'post_api_v3_groups_group_members_request' is set
  3835. if ($post_api_v3_groups_group_members_request === null || (is_array($post_api_v3_groups_group_members_request) && count($post_api_v3_groups_group_members_request) === 0)) {
  3836. throw new \InvalidArgumentException(
  3837. 'Missing the required parameter $post_api_v3_groups_group_members_request when calling postApiV3GroupsGroupMembers'
  3838. );
  3839. }
  3840. $resourcePath = '/v3/groups/{group}/members';
  3841. $formParams = [];
  3842. $queryParams = [];
  3843. $headerParams = [];
  3844. $httpBody = '';
  3845. $multipart = false;
  3846. // path params
  3847. if ($group !== null) {
  3848. $resourcePath = str_replace(
  3849. '{group}',
  3850. ObjectSerializer::toPathValue($group),
  3851. $resourcePath
  3852. );
  3853. }
  3854. $headers = $this->headerSelector->selectHeaders(
  3855. ['application/json', 'application/problem+json', ],
  3856. $contentType,
  3857. $multipart
  3858. );
  3859. // for model (json/xml)
  3860. if (isset($post_api_v3_groups_group_members_request)) {
  3861. if (stripos($headers['Content-Type'], 'application/json') !== false) {
  3862. # if Content-Type contains "application/json", json_encode the body
  3863. try {
  3864. $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_groups_group_members_request), JSON_THROW_ON_ERROR);
  3865. } catch (\JsonException $e) {
  3866. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  3867. }
  3868. } else {
  3869. $httpBody = $post_api_v3_groups_group_members_request;
  3870. }
  3871. } elseif (count($formParams) > 0) {
  3872. if ($multipart) {
  3873. $multipartContents = [];
  3874. foreach ($formParams as $formParamName => $formParamValue) {
  3875. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  3876. foreach ($formParamValueItems as $formParamValueItem) {
  3877. $multipartContents[] = [
  3878. 'name' => $formParamName,
  3879. 'contents' => $formParamValueItem
  3880. ];
  3881. }
  3882. }
  3883. // for HTTP post (form)
  3884. $httpBody = new MultipartStream($multipartContents);
  3885. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  3886. # if Content-Type contains "application/json", json_encode the form parameters
  3887. try {
  3888. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  3889. } catch (\JsonException $e) {
  3890. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  3891. }
  3892. } else {
  3893. // for HTTP post (form)
  3894. $httpBody = ObjectSerializer::buildQuery($formParams);
  3895. }
  3896. }
  3897. // this endpoint requires Bearer authentication (access token)
  3898. if (!empty($this->config->getAccessToken())) {
  3899. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  3900. }
  3901. $defaultHeaders = [];
  3902. if ($this->config->getUserAgent()) {
  3903. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  3904. }
  3905. $headers = array_merge(
  3906. $defaultHeaders,
  3907. $headerParams,
  3908. $headers
  3909. );
  3910. $operationHost = $this->config->getHost();
  3911. $query = ObjectSerializer::buildQuery($queryParams);
  3912. return new Request(
  3913. 'POST',
  3914. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  3915. $headers,
  3916. $httpBody
  3917. );
  3918. }
  3919. /**
  3920. * Operation postApiV3MeGroups
  3921. *
  3922. * 凭邀请链接加入团队
  3923. *
  3924. * @param \WikipaliApi\Model\PostApiV3MeGroupsRequest $post_api_v3_me_groups_request post_api_v3_me_groups_request (required)
  3925. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3MeGroups'] to see the possible values for this operation
  3926. *
  3927. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3928. * @throws \InvalidArgumentException
  3929. * @return \WikipaliApi\Model\PostApiV3MeGroups200Response|\WikipaliApi\Model\PostApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
  3930. */
  3931. public function postApiV3MeGroups($post_api_v3_me_groups_request, string $contentType = self::contentTypes['postApiV3MeGroups'][0])
  3932. {
  3933. list($response) = $this->postApiV3MeGroupsWithHttpInfo($post_api_v3_me_groups_request, $contentType);
  3934. return $response;
  3935. }
  3936. /**
  3937. * Operation postApiV3MeGroupsWithHttpInfo
  3938. *
  3939. * 凭邀请链接加入团队
  3940. *
  3941. * @param \WikipaliApi\Model\PostApiV3MeGroupsRequest $post_api_v3_me_groups_request (required)
  3942. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3MeGroups'] to see the possible values for this operation
  3943. *
  3944. * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
  3945. * @throws \InvalidArgumentException
  3946. * @return array of \WikipaliApi\Model\PostApiV3MeGroups200Response|\WikipaliApi\Model\PostApiV3MeGroups200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
  3947. */
  3948. public function postApiV3MeGroupsWithHttpInfo($post_api_v3_me_groups_request, string $contentType = self::contentTypes['postApiV3MeGroups'][0])
  3949. {
  3950. $request = $this->postApiV3MeGroupsRequest($post_api_v3_me_groups_request, $contentType);
  3951. try {
  3952. $options = $this->createHttpClientOption();
  3953. try {
  3954. $response = $this->client->send($request, $options);
  3955. } catch (RequestException $e) {
  3956. throw new ApiException(
  3957. "[{$e->getCode()}] {$e->getMessage()}",
  3958. (int) $e->getCode(),
  3959. $e->getResponse() ? $e->getResponse()->getHeaders() : null,
  3960. $e->getResponse() ? (string) $e->getResponse()->getBody() : null
  3961. );
  3962. } catch (ConnectException $e) {
  3963. throw new ApiException(
  3964. "[{$e->getCode()}] {$e->getMessage()}",
  3965. (int) $e->getCode(),
  3966. null,
  3967. null
  3968. );
  3969. }
  3970. $statusCode = $response->getStatusCode();
  3971. switch($statusCode) {
  3972. case 200:
  3973. return $this->handleResponseWithDataType(
  3974. '\WikipaliApi\Model\PostApiV3MeGroups200Response',
  3975. $request,
  3976. $response,
  3977. );
  3978. case 201:
  3979. return $this->handleResponseWithDataType(
  3980. '\WikipaliApi\Model\PostApiV3MeGroups200Response',
  3981. $request,
  3982. $response,
  3983. );
  3984. case 401:
  3985. return $this->handleResponseWithDataType(
  3986. '\WikipaliApi\Model\ProblemDetails',
  3987. $request,
  3988. $response,
  3989. );
  3990. case 403:
  3991. return $this->handleResponseWithDataType(
  3992. '\WikipaliApi\Model\ProblemDetails',
  3993. $request,
  3994. $response,
  3995. );
  3996. case 422:
  3997. return $this->handleResponseWithDataType(
  3998. '\WikipaliApi\Model\ProblemDetails',
  3999. $request,
  4000. $response,
  4001. );
  4002. }
  4003. if ($statusCode < 200 || $statusCode > 299) {
  4004. throw new ApiException(
  4005. sprintf(
  4006. '[%d] Error connecting to the API (%s)',
  4007. $statusCode,
  4008. (string) $request->getUri()
  4009. ),
  4010. $statusCode,
  4011. $response->getHeaders(),
  4012. (string) $response->getBody()
  4013. );
  4014. }
  4015. return $this->handleResponseWithDataType(
  4016. '\WikipaliApi\Model\PostApiV3MeGroups200Response',
  4017. $request,
  4018. $response,
  4019. );
  4020. } catch (ApiException $e) {
  4021. switch ($e->getCode()) {
  4022. case 200:
  4023. $data = ObjectSerializer::deserialize(
  4024. $e->getResponseBody(),
  4025. '\WikipaliApi\Model\PostApiV3MeGroups200Response',
  4026. $e->getResponseHeaders()
  4027. );
  4028. $e->setResponseObject($data);
  4029. throw $e;
  4030. case 201:
  4031. $data = ObjectSerializer::deserialize(
  4032. $e->getResponseBody(),
  4033. '\WikipaliApi\Model\PostApiV3MeGroups200Response',
  4034. $e->getResponseHeaders()
  4035. );
  4036. $e->setResponseObject($data);
  4037. throw $e;
  4038. case 401:
  4039. $data = ObjectSerializer::deserialize(
  4040. $e->getResponseBody(),
  4041. '\WikipaliApi\Model\ProblemDetails',
  4042. $e->getResponseHeaders()
  4043. );
  4044. $e->setResponseObject($data);
  4045. throw $e;
  4046. case 403:
  4047. $data = ObjectSerializer::deserialize(
  4048. $e->getResponseBody(),
  4049. '\WikipaliApi\Model\ProblemDetails',
  4050. $e->getResponseHeaders()
  4051. );
  4052. $e->setResponseObject($data);
  4053. throw $e;
  4054. case 422:
  4055. $data = ObjectSerializer::deserialize(
  4056. $e->getResponseBody(),
  4057. '\WikipaliApi\Model\ProblemDetails',
  4058. $e->getResponseHeaders()
  4059. );
  4060. $e->setResponseObject($data);
  4061. throw $e;
  4062. }
  4063. throw $e;
  4064. }
  4065. }
  4066. /**
  4067. * Operation postApiV3MeGroupsAsync
  4068. *
  4069. * 凭邀请链接加入团队
  4070. *
  4071. * @param \WikipaliApi\Model\PostApiV3MeGroupsRequest $post_api_v3_me_groups_request (required)
  4072. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3MeGroups'] to see the possible values for this operation
  4073. *
  4074. * @throws \InvalidArgumentException
  4075. * @return \GuzzleHttp\Promise\PromiseInterface
  4076. */
  4077. public function postApiV3MeGroupsAsync($post_api_v3_me_groups_request, string $contentType = self::contentTypes['postApiV3MeGroups'][0])
  4078. {
  4079. return $this->postApiV3MeGroupsAsyncWithHttpInfo($post_api_v3_me_groups_request, $contentType)
  4080. ->then(
  4081. function ($response) {
  4082. return $response[0];
  4083. }
  4084. );
  4085. }
  4086. /**
  4087. * Operation postApiV3MeGroupsAsyncWithHttpInfo
  4088. *
  4089. * 凭邀请链接加入团队
  4090. *
  4091. * @param \WikipaliApi\Model\PostApiV3MeGroupsRequest $post_api_v3_me_groups_request (required)
  4092. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3MeGroups'] to see the possible values for this operation
  4093. *
  4094. * @throws \InvalidArgumentException
  4095. * @return \GuzzleHttp\Promise\PromiseInterface
  4096. */
  4097. public function postApiV3MeGroupsAsyncWithHttpInfo($post_api_v3_me_groups_request, string $contentType = self::contentTypes['postApiV3MeGroups'][0])
  4098. {
  4099. $returnType = '\WikipaliApi\Model\PostApiV3MeGroups200Response';
  4100. $request = $this->postApiV3MeGroupsRequest($post_api_v3_me_groups_request, $contentType);
  4101. return $this->client
  4102. ->sendAsync($request, $this->createHttpClientOption())
  4103. ->then(
  4104. function ($response) use ($returnType) {
  4105. if ($returnType === '\SplFileObject') {
  4106. $content = $response->getBody(); //stream goes to serializer
  4107. } else {
  4108. $content = (string) $response->getBody();
  4109. if ($returnType !== 'string') {
  4110. $content = json_decode($content);
  4111. }
  4112. }
  4113. return [
  4114. ObjectSerializer::deserialize($content, $returnType, []),
  4115. $response->getStatusCode(),
  4116. $response->getHeaders()
  4117. ];
  4118. },
  4119. function ($exception) {
  4120. $response = $exception->getResponse();
  4121. $statusCode = $response->getStatusCode();
  4122. throw new ApiException(
  4123. sprintf(
  4124. '[%d] Error connecting to the API (%s)',
  4125. $statusCode,
  4126. $exception->getRequest()->getUri()
  4127. ),
  4128. $statusCode,
  4129. $response->getHeaders(),
  4130. (string) $response->getBody()
  4131. );
  4132. }
  4133. );
  4134. }
  4135. /**
  4136. * Create request for operation 'postApiV3MeGroups'
  4137. *
  4138. * @param \WikipaliApi\Model\PostApiV3MeGroupsRequest $post_api_v3_me_groups_request (required)
  4139. * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3MeGroups'] to see the possible values for this operation
  4140. *
  4141. * @throws \InvalidArgumentException
  4142. * @return \GuzzleHttp\Psr7\Request
  4143. */
  4144. public function postApiV3MeGroupsRequest($post_api_v3_me_groups_request, string $contentType = self::contentTypes['postApiV3MeGroups'][0])
  4145. {
  4146. // verify the required parameter 'post_api_v3_me_groups_request' is set
  4147. if ($post_api_v3_me_groups_request === null || (is_array($post_api_v3_me_groups_request) && count($post_api_v3_me_groups_request) === 0)) {
  4148. throw new \InvalidArgumentException(
  4149. 'Missing the required parameter $post_api_v3_me_groups_request when calling postApiV3MeGroups'
  4150. );
  4151. }
  4152. $resourcePath = '/v3/me/groups';
  4153. $formParams = [];
  4154. $queryParams = [];
  4155. $headerParams = [];
  4156. $httpBody = '';
  4157. $multipart = false;
  4158. $headers = $this->headerSelector->selectHeaders(
  4159. ['application/json', 'application/problem+json', ],
  4160. $contentType,
  4161. $multipart
  4162. );
  4163. // for model (json/xml)
  4164. if (isset($post_api_v3_me_groups_request)) {
  4165. if (stripos($headers['Content-Type'], 'application/json') !== false) {
  4166. # if Content-Type contains "application/json", json_encode the body
  4167. try {
  4168. $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_me_groups_request), JSON_THROW_ON_ERROR);
  4169. } catch (\JsonException $e) {
  4170. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  4171. }
  4172. } else {
  4173. $httpBody = $post_api_v3_me_groups_request;
  4174. }
  4175. } elseif (count($formParams) > 0) {
  4176. if ($multipart) {
  4177. $multipartContents = [];
  4178. foreach ($formParams as $formParamName => $formParamValue) {
  4179. $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
  4180. foreach ($formParamValueItems as $formParamValueItem) {
  4181. $multipartContents[] = [
  4182. 'name' => $formParamName,
  4183. 'contents' => $formParamValueItem
  4184. ];
  4185. }
  4186. }
  4187. // for HTTP post (form)
  4188. $httpBody = new MultipartStream($multipartContents);
  4189. } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
  4190. # if Content-Type contains "application/json", json_encode the form parameters
  4191. try {
  4192. $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
  4193. } catch (\JsonException $e) {
  4194. throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
  4195. }
  4196. } else {
  4197. // for HTTP post (form)
  4198. $httpBody = ObjectSerializer::buildQuery($formParams);
  4199. }
  4200. }
  4201. // this endpoint requires Bearer authentication (access token)
  4202. if (!empty($this->config->getAccessToken())) {
  4203. $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
  4204. }
  4205. $defaultHeaders = [];
  4206. if ($this->config->getUserAgent()) {
  4207. $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
  4208. }
  4209. $headers = array_merge(
  4210. $defaultHeaders,
  4211. $headerParams,
  4212. $headers
  4213. );
  4214. $operationHost = $this->config->getHost();
  4215. $query = ObjectSerializer::buildQuery($queryParams);
  4216. return new Request(
  4217. 'POST',
  4218. $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
  4219. $headers,
  4220. $httpBody
  4221. );
  4222. }
  4223. /**
  4224. * Create http client option
  4225. *
  4226. * @throws \RuntimeException on file opening failure
  4227. * @return array of http client options
  4228. */
  4229. protected function createHttpClientOption()
  4230. {
  4231. $options = [];
  4232. if ($this->config->getDebug()) {
  4233. $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
  4234. if (!$options[RequestOptions::DEBUG]) {
  4235. throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
  4236. }
  4237. }
  4238. if ($this->config->getCertFile()) {
  4239. $options[RequestOptions::CERT] = $this->config->getCertFile();
  4240. }
  4241. if ($this->config->getKeyFile()) {
  4242. $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
  4243. }
  4244. return $options;
  4245. }
  4246. private function handleResponseWithDataType(
  4247. string $dataType,
  4248. RequestInterface $request,
  4249. ResponseInterface $response
  4250. ): array {
  4251. if ($dataType === '\SplFileObject') {
  4252. $content = $response->getBody(); //stream goes to serializer
  4253. } else {
  4254. $content = (string) $response->getBody();
  4255. if ($dataType !== 'string') {
  4256. try {
  4257. $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
  4258. } catch (\JsonException $exception) {
  4259. throw new ApiException(
  4260. sprintf(
  4261. 'Error JSON decoding server response (%s)',
  4262. $request->getUri()
  4263. ),
  4264. $response->getStatusCode(),
  4265. $response->getHeaders(),
  4266. $content
  4267. );
  4268. }
  4269. }
  4270. }
  4271. return [
  4272. ObjectSerializer::deserialize($content, $dataType, []),
  4273. $response->getStatusCode(),
  4274. $response->getHeaders()
  4275. ];
  4276. }
  4277. private function responseWithinRangeCode(
  4278. string $rangeCode,
  4279. int $statusCode
  4280. ): bool {
  4281. $left = (int) ($rangeCode[0].'00');
  4282. $right = (int) ($rangeCode[0].'99');
  4283. return $statusCode >= $left && $statusCode <= $right;
  4284. }
  4285. }