mirror of
				https://github.com/brygphilomena/pyhuntress.git
				synced 2025-11-04 08:17:29 +00:00 
			
		
		
		
	add pagination to accounts/{id}
This commit is contained in:
		
							parent
							
								
									b3eae5456b
								
							
						
					
					
						commit
						01d6783d3e
					
				@ -22,7 +22,7 @@ class AccountsEndpoint(
 | 
			
		||||
        IGettable.__init__(self, SATAccounts)
 | 
			
		||||
        IPaginateable.__init__(self, SATAccounts)
 | 
			
		||||
 | 
			
		||||
    def id(self, id: int) -> AccountsIdEndpoint:
 | 
			
		||||
    def id(self, id: str) -> AccountsIdEndpoint:
 | 
			
		||||
        """
 | 
			
		||||
        Sets the ID for this endpoint and returns an initialized AccountsIdEndpoint object to move down the chain.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,37 @@ class AccountsIdEndpoint(
 | 
			
		||||
        self.phishing_campaigns = self._register_child_endpoint(AccountsIdPhishingCampaignsEndpoint(client, parent_endpoint=self))
 | 
			
		||||
        self.phishing_scenarios = self._register_child_endpoint(AccountsIdPhishingScenariosEndpoint(client, parent_endpoint=self))
 | 
			
		||||
 | 
			
		||||
    def paginated(
 | 
			
		||||
        self,
 | 
			
		||||
        page: int,
 | 
			
		||||
        limit: int,
 | 
			
		||||
        params: HuntressSATRequestParams | None = None,
 | 
			
		||||
    ) -> PaginatedResponse[SATAccounts]:
 | 
			
		||||
        """
 | 
			
		||||
        Performs a GET request against the /accounts/{id} endpoint and returns an initialized PaginatedResponse object.
 | 
			
		||||
 | 
			
		||||
        Parameters:
 | 
			
		||||
            page (int): The page number to request.
 | 
			
		||||
            limit (int): The number of results to return per page.
 | 
			
		||||
            params (dict[str, int | str]): The parameters to send in the request query string.
 | 
			
		||||
        Returns:
 | 
			
		||||
            PaginatedResponse[SATAccounts]: The initialized PaginatedResponse object.
 | 
			
		||||
        """
 | 
			
		||||
        if params:
 | 
			
		||||
            params["page[number]"] = page
 | 
			
		||||
            params["page[size]"] = limit
 | 
			
		||||
        else:
 | 
			
		||||
            params = {"page[number]": page, "page[size]": limit}
 | 
			
		||||
        return PaginatedResponse(
 | 
			
		||||
            super()._make_request("GET", params=params),
 | 
			
		||||
            SATAccounts,
 | 
			
		||||
            self,
 | 
			
		||||
            "data",
 | 
			
		||||
            page,
 | 
			
		||||
            limit,
 | 
			
		||||
            params,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def get(
 | 
			
		||||
        self,
 | 
			
		||||
        data: JSON | None = None,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user