2525
2626from __future__ import annotations
2727
28- from typing import TYPE_CHECKING
28+ from typing import TYPE_CHECKING , Any
2929
3030from . import utils
3131from .asset import Asset
@@ -358,7 +358,7 @@ async def edit(
358358
359359 .. versionadded:: 2.7
360360 """
361- payload : dict [str , object ] = {}
361+ payload : dict [str , Any ] = {}
362362 if description is not utils .MISSING :
363363 payload ["description" ] = description
364364 if icon is not utils .MISSING :
@@ -387,15 +387,15 @@ async def edit(
387387 if install_params is None :
388388 payload ["install_params" ] = None
389389 else :
390- payload ["install_params" ] = install_params .to_payload ()
390+ payload ["install_params" ] = install_params ._to_payload ()
391391 if custom_install_url is not utils .MISSING :
392392 payload ["custom_install_url" ] = custom_install_url
393393 if integration_types_config is not utils .MISSING :
394394 if integration_types_config is None :
395395 payload ["integration_types_config" ] = None
396396 else :
397397 payload ["integration_types_config" ] = (
398- integration_types_config .to_payload ()
398+ integration_types_config ._to_payload ()
399399 )
400400 if flags is not utils .MISSING :
401401 payload ["flags" ] = None if flags is None else flags .value
@@ -406,7 +406,7 @@ async def edit(
406406 if event_webhooks_types is not utils .MISSING :
407407 payload ["event_webhooks_types" ] = event_webhooks_types
408408
409- data = await self ._state .http .edit_current_application (payload )
409+ data = await self ._state .http .edit_current_application_info (payload )
410410 return AppInfo (self ._state , data )
411411
412412 @property
@@ -545,7 +545,7 @@ def __init__(self, data: AppInstallParamsPayload) -> None:
545545 self .scopes : list [str ] = data .get ("scopes" , [])
546546 self .permissions : Permissions = Permissions (int (data ["permissions" ]))
547547
548- def to_payload (self ) -> dict [str , object ]:
548+ def _to_payload (self ) -> dict [str , object ]:
549549 """Serialize this object into an application install params payload.
550550
551551 Returns
@@ -587,37 +587,40 @@ def __init__(
587587 self .guild = guild
588588 self .user = user
589589
590+ @staticmethod
591+ def _get_ctx (raw : dict | None , key : int ):
592+ if raw is None :
593+ return None
594+ if key in raw :
595+ return raw [key ]
596+ skey = str (key )
597+ return raw .get (skey )
598+
599+ @staticmethod
600+ def _decode_ctx (value : dict | None ) -> AppInstallParams | None :
601+ if value is None :
602+ return None
603+ params = value .get ("oauth2_install_params" )
604+ if not params :
605+ return None
606+ return AppInstallParams (params )
607+
590608 @classmethod
591609 def from_payload (cls , data : dict | None ) -> IntegrationTypesConfig | None :
592610 if data is None :
593611 return None
594-
595- def _get_ctx (raw : dict , key : int ):
596- if key in raw :
597- return raw [key ]
598- skey = str (key )
599- return raw .get (skey )
600-
601- def _decode_ctx (value : dict | None ) -> AppInstallParams | None :
602- if value is None :
603- return None
604- params = value .get ("oauth2_install_params" )
605- if not params :
606- return None
607- return AppInstallParams (params )
608-
609- guild_ctx = _decode_ctx (_get_ctx (data , 0 ))
610- user_ctx = _decode_ctx (_get_ctx (data , 1 ))
612+ guild_ctx = cls ._decode_ctx (cls ._get_ctx (data , 0 ))
613+ user_ctx = cls ._decode_ctx (cls ._get_ctx (data , 1 ))
611614 return cls (guild = guild_ctx , user = user_ctx )
612615
613616 def _encode_install_params (
614617 self , value : AppInstallParams | None
615618 ) -> dict [str , object ] | None :
616619 if value is None :
617620 return None
618- return {"oauth2_install_params" : value .to_payload ()}
621+ return {"oauth2_install_params" : value ._to_payload ()}
619622
620- def to_payload (self ) -> dict [int , dict [str , object ] | None ]:
623+ def _to_payload (self ) -> dict [int , dict [str , object ] | None ]:
621624 payload : dict [int , dict [str , object ] | None ] = {}
622625 if self .guild is not utils .MISSING :
623626 payload [0 ] = self ._encode_install_params (self .guild )
0 commit comments