Source code for bungieapi.generated.clients.content

# generated by update to not change manually
import typing as t

from bungieapi.base import BaseClient
from bungieapi.forge import forge
from bungieapi.generated.components.responses import (
    IReadOnlyCollectionOfContentItemPublicContractClientResponse,
    SearchResultOfContentItemPublicContractClientResponse,
)
from bungieapi.generated.components.responses.content import (
    ContentItemPublicContractClientResponse,
)
from bungieapi.generated.components.responses.content.models import (
    ContentTypeDescriptionClientResponse,
)


[docs]class Client(BaseClient):
[docs] async def get_content_type( self, type: t.Optional[str] = None, ) -> ContentTypeDescriptionClientResponse: """Gets an object describing a particular variant of content.""" query = None result = await self.get( path=f"/Content/GetContentType/{type}/", query=query, ) return forge(ContentTypeDescriptionClientResponse, result)
[docs] async def get_content_by_id( self, head: t.Optional[bool] = None, id: t.Optional[int] = None, locale: t.Optional[str] = None, ) -> ContentItemPublicContractClientResponse: """Returns a content item referenced by id Parameters: head: false""" query = {"head": head} result = await self.get( path=f"/Content/GetContentById/{id}/{locale}/", query=query, ) return forge(ContentItemPublicContractClientResponse, result)
[docs] async def get_content_by_tag_and_type( self, head: t.Optional[bool] = None, locale: t.Optional[str] = None, tag: t.Optional[str] = None, type: t.Optional[str] = None, ) -> ContentItemPublicContractClientResponse: """Returns the newest item that matches a given tag and Content Type. Parameters: head: Not used. """ query = {"head": head} result = await self.get( path=f"/Content/GetContentByTagAndType/{tag}/{type}/{locale}/", query=query, ) return forge(ContentItemPublicContractClientResponse, result)
[docs] async def search_content_with_text( self, ctype: t.Optional[str] = None, currentpage: t.Optional[int] = None, head: t.Optional[bool] = None, locale: t.Optional[str] = None, searchtext: t.Optional[str] = None, source: t.Optional[str] = None, tag: t.Optional[str] = None, ) -> SearchResultOfContentItemPublicContractClientResponse: """Gets content based on querystring information passed in. Provides basic search and text search capabilities. Parameters: ctype: Content type tag: Help, News, etc. Supply multiple ctypes separated by space. currentpage: Page number for the search results, starting with page 1. head: Not used. searchtext: Word or phrase for the search. source: For analytics, hint at the part of the app that triggered the search. Optional. tag: Tag used on the content to be searched. """ query = { "ctype": ctype, "currentpage": currentpage, "head": head, "searchtext": searchtext, "source": source, "tag": tag, } result = await self.get( path=f"/Content/Search/{locale}/", query=query, ) return forge(SearchResultOfContentItemPublicContractClientResponse, result)
[docs] async def search_content_by_tag_and_type( self, currentpage: t.Optional[int] = None, head: t.Optional[bool] = None, itemsperpage: t.Optional[int] = None, locale: t.Optional[str] = None, tag: t.Optional[str] = None, type: t.Optional[str] = None, ) -> SearchResultOfContentItemPublicContractClientResponse: """Searches for Content Items that match the given Tag and Content Type. Parameters: currentpage: Page number for the search results starting with page 1. head: Not used. itemsperpage: Not used. """ query = {"currentpage": currentpage, "head": head, "itemsperpage": itemsperpage} result = await self.get( path=f"/Content/SearchContentByTagAndType/{tag}/{type}/{locale}/", query=query, ) return forge(SearchResultOfContentItemPublicContractClientResponse, result)
[docs] async def search_help_articles( self, searchtext: t.Optional[str] = None, size: t.Optional[str] = None, ) -> IReadOnlyCollectionOfContentItemPublicContractClientResponse: """Search for Help Articles.""" query = None result = await self.get( path=f"/Content/SearchHelpArticles/{searchtext}/{size}/", query=query, ) return forge( IReadOnlyCollectionOfContentItemPublicContractClientResponse, result )