<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
	<channel>
		<title>Author at Infinum</title>
		<atom:link href="https://infinum.com/blog/author/branimir-akmadza/feed/" rel="self" type="application/rss+xml" />
		<link></link>
		<description>Building digital products</description>
		<lastBuildDate>Tue, 14 Apr 2026 10:32:35 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>

					<item>
				<image>
					<url>19272193https://infinum.com/uploads/2025/11/img-GPT-apps.webp</url>
				</image>
				<title>Your Brand Needs a ChatGPT App Strategy, Now</title>
				<link>https://infinum.com/blog/apps-in-chatgpt-and-the-apps-sdk/</link>
				<pubDate>Tue, 11 Nov 2025 17:27:03 +0000</pubDate>
				<dc:creator>Branimir Akmadža</dc:creator>
				<guid isPermaLink="false">https://infinum.com/?p=19272193</guid>
				<description>
					<![CDATA[<p>The new era of apps is conversational. ChatGPT-native apps are redefining how users discover, interact with, and transact with digital products, and Infinum is ready to help brands lead this shift.</p>
<p>The post <a href="https://infinum.com/blog/apps-in-chatgpt-and-the-apps-sdk/">Your Brand Needs a ChatGPT App Strategy, Now</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</description>
				<content:encoded>
					<![CDATA[<div
	class="wrapper js-table-of-contents-data"
	data-id="es-109"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-92">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-95"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-93">
	<p	class='typography typography--size-36-text js-typography block-typography__typography'
	data-id='es-94'
	>
	<strong>OpenAI’s new Apps SDK unlocks a powerful new frontier where apps live inside ChatGPT – interactive, real-time, and seamlessly part of natural conversation. This shift is going to redefine how customers discover, interact with, and purchase digital products. And it’s a big deal.</strong></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-98"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-96">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-97'
	>
	There are moments in tech when everything changes: the rise of the web, the move to the cloud, the boom of app stores. We believe we&#8217;re witnessing the next one: apps inside ChatGPT.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-101"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-99">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-100'
	>
	<strong>What are the apps inside ChatGPT, and how do they work?</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-104"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-102">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-103'
	>
	OpenAI&#8217;s new <a href="https://openai.com/index/introducing-apps-in-chatgpt/" target="_blank" rel="noreferrer noopener">Apps SDK allows developers to build native apps</a> that live inside the ChatGPT interface, enabling users to transact, explore, and interact through natural language. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-107"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-105">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-106'
	>
	Instead of asking users to visit your site, download your app, or fill out a form, you’ll be able to meet them where they already are: inside ChatGPT, right in the flow of conversation.</p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-112"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-110"
	 data-media-type='video'>

	<div class="video__wrapper" data-id="es-111">
		<video
		class="video block-media__video js-video js-block-media-video video--cursor-takeover-use"
		 loop autoplay playsinline muted preload='metadata'>
		<source  src='https://infinum.com/uploads/2025/11/Domi-Chat-GPT-2.mp4' type='video/mp4' />	</video>
	</div></div></div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-130"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-113">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-117"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-114"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
					</div>

		<div class="intro-label card-simple__outro-label intro-label__line-type--outro" data-id="es-115">
	<p	class='typography typography--size-14-text-roman js-typography intro-label__outro-label'
	data-id='es-116'
	>
	WELCOME TO THE ERA OF CHATGPT APPS.</p></div>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-120"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-118">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-119'
	>
	Whether users are booking a trip, checking their finances, or buying a product, the entire customer journey happens in one interface: fast, intuitive, and frictionless. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-122"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-121'
	>
	<strong>For users, it means fewer redirects and smoother interactions. For brands, it opens up a new channel, a new revenue stream, and a more direct way to turn interest into action. </strong></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-125"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-123">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-124'
	>
	At Infinum, we’ve been building mobile and web apps for 20 years. We know how to work with app stores, backend platforms, complex UX, and <a href="https://infinum.com/artificial-intelligence/agent-development/" id="https://infinum.com/artificial-intelligence/agent-development/">intelligent, agentic automation</a>. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-128"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-126">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-127'
	>
	ChatGPT Apps feel like a natural next step, and we are ready to help you claim a place in the new AI-native web. </p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-159"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-131">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-134"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-132">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-133'
	>
	<strong>Why GPT Apps are a turning point for digital experiences</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-137"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-135">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-136'
	>
	ChatGPT is no longer just a place to ask questions.&nbsp;</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-140"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-138">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-139'
	>
	With over<strong> </strong><a href="https://techcrunch.com/2025/10/06/sam-altman-says-chatgpt-has-hit-800m-weekly-active-users/" target="_blank" rel="noreferrer noopener">800 million weekly ChatGPT users</a>, it’s quickly becoming a connective layer of the internet, bringing together natural information, easily accessible information, and now services into one unified flow. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-143"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-141">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-142'
	>
	Success now means being genuinely useful at the exact moment of need, not the loudest voice in the room.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-148"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="blockquote block-blockquote__blockquote" data-id="es-144">
	
	<div class="blockquote__content">
		<i
	class="icon blockquote__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='blockquote-24' data-id='es-145'>
	<svg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-2.79685-.9568-5.37021-2.561-7.41062-.581.22951-1.0832.60583-1.5069 1.12898-.5132.60844-.7698 1.41969-.7698 2.43375v.07605h2.5789v5.59004h-5.6197v-5.01962c0-1.11547.154-2.06616.4619-2.85205.3336-.81125.757-1.48307 1.2702-2.01545.528-.52161 1.1175-.92155 1.7687-1.1998-2.0728-1.70651-4.7279-2.73128-7.6223-2.73128-6.62742 0-12 5.37258-12 12 0 6.6274 5.37258 12 12 12zm-3.53811-18.05347c-.30793.78589-.46189 1.73658-.46189 2.85205v5.01962h5.6197v-5.59004h-2.5789v-.07605c0-1.01406.2566-1.82531.7698-2.43375.5389-.63379 1.1804-1.05209 1.9245-1.2549v-2.28164c-.7441.07605-1.4626.25351-2.1555.53238-.6928.27887-1.3086.68449-1.84752 1.21688-.51321.53238-.9366 1.2042-1.27019 2.01545z' fill='currentColor' fill-rule='evenodd'/></svg></i><p	class='typography typography--size-36-text js-typography blockquote__quote'
	data-id='es-146'
	>
	<strong>People don’t search for answers anymore – they expect to ask and get them instantly. With </strong><a href="https://www.capgemini.com/wp-content/uploads/2019/09/Report-%E2%80%93-Conversational-Interfaces_Web-Final.pdf?utm_source=chatgpt.com"><strong>74% of consumers</strong></a><strong> embracing chat and voice assistants, brands have a once-in-a-generation opportunity to capture first-mover advantage, define the new standard of customer experience, and be truly innovative in their vertical.</strong></p>
		<div class="blockquote__caption-wrap">
			<div	class='typography typography--size-12-text-roman js-typography blockquote__caption'
	data-id='es-147'
	>
	KASPER KUIJPERS, FOUNDER &amp; CTO OF YOUR MAJESTY, PART OF INFINUM<br />
</div>		</div>
	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-151"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-149">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-150'
	>
	And while it was only a matter of time before ChatGPT moved beyond search and became a platform for doing, this isn’t happening in isolation.&nbsp;</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-154"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-152">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-153'
	>
	Microsoft Copilot, Google Gemini, and Meta’s AI efforts are all moving toward embedding services into conversational AI. But OpenAI’s ChatGPT is leading the way with native app capabilities. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-157"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-155">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-156'
	>
	This isn&#8217;t just a product trend — it&#8217;s a strategic inflection point. If you haven&#8217;t mapped out where AI fits in your business model, our <a href="https://infinum.com/blog/ai-strategy/">AI strategy guide</a> covers how to evaluate and prioritize AI use cases before committing to a build.</p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-165"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-160">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-163"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-161">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-162'
	>
	<strong>What GPT Apps can do for your business</strong></h2></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-218"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="grid block-grid__grid" data-id="es-217">
	
<div class="block-grid-item" data-id="es-166">
	

</div>

<div class="block-grid-item" data-id="es-176">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-168"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<hr
	class="block-divider"
	data-id="es-167"
	aria-hidden="true" />	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-171"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--top bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-169">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-170'
	>
	1</p>	<div class="bullet__content">
			</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-175"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-172"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-173'
	>
	<strong>Get discovered at the right moment</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-174'
	 id='es-172-paragraph'>
	ChatGPT actively recommends apps based on users&#8217; requests. Your brand can appear in conversations that match your offer, opening an organic path to discovery.</p>	</div>
</div>	</div>
</div>

<div class="block-grid-item" data-id="es-186">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-178"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<hr
	class="block-divider"
	data-id="es-177"
	aria-hidden="true" />	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-181"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--top bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-179">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-180'
	>
	2</p>	<div class="bullet__content">
			</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-185"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-182"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-183'
	>
	<strong>Reduce friction to boost conversions</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-184'
	 id='es-182-paragraph'>
	No downloads, no redirects, just a question and an answer. Embedding your product or service directly in the conversation shortens the conversion funnel.<br />
</p>	</div>
</div>	</div>
</div>

<div class="block-grid-item" data-id="es-196">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-188"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<hr
	class="block-divider"
	data-id="es-187"
	aria-hidden="true" />	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-191"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--top bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-189">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-190'
	>
	3</p>	<div class="bullet__content">
			</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-195"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-192"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-193'
	>
	<strong>Build a high-intent revenue stream</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-194'
	 id='es-192-paragraph'>
	Unlike traditional ads that try to create interest, GPT Apps connect you with people who already have it. You’re meeting users right when they’re expressing a need, turning intent into action.</p>	</div>
</div>	</div>
</div>

<div class="block-grid-item" data-id="es-206">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-198"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<hr
	class="block-divider"
	data-id="es-197"
	aria-hidden="true" />	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-201"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--top bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-199">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-200'
	>
	4</p>	<div class="bullet__content">
			</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-205"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-202"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-203'
	>
	<strong>Shape the market as an early mover</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-204'
	 id='es-202-paragraph'>
	Like in the early days of the App Store, early adopters will shape expectations, gain visibility, and build loyalty, all while unlocking opportunities for new kinds of applications and businesses to emerge.<br />
</p>	</div>
</div>	</div>
</div>

<div class="block-grid-item" data-id="es-216">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-208"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<hr
	class="block-divider"
	data-id="es-207"
	aria-hidden="true" />	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-211"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--top bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-209">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-210'
	>
	5</p>	<div class="bullet__content">
			</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-215"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-212"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-213'
	>
	<strong><strong>Learn from real interactions</strong><br />
</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-214'
	 id='es-212-paragraph'>
	Every conversation tells you something: what users want, where they drop off, and how you can improve their experience.<strong> </strong></p>	</div>
</div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-251"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-219">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-222"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-220">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-221'
	>
	<strong>What you can build inside ChatGPT Apps</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-225"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-223">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-224'
	>
	ChatGPT Apps combine the best of conversation and interactivity, creating experiences that feel both natural and capable. Here’s what you can build:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-229"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-226">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-227'
	>
	<strong><strong><strong>Conversational commerce experiences</strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-228'
	>
	Let users discover, compare, and purchase products directly in chat. Offer personalized recommendations, real-time inventory checks, and seamless checkout flows. <br />
<br />
For bonus points, let users delegate actions like “If this laptop’s price drops below X, buy it.” The agent can track prices and automatically execute approved actions.</p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-233"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-230">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-231'
	>
	<strong><strong><strong><strong>Personalized recommendations, booking, and scheduling</strong></strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-232'
	>
	Combine AI with your business logic to provide custom suggestions: products, learning paths, travel plans, or wellness routines tailored to each user’s needs. <br />
<br />
Building off of recommendations, allow users to book appointments, trips, rentals, or restaurant tables through simple conversation. With calendar integrations and smart prompts, booking becomes effortless.</p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-237"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-234">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-235'
	>
	<strong><strong><strong><strong><strong>Data analysis &amp; visualization</strong></strong></strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-236'
	>
	Let users analyze personal or business data: spending, health, traffic, engagement, and more, and get instant visualizations, comparisons, and insights. This is the foundation of an <a href="https://infinum.com/blog/ai-knowledge-hubs/">AI-powered knowledge hub</a> — we&#8217;ve built these for insurance underwriters, fitness brands, and procurement teams, turning raw data into decisions through a chat interface.</p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-241"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-238">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-239'
	>
	<strong><strong><strong><strong><strong><strong>Configuration &amp; support</strong></strong></strong></strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-240'
	>
	Turn FAQs, troubleshooting, and account management into guided conversational flows. Users can set up services, customize products, solve issues, update details, or access information without switching channels or contacting support. Building this well is harder than it looks — our breakdown of <a href="https://infinum.com/blog/ai-chatbot-development-pain-points/">AI chatbot development pain points</a> covers the three most common ways these projects go wrong.</p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-245"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-242">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-243'
	>
	<strong><strong><strong><strong><strong><strong><strong>Real-time transactions</strong></strong></strong></strong></strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-244'
	>
	Let users complete actions like money transfers, document signing, or file uploads directly in ChatGPT conversations.<br />
</p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-249"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--infinum block-bullet__bullet" data-id="es-246">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-247'
	>
	<strong><strong><strong><strong><strong><strong><strong><strong>Microlearning &amp; training</strong></strong></strong></strong></strong></strong></strong></strong></h3><p	class='typography typography--size-20-text-roman js-typography bullet__paragraph'
	data-id='es-248'
	>
	Deliver short, interactive lessons for education, compliance, or professional development, perfect for learning in context or on the go.</p>	</div>
</div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-257"
	 data-animation-target='inner-items'>
		
			<div class="block-columns" data-id="es-256">
	
<div class="block-column" data-id="es-255">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-254"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-252"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-253">
	<picture class="image__picture block-media__image-picture">
								
			<source
				srcset=https://infinum.com/uploads/2025/11/gpt-app-2-1400x735.webp				media='(max-width: 699px)'
				type=image/webp								height="735"
												width="1400"
				 />
												<img
					src="https://infinum.com/uploads/2025/11/gpt-app-2.webp"
					class="image__img block-media__image-img"
					alt="ChatGPT interface showing a Finix finance app responding to a user query with a spending activity chart and transaction history, illustrating a conversational finance GPT app"
										height="1260"
															width="2400"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>	</div>
</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-263"
	 data-animation-target='inner-items'>
		
			<div class="block-columns" data-id="es-262">
	
<div class="block-column" data-id="es-261">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-260"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-258"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-259">
	<picture class="image__picture block-media__image-picture">
								
			<source
				srcset=https://infinum.com/uploads/2025/11/gpt-app-3-new-1400x735.webp				media='(max-width: 699px)'
				type=image/webp								height="735"
												width="1400"
				 />
												<img
					src="https://infinum.com/uploads/2025/11/gpt-app-3-new.webp"
					class="image__img block-media__image-img"
					alt="ChatGPT interface showing a Solenne fashion app responding to a purchase request with three handbag product cards and Shop Now buttons, demonstrating conversational commerce inside ChatGPT"
										height="1260"
															width="2400"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>	</div>
</div>
</div>	</div>

<div
	class="wrapper"
	data-id="es-287"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-264">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-267"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-265">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-266'
	>
	<strong>Which industries can benefit from Apps inside ChatGPT?</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-270"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-268">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-269'
	>
	While <strong>retail and ecommerce </strong>are the obvious front-runners, because of the direct path from browsing to purchase, any business offering a product or service can benefit from GPT-native experiences.&nbsp;</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-273"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-271">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-272'
	>
	<strong>Travel services</strong> can handle <strong>accommodation, car rentals, ticketing, and dining </strong>booking, confirmations, and itinerary changes through natural queries. In<strong> finance and insurance,</strong> users can analyze spending, receive optimization advice, or complete policy onboarding, all without forms or separate logins.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-276"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-274">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-275'
	>
	In <strong>healthcare,</strong> apps can track metrics from wearables and suggest personalized health actions or recommend lifestyle adjustments. For <strong>education,</strong> GPT-native apps can analyse lessons and learning materials, generate study plans, and adapt based on progress. Even <strong>real estate, legal, and public services </strong>can use this channel to offer instant document reviews, local insights, or access to experts. And with the<strong> Internet of Things, </strong>GPT-native experiences can bridge voice, sensors, and automation, letting users control, monitor, and optimize connected devices just by asking.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-279"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-277">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-278'
	>
	The unifying theme? If your customers can ask for it, we can build an experience for it.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-282"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-280">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-281'
	>
	<strong>How to prepare for ChatGPT App integration</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-285"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-283">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-284'
	>
	ChatGPT App development takes both strategic readiness and technical execution. We recommend focusing on speed, ROI, and user experience. </p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-341"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div data-id="es-336" class="block-horizontal-manual-carousel js-block-horizontal-manual-carousel block-horizontal-manual-carousel__align-items--top">
	<div class="block-horizontal-manual-carousel__container block-horizontal-manual-carousel__container--gutter-default js-block-horizontal-manual-carousel-container">
		<div class="cursor-takeover block-horizontal-manual-carousel__cursor-takeover" data-id="es-337">
		<div class="cursor-takeover__cursor js-block-horizontal-manual-carousel-cursor-takeover block-horizontal-manual-carousel__cursor">
		<div class="cursor-takeover__wrap">
			<i
	class="icon cursor-takeover__drag-left icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='arrow-left-16' data-id='es-338'>
	<svg height='16' viewBox='0 0 17 16' width='17' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g fill='none' fill-rule='evenodd' stroke='currentColor' stroke-width='2' transform='matrix(-1 0 0 1 17 0)'><g transform='translate(0 2)'><path d='m.5 5.99999 14 .00001'/><path d='m9.23352.7251 5.97848 5.97852'/><path d='m9.23352 11.2744 5.97848-5.9785'/></g></g></svg></i><i
	class="icon cursor-takeover__drag-right icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='arrow-right-16' data-id='es-339'>
	<svg fill='none' height='16' viewBox='0 0 17 16' width='17' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g stroke='currentColor' stroke-width='2'><path d='m.5 7.99999 14 .00001'/><path d='m9.23352 2.7251 5.97848 5.97852'/><path d='m9.23352 13.2744 5.97848-5.9785'/></g></svg></i>
			<div class="cursor-takeover__circle js-block-horizontal-manual-carousel-cursor-takeover-circle" aria-hidden="true">
				<p	class='typography typography--size-12-text typography--uppercase js-typography cursor-takeover__label'
	data-id='es-340'
	>
	drag</p>			</div>
		</div>
	</div>
	</div>		
<div class="block-carousel-item" data-id="es-295">
	
<div class="block-typography" data-id="es-288">
	<p	class='typography typography--size-14-text-roman js-typography block-typography__typography'
	data-id='es-289'
	>
	STRATEGIC READINESS<br></p></div>

<div class="block-typography" data-id="es-290">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-291'
	>
	01</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-292"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-293'
	>
	<br />
<strong><strong>Identify conversational moments</strong></strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-294'
	 id='es-292-paragraph'>
	Ask: where would chat feel more natural than forms or menus? Review support tickets, drop-off points, and key product flows. Look for places where a simple prompt can replace a multi-step process. <a href="https://infinum.com/blog/ai-automation/">AI automation</a> tools already solve parts of this — the question is where conversational AI goes further by replacing structured flows entirely with natural-language interactions.<br><br><em>Need help mapping this? We can guide </em><a href="https://infinum.com/strategy-design/" target="_blank" rel="noreferrer noopener"><em>discovery and user research.</em></a><em> </em></p>	</div>
</div>
</div>

<div class="block-carousel-item" data-id="es-303">
	
<div class="block-typography" data-id="es-296">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-297'
	>
	.</p></div>

<div class="block-typography" data-id="es-298">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-299'
	>
	02</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-300"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-301'
	>
	<br />
<strong><strong>Audit your data</strong></strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-302'
	 id='es-300-paragraph'>
	Map out your data sources, formats, and ownership. Check for accuracy, duplication, and sensitive fields that shouldn’t be exposed. Classifying your data early prevents compliance risks and ensures AI works with clean, reliable inputs later on. If your data isn&#8217;t production-ready, this step is where you&#8217;ll need <a href="https://infinum.com/artificial-intelligence/data-engineering/">data engineering</a> support — clean pipelines and governed data sources are a prerequisite for any AI system that produces reliable outputs. For organisations in regulated sectors, our <a href="https://infinum.com/cybersecurity/">cybersecurity services</a> include the technical assessments needed to ensure your AI systems meet security and compliance requirements before launch.<br></p>	</div>
</div>
</div>

<div class="block-carousel-item" data-id="es-311">
	
<div class="block-typography" data-id="es-304">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-305'
	>
	.</p></div>

<div class="block-typography" data-id="es-306">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-307'
	>
	03</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-308"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-309'
	>
	<br />
<strong><strong><strong>Design for conversation</strong></strong></strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-310'
	 id='es-308-paragraph'>
	GPT Apps aren’t websites in a chat box, they’re apps that feel like dialogue. That means designing flows that are short, contextual, and responsive. Focus on natural prompts, clear responses, and interaction patterns that match how people actually talk while staying true to your brand voice.<br />
</p>	</div>
</div>
</div>

<div class="block-carousel-item" data-id="es-319">
	
<div class="block-typography" data-id="es-312">
	<p	class='typography typography--size-14-text-roman js-typography block-typography__typography'
	data-id='es-313'
	>
	TECHNICAL EXECUTION<br></p></div>

<div class="block-typography" data-id="es-314">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-315'
	>
	04</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-316"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-317'
	>
	<br />
<strong><strong><strong><strong>Connect your systems</strong></strong></strong></strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-318'
	 id='es-316-paragraph'>
	Your backend probably doesn’t need an overhaul – just a smart integration layer that exposes it through the <a href="https://infinum.com/blog/model-context-protocols-mcp-ai-enabled-businesses/" id="https://infinum.com/blog/model-context-protocols-mcp-ai-enabled-businesses/">Model Context Protocol</a>. By implementing an MCP server around your API, you’ve already done most of the work to join the GPT Apps ecosystem. Then, add secure session handling and real-time sync to enable dynamic content.<br></p>	</div>
</div>
</div>

<div class="block-carousel-item" data-id="es-327">
	
<div class="block-typography" data-id="es-320">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-321'
	>
	.</p></div>

<div class="block-typography" data-id="es-322">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-323'
	>
	05</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-324"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-325'
	>
	<br />
<strong style="font-weight: bold">Build and test with the Apps SDK</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-326'
	 id='es-324-paragraph'>
	Set up the Apps SDK, implement OpenAI’s Model Context Protocol, and build a responsive front end. Validate with real user flows, track where users succeed or stall, and iterate quickly to ensure product-market fit.<br />
</p>	</div>
</div>
</div>

<div class="block-carousel-item" data-id="es-335">
	
<div class="block-typography" data-id="es-328">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-329'
	>
	.</p></div>

<div class="block-typography" data-id="es-330">
	<p	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-331'
	>
	06</p></div>

<div	class="card-simple js-card-simple block-card__card-simple card-simple__content-align--left"
	data-id="es-332"
	>

	
	
	<div class="card-simple__content">
		<div class="card-simple__heading-wrap">
			<h3	class='typography typography--size-24-text js-typography card-simple__heading'
	data-id='es-333'
	>
	<br />
<strong>Prepare for marketplace launch</strong></h3>		</div>

		<p	class='typography typography--size-16-text-roman js-typography card-simple__paragraph'
	data-id='es-334'
	 id='es-332-paragraph'>
	A compelling app isn’t just functional, it’s discoverable. Once your app is ready, we can help refine branding, connect analytics, and ensure conversion optimization post-launch.</p>	</div>
</div>
</div>
	</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-412"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-342">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-348"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div
	class="block-featured-card js-block-featured-card"
	data-id="es-343"
	data-orientation="vertical">
	<a
		href="https://infinum.com/artificial-intelligence/agent-development/"
		class="block-featured-card__link js-block-featured-card-link"
		>

		
		<div class="block-featured-card__content js-block-featured-card-content">
			<div class="block-featured-card__heading-wrap js-block-featured-card-heading-wrap">
				<p	class='typography typography--size-36-text js-typography block-featured-card__heading'
	data-id='es-344'
	>
	<strong>Want to move fast? Try our Agentic Sprint and turn the right business use case into a live AI agent prototype in just 10 days.</strong><br />
</p>			</div>

					</div>

		<button	class="btn btn--color-infinum btn--size-medium btn--width-default btn__icon-position--right block-featured-card__btn js-block-featured-card-btn js-block-featured-card-button"
	data-id="es-345"
	 tabindex='-1'>
		<div class="btn__inner">
					<div	class='typography typography--size-none js-typography btn__label'
	data-id='es-346'
	>
	Learn more</div>		
		<i
	class="icon btn__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='arrow-right-16' data-id='es-347'>
	<svg fill='none' height='16' viewBox='0 0 17 16' width='17' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g stroke='currentColor' stroke-width='2'><path d='m.5 7.99999 14 .00001'/><path d='m9.23352 2.7251 5.97848 5.97852'/><path d='m9.23352 13.2744 5.97848-5.9785'/></g></svg></i>	</div>
	</button>	</a>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-351"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-349">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-350'
	>
	<strong>Technical foundation for GPT Apps</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-354"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-352">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-353'
	>
	To build a production-ready GPT App, your stack should include:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-357"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="lists" data-id="es-355">
	<ul	class='typography typography--size-16-text-roman js-typography lists__typography'
	data-id='es-356'
	>
	<li><strong>Well-documented APIs</strong> for core business functions (e.g., pricing, account access, bookings)</li><li><strong>Secure authentication flows</strong> to manage sessions within the GPT context</li><li><strong>Lightweight frontend assets</strong> (HTML/CSS/JS) that can be rendered inline or full-screen inside ChatGPT</li><li><strong>Structured data sources</strong> like product catalogs or user history for personalized responses</li><li><strong>Integration via Model Context Protocol (MCP)</strong> so ChatGPT understands and responds in sync with your app’s state</li><li><strong>Optional: analytics hooks</strong> to monitor usage, performance, and conversion in real time</li></ul></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-360"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-358">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-359'
	>
	We help you scope, prioritize, and build what’s needed, starting with use cases that deliver clear user and business value.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-363"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-361">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-362'
	>
	<strong>Why act now?</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-366"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-364">
	<p	class='typography typography--size-20-text-roman js-typography block-typography__typography'
	data-id='es-365'
	>
	GPT Apps are in early rollout, which means the market is open, but it won’t be for long. Just like early app store adopters or companies that invested early in mobile, the ones who explore ChatGPT apps first will enjoy:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-369"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--black block-bullet__bullet" data-id="es-367">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-368'
	>
	Greater visibility as one of the few apps in a category</h3>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-372"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--black block-bullet__bullet" data-id="es-370">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-371'
	>
	More room to define interaction patterns and user expectations</h3>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-375"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--dot bullet__color--black block-bullet__bullet" data-id="es-373">
			<div class="bullet__dot"></div>
		<div class="bullet__content">
		<h3	class='typography typography--size-24-text js-typography bullet__heading'
	data-id='es-374'
	>
	Better data, sooner, giving you a head start on optimization</h3>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-378"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-376">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-377'
	>
	By the time this ecosystem matures, brands that moved early will have more traction, more insights, and a stronger position.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-381"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-379">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-380'
	>
	<strong>Should you build in-house or outsource?</strong><br />
</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-384"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-382">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-383'
	>
	If you already have strong in-house teams across AI, UX, and platform engineering, you can probably build internally.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-387"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-385">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-386'
	>
	But if speed, quality, and confidence matter, partnering with a team like<strong> Infinum</strong> can get you further, faster. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-389"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-388'
	>
	For over two decades, we have been building award-winning digital products that succeed in competitive ecosystems, including the Apple App Store, Google Play, and enterprise marketplaces.  </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-392"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-390">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-391'
	>
	We know what it takes to build for evolving platforms. See everything we offer under our <a href="https://infinum.com/artificial-intelligence/">AI and data engineering services</a> — from agent development to custom AI solutions and data infrastructure.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-395"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-393">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-394'
	>
	Our experience with marketplaces, app standards, and the OpenAI Apps SDK means we can turn early ideas into launch-ready products with clarity and precision.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-398"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-396">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-397'
	>
	<strong>What we offer:</strong></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-401"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="lists" data-id="es-399">
	<ul	class='typography typography--size-16-text-roman js-typography lists__typography'
	data-id='es-400'
	>
	<li>Discovery workshops to align goals and identify opportunities</li><li>Rapid prototyping and MVP delivery to test the market quickly</li><li>Full-stack engineering for production-ready GPT Apps</li><li>Post-launch support, analytics, and iteration</li></ul></div>	</div>

<div
	class="wrapper wrapper__use-simple--true js-table-of-contents-data"
	data-id="es-404"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-402">
	<h2	class='typography typography--size-52-default js-typography block-typography__typography'
	data-id='es-403'
	>
	<strong>Your move: build where 800M users already are</strong></h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-407"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-405">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-406'
	>
	ChatGPT-native apps represent a shift in how users find and use digital products. Infinum is here to help you be part of that change, from strategy to shipping.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-410"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-typography" data-id="es-408">
	<p	class='typography typography--size-16-text-roman js-typography block-typography__typography'
	data-id='es-409'
	>
	<em><a href="https://infinum.com/contact/" target="_blank" rel="noreferrer noopener">Let’s turn your service into a ChatGPT-native app</a> and get you in front of 800 million users, faster.</em></p></div>	</div>
</div>
</div>		</div>
	</div><p>The post <a href="https://infinum.com/blog/apps-in-chatgpt-and-the-apps-sdk/">Your Brand Needs a ChatGPT App Strategy, Now</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</content:encoded>
			</item>
					<item>
				<image>
					<url>7879https://infinum.com/uploads/2021/03/retromock-retrofit-calls-0.webp</url>
				</image>
				<title>Introducing Retromock, a Better Way to Mock Retrofit API Calls</title>
				<link>https://infinum.com/blog/retromock-retrofit-calls/</link>
				<pubDate>Tue, 02 Mar 2021 10:25:00 +0000</pubDate>
				<dc:creator>Branimir Akmadža</dc:creator>
				<guid isPermaLink="false">https://infinum.com/the-capsized-eight/retromock-retrofit-calls/</guid>
				<description>
					<![CDATA[<p>Retromock is a Java library for mocking responses in a Retrofit service that&#8217;ll make your life easier.</p>
<p>The post <a href="https://infinum.com/blog/retromock-retrofit-calls/">Introducing Retromock, a Better Way to Mock Retrofit API Calls</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</description>
				<content:encoded>
					<![CDATA[<div
	class="wrapper"
	data-id="es-666"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-413">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-416"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-414">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-415'
	>
	Most Android apps use a networking client to talk to some API. The most popular client is probably Retrofit, a type-safe HTTP client for Android and Java.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-419"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-417">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-418'
	>
	If you are familiar with Retrofit and its usage, keep on reading to learn a better way to mock API calls.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-422"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-420">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-421'
	>
	Why should we mock API calls?</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-425"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-423">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-424'
	>
	In the snippet below, we have defined a Service interface that lists all the endpoints we want to call from API.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-428"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-426">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-427'
	>
	It is passed to the Retrofit builder, it generates code for GET, etc. You know the drill.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-430"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">interface</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Service</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #24292e;">Call</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">User</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">getUser</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-433"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-431">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-432'
	>
	However, often when working on a project in collaboration with a backend team, you may encounter some difficulties that can affect the further development process.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-436"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-434">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-435'
	>
	Some of those problems are API-related issues such as delayed API development, often API changes, or current API inactivity.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-439"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-437">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-438'
	>
	At the same time, the ability to check whether your code covers all the possible responses or how your app behaves in case of different response duration can significantly improve the development process.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-444"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="blockquote block-blockquote__blockquote" data-id="es-440">
	
	<div class="blockquote__content">
		<i
	class="icon blockquote__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='blockquote-24' data-id='es-441'>
	<svg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-2.79685-.9568-5.37021-2.561-7.41062-.581.22951-1.0832.60583-1.5069 1.12898-.5132.60844-.7698 1.41969-.7698 2.43375v.07605h2.5789v5.59004h-5.6197v-5.01962c0-1.11547.154-2.06616.4619-2.85205.3336-.81125.757-1.48307 1.2702-2.01545.528-.52161 1.1175-.92155 1.7687-1.1998-2.0728-1.70651-4.7279-2.73128-7.6223-2.73128-6.62742 0-12 5.37258-12 12 0 6.6274 5.37258 12 12 12zm-3.53811-18.05347c-.30793.78589-.46189 1.73658-.46189 2.85205v5.01962h5.6197v-5.59004h-2.5789v-.07605c0-1.01406.2566-1.82531.7698-2.43375.5389-.63379 1.1804-1.05209 1.9245-1.2549v-2.28164c-.7441.07605-1.4626.25351-2.1555.53238-.6928.27887-1.3086.68449-1.84752 1.21688-.51321.53238-.9366 1.2042-1.27019 2.01545z' fill='currentColor' fill-rule='evenodd'/></svg></i><p	class='typography typography--size-36-text js-typography blockquote__quote'
	data-id='es-442'
	>
	Retromock is a Java library for mocking responses in a Retrofit service that aims to cover as many potentially problematic cases in the future as possible.</p>
		<div class="blockquote__caption-wrap">
					</div>
	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-447"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-445">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-446'
	>
	Retromock to the rescue</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-450"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-448">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-449'
	>
	<a href="https://github.com/infinum/Retromock">Retromock</a> adapts a Java interface created by Retrofit using annotations on declared methods to define response mocks.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-453"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-451">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-452'
	>
	Setting it up is very simple and can be done in the following steps:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-456"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="lists" data-id="es-454">
	<ul	class='typography typography--size-16-text-roman js-typography lists__typography'
	data-id='es-455'
	>
	<li>Add dependency</li></ul></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-458"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-groovy github-light" data-language="groovy" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">implementation </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">co.infinum:retromock:1.1.0</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-461"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="lists" data-id="es-459">
	<ul	class='typography typography--size-16-text-roman js-typography lists__typography'
	data-id='es-460'
	>
	<li>Initialize</li></ul></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-463"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #24292e;">Retromock</span><span class="token"> </span><span class="token" style="color: #24292e;">retromock</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #d73a49;">new</span><span class="token"> Retromock</span><span class="token">.</span><span class="token" style="color: #6f42c1;">Builder</span><span class="token">(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">retrofit</span><span class="token">(</span><span class="token">retrofit</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">build</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-466"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="lists" data-id="es-464">
	<ul	class='typography typography--size-16-text-roman js-typography lists__typography'
	data-id='es-465'
	>
	<li>Create a service class</li></ul></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-468"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #24292e;">Service</span><span class="token"> </span><span class="token" style="color: #24292e;">service</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #24292e;">retromock</span><span class="token">.</span><span class="token" style="color: #6f42c1;">create</span><span class="token">(</span><span class="token" style="color: #24292e;">Service</span><span class="token">.</span><span class="token" style="color: #24292e;">class</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-471"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-469">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-470'
	>
	Recipes</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-474"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-472">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-473'
	>
	In the following chapters, you’ll find the list of recipes that shows how to solve common problems with Retromock.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-477"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-475">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-476'
	>
	Feel free to clone the project and try them out. Make sure that you understand how they work.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-480"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-478">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-479'
	>
	Mock simple response</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-483"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-481">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-482'
	>
	Let your API service implement the <code>getUser</code> call. Keep in mind that in the following example there are no mocks yet. Mocks will be defined using annotations, as explained later.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-485"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">interface</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Service</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #24292e;">Call</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">User</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">getUser</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-488"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-486">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-487'
	>
	And your data class provided by the <code>getUser</code> call looks like this:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-490"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">User</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">  </span><span class="token">@</span><span class="token" style="color: #d73a49;">Json</span><span class="token">(</span><span class="token" style="color: #005cc5;">name</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">name</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">  </span><span class="token" style="color: #24292e;">String</span><span class="token"> </span><span class="token" style="color: #24292e;">name</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">  </span><span class="token">@</span><span class="token" style="color: #d73a49;">Json</span><span class="token">(</span><span class="token" style="color: #005cc5;">name</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">surname</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">  </span><span class="token" style="color: #24292e;">String</span><span class="token"> </span><span class="token" style="color: #24292e;">surname</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-493"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-491">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-492'
	>
	In this case, we use Moshi for serialization. It’s okay to use another serializer to configure Retrofit, because Retromock uses the same serializer as Retrofit under the hood. This means that a fully configured Retrofit instance is required for Retromock to work.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-496"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-494">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-495'
	>
	With Retromock, there is an easy way to mock a response using <code>@Mock</code> and <code>@MockResponse</code> annotations. <code>@Mock</code> annotation is used to specify that the method should be mocked. <code>@MockResponse</code> annotation is used to specify parameters for defining a mocked response.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-499"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-497">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-498'
	>
	You can find more details in <a href="https://github.com/infinum/Retromock/blob/master/SPECIFICATION.md">the specification</a>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-501"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">interface</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Service</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">Mock</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">MockResponse</span><span class="token">(</span><span class="token" style="color: #005cc5;">body</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">{</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">name</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">:</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">John</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">, </span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">surname</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">:</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">Smith</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">}</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #24292e;">Call</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">User</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">getUser</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-504"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-502">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-503'
	>
	Mock complex response</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-507"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-505">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-506'
	>
	Usually, the response is too complicated to fit nicely as an annotation parameter. With Retromock, it is possible to mock responses using JSON files. Here’s how to configure it to read responses from the resources directory.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-510"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-508">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-509'
	>
	<strong>smith.json</strong></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-512"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-json github-light" data-language="json" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #005cc5;">&quot;</span><span class="token" style="color: #005cc5;">name</span><span class="token" style="color: #005cc5;">&quot;</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">John</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">,</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #005cc5;">&quot;</span><span class="token" style="color: #005cc5;">surname</span><span class="token" style="color: #005cc5;">&quot;</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">Smith</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-515"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-513">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-514'
	>
	There are two steps to take in order to use this JSON resource file. First, we need to set <code>defaultBodyFactory</code> when initializing Retromock.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-518"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-516">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-517'
	>
	Use the following implementation to read JSON files from the resources directory:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-520"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">ResourceBodyFactory</span><span class="token"> </span><span class="token" style="color: #d73a49;">implements</span><span class="token"> </span><span class="token" style="color: #6f42c1;">BodyFactory</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">Override</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #24292e;">InputStream</span><span class="token"> </span><span class="token" style="color: #6f42c1;">create</span><span class="token">(</span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #24292e;">String</span><span class="token"> </span><span class="token" style="color: #e36209;">input</span><span class="token">)</span><span class="token"> </span><span class="token" style="color: #d73a49;">throws</span><span class="token"> </span><span class="token" style="color: #24292e;">IOException</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token" style="color: #d73a49;">new</span><span class="token"> </span><span class="token" style="color: #6f42c1;">FileInputStream</span><span class="token">(</span><span class="token">
</span></span><span class="line"><span class="token">     </span><span class="token" style="color: #24292e;">ResourceBodyFactory</span><span class="token">.</span><span class="token" style="color: #24292e;">class</span><span class="token">.</span><span class="token" style="color: #6f42c1;">getClassLoader</span><span class="token">(</span><span class="token">)</span><span class="token">.</span><span class="token" style="color: #6f42c1;">getResource</span><span class="token">(</span><span class="token">input</span><span class="token">)</span><span class="token">.</span><span class="token" style="color: #6f42c1;">getFile</span><span class="token">(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-523"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-521">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-522'
	>
	Basically, it defines where the JSON resource is located so that Retromock can read it. <code>DefaultBodyFactory</code> needs to be set. By doing that, Retromock will by default read the responses using that class.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-526"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-524">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-525'
	>
	In our example, it means the response body will be read from the file in the resource directory, which is called the same as the value of the body parameter of the <code>@MockResponse</code> annotation set.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-528"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">val </span><span class="token">retromock</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Retromock</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> Retromock</span><span class="token">.Builder</span><span class="token">()
</span></span><span class="line"><span class="token">       </span><span class="token">.retrofit</span><span class="token">(retrofit)
</span></span><span class="line"><span class="token">       </span><span class="token">.defaultBodyFactory</span><span class="token">(</span><span class="token">ResourceBodyFactory</span><span class="token">())
</span></span><span class="line"><span class="token">       </span><span class="token">.build</span><span class="token">()
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-531"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-529">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-530'
	>
	Next, we need to reference the wanted response from the annotation.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-533"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">@</span><span class="token" style="color: #d73a49;">Mock</span><span class="token">
</span></span><span class="line"><span class="token">@</span><span class="token" style="color: #d73a49;">MockResponse</span><span class="token">(</span><span class="token" style="color: #005cc5;">body</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #24292e;">Call</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">User</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">getUser</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-536"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-534">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-535'
	>
	If you want to keep both options – simple responses, and responses from the resource, you can use the parameter <code>bodyFactory</code> from the <code>@MockResponse</code> annotation.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-538"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">@</span><span class="token" style="color: #d73a49;">MockResponse</span><span class="token">(</span><span class="token" style="color: #005cc5;">bodyFactory</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> ResourceBodyFactory</span><span class="token" style="color: #d73a49;">:</span><span class="token" style="color: #d73a49;">:</span><span class="token">class</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #005cc5;">body</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-541"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-539">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-540'
	>
	Mock Headers</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-544"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-542">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-543'
	>
	With Retromock, it is also possible to mock response headers. Take a look at the following example.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-546"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">interface</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Service</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">Mock</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">MockResponse</span><span class="token">(</span><span class="token" style="color: #005cc5;">body</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #005cc5;">headers</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token">@</span><span class="token" style="color: #d73a49;">MockHeader</span><span class="token">(</span><span class="token" style="color: #005cc5;">name</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">customHeader</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #005cc5;">value</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">user Smith</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">,</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token">@</span><span class="token" style="color: #d73a49;">MockHeader</span><span class="token">(</span><span class="token" style="color: #005cc5;">name</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">Server</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #005cc5;">value</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">google.com</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">}</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #24292e;">Call</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">User</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">getUser</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-549"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-547">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-548'
	>
	Mock response code</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-552"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-550">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-551'
	>
	Response code can be set using the parameter code:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-554"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Mock</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #6f42c1;">@MockResponse</span><span class="token">(code </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">400</span><span class="token">)
</span></span><span class="line"><span class="token" style="color: #6f42c1;">@GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token">Call</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">User</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> </span><span class="token">getOtherUser</span><span class="token">();
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-557"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-555">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-556'
	>
	Mock with body factory not defined</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-560"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-558">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-559'
	>
	If you set a custom default body factory and do not declare a <code>bodyFactory</code> parameter in <code>@MockResponse</code> annotation, your body factory will be called with the value of body parameter. That also applies if you don’t specifically set a body, like in the example above – in that case, body is empty by default.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-563"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-561">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-562'
	>
	If you prefer not to handle the case of empty body, wrap your default body factory into <code>NonEmptyBodyFactory</code> class as follows:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-565"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">Retromock retromock </span><span class="token" style="color: #d73a49;">=</span><span class="token"> new Retromock</span><span class="token">.Builder</span><span class="token">()
</span></span><span class="line"><span class="token"> </span><span class="token">.retrofit</span><span class="token">(retrofit)
</span></span><span class="line"><span class="token"> </span><span class="token">.defaultBodyFactory</span><span class="token">(new </span><span class="token">NonEmptyBodyFactory</span><span class="token">(new </span><span class="token">ResourceBodyFactory</span><span class="token">()))
</span></span><span class="line"><span class="token"> </span><span class="token">.build</span><span class="token">();
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-568"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-566">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-567'
	>
	Mock delays</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-571"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-569">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-570'
	>
	When working with network calls, we should adjust our code to expect possible delays or do something after a specified timeout. With Retromock, we can prepare for both.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-574"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-572">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-573'
	>
	To mock an immediate response, initialize Retromock in the following way:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-576"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #24292e;">Retromock</span><span class="token"> </span><span class="token" style="color: #24292e;">retromock</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #d73a49;">new</span><span class="token"> Retromock</span><span class="token">.</span><span class="token" style="color: #6f42c1;">Builder</span><span class="token">(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">retrofit</span><span class="token">(</span><span class="token">retrofit</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">defaultBehavior</span><span class="token">(</span><span class="token">(</span><span class="token">)</span><span class="token"> </span><span class="token" style="color: #d73a49;">-&gt;</span><span class="token"> </span><span class="token" style="color: #005cc5;">0</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">defaultBodyFactory</span><span class="token">(</span><span class="token" style="color: #d73a49;">new</span><span class="token"> </span><span class="token" style="color: #6f42c1;">ResourceBodyFactory</span><span class="token">(</span><span class="token">)</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">.</span><span class="token" style="color: #6f42c1;">build</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-579"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-577">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-578'
	>
	<code>defaultBehaviour(()-&gt;0)</code> will initialize behavior that waits 0ms before returning a mocked response.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-582"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-580">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-581'
	>
	We can achieve the same thing using <code>MockBehaviour</code> annotation:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-584"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@MockBehavior</span><span class="token">(durationMillis </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">0</span><span class="token">, durationDeviation </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">0</span><span class="token">)
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-587"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-585">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-586'
	>
	Mocking delays can be done by setting <code>durationMillis</code> and <code>durationDeviation</code> parameters.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-590"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-588">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-589'
	>
	<code>durationMillis</code> defines a delay value in milliseconds and durationDeviation defines a deviation from that value. Basically, those two parameters define a delay range of <code>durationMillis+-durationDeviation</code>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-593"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-591">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-592'
	>
	Here’s an example:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-595"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@MockBehavior</span><span class="token">(durationMillis </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">1000</span><span class="token">, durationDeviation </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">500</span><span class="token">)
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-598"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-596">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-597'
	>
	This would produce a random delay in range [500, 1500&gt;.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-601"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-599">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-600'
	>
	Compatibility with coroutines</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-604"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-602">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-603'
	>
	Since Retrofit is adjusted to support coroutines for asynchronous calls, similar adjustments are done to Retromock.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-607"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-605">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-606'
	>
	So it is possible to write something like this:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-609"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">interface Service </span><span class="token">{
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@MockResponse</span><span class="token">(body </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@Mock</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #d73a49;">suspend</span><span class="token"> </span><span class="token">fun getCoroutineUser</span><span class="token">()</span><span class="token">: </span><span class="token" style="color: #6f42c1;">User</span><span class="token">?
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@MockResponse</span><span class="token">(body </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #6f42c1;">@Mock</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #d73a49;">suspend</span><span class="token"> </span><span class="token">fun getCoroutineUserWithResponse</span><span class="token">()</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Response</span><span class="token">&lt;</span><span class="token" style="color: #6f42c1;">User</span><span class="token">&gt;
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-612"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-610">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-611'
	>
	Mock multiple responses</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-615"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-613">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-614'
	>
	Sometimes, two consecutive calls can give two different responses, either with different data or completely different. One such instance is doing a search for some user with different filters.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-618"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-616">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-617'
	>
	We can easily mock such behavior simply by defining multiple mock response annotations.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-620"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token">interface Service </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #6f42c1;">@Mock</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #6f42c1;">@MockResponse</span><span class="token">(body </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">smith.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #6f42c1;">@MockResponse</span><span class="token">(body </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">doe.json</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #6f42c1;">@GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)
</span></span><span class="line"><span class="token"> Call</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">User</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> </span><span class="token">getUser</span><span class="token">();
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-623"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-621">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-622'
	>
	That’s all the set up there is.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-626"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-624">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-625'
	>
	The first time when you trigger the <code>getUser</code> call, you’ll get a response defined with smith.json resource. The second time you trigger the <code>getUser</code> call, you’ll get a response defined with doe.json.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-629"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-627">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-628'
	>
	Additionally, there is a way to mock an indefinite number of responses in three ways: default, circular, or random. By default, mocked calls will always return the last response, in this case, doe.json.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-632"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-630">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-631'
	>
	Let’s use an example with smith.json and doe.json to explain circular and random behavior. Also, we’ll call <code>getUser</code> 5 times to show the result.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-635"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-633">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-634'
	>
	<code>@MockCircular</code></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-637"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-yaml github-light" data-language="yaml" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">D</span><span class="token" style="color: #032f62;">oe.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">D</span><span class="token" style="color: #032f62;">oe.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-640"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-638">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-639'
	>
	<code>@MockRandom</code> – one possible outcome. As the name says, responses are chosen at random.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-642"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-yaml github-light" data-language="yaml" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">D</span><span class="token" style="color: #032f62;">oe.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">D</span><span class="token" style="color: #032f62;">oe.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #032f62;">S</span><span class="token" style="color: #032f62;">mith.json</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-645"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-643">
	<h3	class='typography typography--size-36-text js-typography block-heading__heading'
	data-id='es-644'
	>
	Mock responses with similar JSON properties</h3></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-648"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-646">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-647'
	>
	Let’s say we use our <code>&amp;#8221;{\&amp;#8221;name\&amp;#8221;:\&amp;#8221;John\&amp;#8221;, \&amp;#8221;surname\&amp;#8221;:\&amp;#8221;Smith\&amp;#8221;}&amp;#8221;</code> as a response body. We also want to mock multiple responses, but with different first and last names. Everything else in possibly a huge response mock should stay the same.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-651"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-649">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-650'
	>
	For those cases, we can implement custom <code>BodyFactory</code>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-653"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">CustomBuildBodyFactory</span><span class="token"> </span><span class="token" style="color: #d73a49;">implements</span><span class="token"> </span><span class="token" style="color: #6f42c1;">BodyFactory</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">Override</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #24292e;">InputStream</span><span class="token"> </span><span class="token" style="color: #6f42c1;">create</span><span class="token">(</span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #24292e;">String</span><span class="token"> </span><span class="token" style="color: #e36209;">input</span><span class="token">)</span><span class="token"> </span><span class="token" style="color: #d73a49;">throws</span><span class="token"> </span><span class="token" style="color: #24292e;">IOException</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #d73a49;">String</span><span class="token">[</span><span class="token">]</span><span class="token"> </span><span class="token" style="color: #24292e;">args</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #24292e;">input</span><span class="token">.</span><span class="token" style="color: #6f42c1;">split</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #005cc5;">\\</span><span class="token" style="color: #032f62;">.</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token" style="color: #d73a49;">new</span><span class="token"> </span><span class="token" style="color: #6f42c1;">ByteArrayInputStream</span><span class="token">(</span><span class="token">
</span></span><span class="line"><span class="token">     </span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">{</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">name</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">:</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">&quot;</span><span class="token"> </span><span class="token" style="color: #d73a49;">+</span><span class="token"> args</span><span class="token">[</span><span class="token" style="color: #005cc5;">0</span><span class="token">]</span><span class="token"> </span><span class="token" style="color: #d73a49;">+</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">, </span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">surname</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">:</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">&quot;</span><span class="token"> </span><span class="token" style="color: #d73a49;">+</span><span class="token"> args</span><span class="token">[</span><span class="token" style="color: #005cc5;">1</span><span class="token">]</span><span class="token"> </span><span class="token" style="color: #d73a49;">+</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #005cc5;">\&quot;</span><span class="token" style="color: #032f62;">}</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">       </span><span class="token">.</span><span class="token" style="color: #6f42c1;">getBytes</span><span class="token">(</span><span class="token" style="color: #24292e;">StandardCharsets</span><span class="token">.</span><span class="token" style="color: #24292e;">UTF_8</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-655"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">interface</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Service</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">Mock</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">MockResponse</span><span class="token">(</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #005cc5;">body</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">John.Doe</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">,</span><span class="token">
</span></span><span class="line"><span class="token">   </span><span class="token" style="color: #005cc5;">bodyFactory</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #24292e;">CustomBuildBodyFactory</span><span class="token">.</span><span class="token" style="color: #24292e;">class</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token">@</span><span class="token" style="color: #d73a49;">GET</span><span class="token">(</span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">/</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token"> </span><span class="token" style="color: #24292e;">Call</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">SpecificBodyFactory</span><span class="token">.</span><span class="token" style="color: #d73a49;">User</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #6f42c1;">userMockedDirectlyInAnnotation</span><span class="token">(</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-658"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-656">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-657'
	>
	Complete control of mocked API with Retromock</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-661"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-659">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-660'
	>
	There are many use cases where you can use Retromock to mock Retrofit calls. With possibilities from mocking simple or complex responses, headers or bodies to delays or multiple responses and more, Retromock provides complete control of the mocked API.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-664"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-662">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-663'
	>
	Most used mock recipes are explained in this article, but feel free to check out <a href="https://github.com/infinum/Retromock/blob/master/SPECIFICATION.md">the specification</a> and the source code for more details.</p></div>	</div>
</div>
</div>		</div>
	</div><p>The post <a href="https://infinum.com/blog/retromock-retrofit-calls/">Introducing Retromock, a Better Way to Mock Retrofit API Calls</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</content:encoded>
			</item>
					<item>
				<image>
					<url>7946https://infinum.com/uploads/2020/05/how-to-optimize-dagger-module-0.webp</url>
				</image>
				<title>How to Optimize Dagger Module</title>
				<link>https://infinum.com/blog/how-to-optimize-dagger-module/</link>
				<pubDate>Fri, 22 May 2020 15:38:00 +0000</pubDate>
				<dc:creator>Branimir Akmadža</dc:creator>
				<guid isPermaLink="false">https://infinum.com/the-capsized-eight/how-to-optimize-dagger-module/</guid>
				<description>
					<![CDATA[<p>Make small changes in the code to shorten the build time consumed by dependency injection. Ready?</p>
<p>The post <a href="https://infinum.com/blog/how-to-optimize-dagger-module/">How to Optimize Dagger Module</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</description>
				<content:encoded>
					<![CDATA[<div
	class="wrapper"
	data-id="es-862"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-667">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-670"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-668">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-669'
	>
	Do you know why Android developers learn JS? Because they need something to do while <a href="https://infinum.com/blog/i-cheated-on-android-with-javascript-and-my-boss-approved/">waiting for the app to build</a>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-673"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-671">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-672'
	>
	If you are an Android developer, you are most probably familiar with experiencing long build times. Long build times slow down your development process, and nobody likes it.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-676"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-674">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-675'
	>
	Especially in situations when you are debugging some nasty bug, you don’t want to wait until your focus on a solution is gone.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-679"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-677">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-678'
	>
	An alternative solution to learning JS</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-682"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-680">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-681'
	>
	A lot of build time is consumed by annotation processor tools of some kind. A big part of that build time consumption is used by dependency injection.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-685"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-683">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-684'
	>
	Since Dagger is the most popular dependency injector and is used in most modern projects, it made sense to take a deeper look and see if we can somehow optimize it.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-688"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-686">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-687'
	>
	It turned out that making a simple change can significantly improve build time.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-691"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-689">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-690'
	>
	Use @Binds instead of @Provides</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-694"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-692">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-693'
	>
	To understand why this is an improvement, we need to take a look at the code that is being generated when using <code>@Provides</code> method.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-697"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-695">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-696'
	>
	For this purpose, I have created a simple example, <code>HelpersModule</code> which provides <code>StringManager</code>. <code>StringManager</code> is simply a helper object used to provide you strings in presenters or view models without directly exposing Context.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-700"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-698">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-699'
	>
	But back to the Dagger, take a look at our <code>HelpersModule</code>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-702"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token">class HelpersModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Provides</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> </span><span class="token">fun stringProvider</span><span class="token">(context</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Context</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token">StringManagerImpl</span><span class="token">(context.resources)
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-705"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-703">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-704'
	>
	We have annotated a method that gives us a concrete implementation of a wanted object using <code>@Provides</code> annotation, sounds good right?</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-708"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-706">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-707'
	>
	Actually, it is a bit more than this. Under the hood, Dagger needs to generate a completely new factory class for this.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-711"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-709">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-710'
	>
	Take a look:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-713"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-java github-light" data-language="java" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">HelpersModule_StringProviderFactory</span><span class="token"> </span><span class="token" style="color: #d73a49;">implements</span><span class="token"> </span><span class="token" style="color: #6f42c1;">Factory</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">StringManager</span><span class="token">&gt;</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #24292e;">HelpersModule</span><span class="token"> </span><span class="token" style="color: #24292e;">module</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token" style="color: #24292e;">Provider</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">Context</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #24292e;">contextProvider</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #6f42c1;">HelpersModule_StringProviderFactory</span><span class="token">(</span><span class="token" style="color: #24292e;">HelpersModule</span><span class="token"> </span><span class="token" style="color: #e36209;">module</span><span class="token">,</span><span class="token" style="color: #24292e;">Provider</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">Context</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #e36209;">contextProvider</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.</span><span class="token" style="color: #24292e;">module</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> module</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.</span><span class="token" style="color: #24292e;">contextProvider</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> contextProvider</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">@</span><span class="token" style="color: #d73a49;">Override</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #24292e;">StringManager</span><span class="token"> </span><span class="token" style="color: #6f42c1;">get</span><span class="token">(</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token" style="color: #6f42c1;">stringProvider</span><span class="token">(</span><span class="token">module</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #24292e;">contextProvider</span><span class="token">.</span><span class="token" style="color: #6f42c1;">get</span><span class="token">(</span><span class="token">)</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">static</span><span class="token"> </span><span class="token" style="color: #24292e;">HelpersModule_StringProviderFactory</span><span class="token"> </span><span class="token" style="color: #6f42c1;">create</span><span class="token">(</span><span class="token" style="color: #24292e;">HelpersModule</span><span class="token"> </span><span class="token" style="color: #e36209;">module</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #24292e;">Provider</span><span class="token">&lt;</span><span class="token" style="color: #d73a49;">Context</span><span class="token">&gt;</span><span class="token"> </span><span class="token" style="color: #e36209;">contextProvider</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token" style="color: #d73a49;">new</span><span class="token"> </span><span class="token" style="color: #6f42c1;">HelpersModule_StringProviderFactory</span><span class="token">(</span><span class="token">module</span><span class="token">,</span><span class="token"> contextProvider</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">static</span><span class="token"> </span><span class="token" style="color: #24292e;">StringManager</span><span class="token"> </span><span class="token" style="color: #6f42c1;">stringProvider</span><span class="token">(</span><span class="token" style="color: #24292e;">HelpersModule</span><span class="token"> </span><span class="token" style="color: #e36209;">instance</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #24292e;">Context</span><span class="token"> </span><span class="token" style="color: #e36209;">context</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token" style="color: #24292e;">Preconditions</span><span class="token">.</span><span class="token" style="color: #6f42c1;">checkNotNull</span><span class="token">(</span><span class="token" style="color: #24292e;">instance</span><span class="token">.</span><span class="token" style="color: #6f42c1;">stringProvider</span><span class="token">(</span><span class="token">context</span><span class="token">)</span><span class="token">,</span><span class="token"> </span><span class="token" style="color: #032f62;">&quot;</span><span class="token" style="color: #032f62;">Cannot return null from a non-@Nullable @Provides method</span><span class="token" style="color: #032f62;">&quot;</span><span class="token">)</span><span class="token">;</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-716"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-714">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-715'
	>
	If you read this factory class line by line you can figure out more or less what is going on.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-719"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-717">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-718'
	>
	In simple words, it is nothing more than a Java representation of what we have taken for granted while writing <code>HelpersModule</code>. The main point is that <strong><code>provides</code> annotation will generate a class</strong>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-722"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-720">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-721'
	>
	Let’s try to write this identical thing using @Binds annotation:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-724"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token">interface HelpersModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token">fun stringProvider</span><span class="token">(stringManagerImpl</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManagerImpl</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token">
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-727"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-725">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-726'
	>
	If you try to make a build now, you’ll see an expected error:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-729"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">error</span><span class="token">: </span><span class="token">[Dagger</span><span class="token" style="color: #d73a49;">/</span><span class="token">MissingBinding] android.content.res.Resources cannot be provided without an </span><span class="token" style="color: #6f42c1;">@Inject</span><span class="token"> constructor or an </span><span class="token" style="color: #6f42c1;">@Provides</span><span class="token" style="color: #d73a49;">-</span><span class="token">annotated method.
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-732"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-730">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-731'
	>
	We forgot to provide <code>Resources</code> object to <code>StringManager</code>. Let’s be naive and create a new <code>@Binds</code> annotated method which will provide resources.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-734"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token">interface HelpersModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token">fun resourcesProvider</span><span class="token">(context</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Context</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Resources</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> context.resources
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token">fun stringProvider</span><span class="token">(stringManagerImpl</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManagerImpl</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token">
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-737"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-735">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-736'
	>
	Here’s what happens:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-739"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">error</span><span class="token">: </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token"> methods’ parameter type must be assignable to the </span><span class="token" style="color: #d73a49;">return</span><span class="token"> type
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-742"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-740">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-741'
	>
	And that is exactly the difference between <code>@Provides</code> and <code>@Binds</code> annotations. <code>@Binds</code> annotation must be assignable to the return type. What does it mean?</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-745"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-743">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-744'
	>
	In order to enable the injection of some object that needs something itself, like <code>StringManager</code> needed Resources, we need to have all of these atomic objects provided somewhere.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-748"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-746">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-747'
	>
	In this example, we needed to provide resources using the <code>@Provides</code> annotated method.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-750"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #d73a49;">abstract</span><span class="token"> </span><span class="token">class HelpersModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Provides</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token">fun resourcesProvider</span><span class="token">(</span><span class="token" style="color: #6f42c1;">@AppContext</span><span class="token"> context</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Context</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Resources</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> context.resources
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">abstract</span><span class="token"> </span><span class="token">fun stringProvider</span><span class="token">(stringManagerImpl</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManagerImpl</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token">
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-753"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-751">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-752'
	>
	Notice how I had to change our interface into abstract class in order to keep the method that has implementation.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-756"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-754">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-755'
	>
	This should be fine now. Let’s make a build:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-758"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">error</span><span class="token">: </span><span class="token" style="color: #6f42c1;">A</span><span class="token"> </span><span class="token" style="color: #6f42c1;">@Module</span><span class="token"> may not contain both non</span><span class="token" style="color: #d73a49;">-</span><span class="token">static and </span><span class="token" style="color: #d73a49;">abstract</span><span class="token"> binding methods
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-761"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-759">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-760'
	>
	Ok, that is pretty much straightforward.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-764"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-762">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-763'
	>
	We can make the <code>resourcesProvider</code> method static or move it somewhere else. To keep the code clean, we need to separate different semantic entities.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-767"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-765">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-766'
	>
	For this purpose, I have used my ApplicationModule which should contain those atomic providers. I have put resourcesProvider there. So this is the final setup:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-769"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token">class ApplicationModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Provides</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@AppContext</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">fun provideApplicationContext</span><span class="token">(application</span><span class="token">: </span><span class="token" style="color: #6f42c1;">PlaygroundApp</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Context</span><span class="token"> </span><span class="token">{
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> application.applicationContext
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Provides</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">fun resourcesProvider</span><span class="token">(</span><span class="token" style="color: #6f42c1;">@AppContext</span><span class="token"> context</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Context</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">Resources</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> context.resources
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #6f42c1;">@Module</span><span class="token">
</span></span><span class="line"><span class="token">interface HelpersModule </span><span class="token">{
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Binds</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Singleton</span><span class="token"> 
</span></span><span class="line"><span class="token">    </span><span class="token">fun stringProvider</span><span class="token">(stringManagerImpl</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManagerImpl</span><span class="token">)</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token">
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-772"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-770">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-771'
	>
	After we have written this, let’s make a build.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-775"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-773">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-774'
	>
	It works!</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-778"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-776">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-777'
	>
	Now, we want to see generated class:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-780"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-783"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-781">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-782'
	>
	Correct. It does not exist.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-786"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-784">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-785'
	>
	Why?</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-789"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-787">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-788'
	>
	Because there is no need for it.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-792"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-790">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-791'
	>
	In compilation time, Dagger uses @Binds annotated methods to check if it can provide the wanted object and to find appropriate <code>Provider</code>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-795"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-793">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-794'
	>
	Like always, let’s take a look under the hood. So, I have injected <code>StringManager</code> into <code>DashboardViewModel</code>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-797"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">class DashboardViewModel </span><span class="token" style="color: #6f42c1;">@Inject</span><span class="token"> </span><span class="token">constructor</span><span class="token">(
</span></span><span class="line"><span class="token">    stringManager</span><span class="token">: </span><span class="token" style="color: #6f42c1;">StringManager</span><span class="token">
</span></span><span class="line"><span class="token">) </span><span class="token">: </span><span class="token" style="color: #6f42c1;">BaseViewModel</span><span class="token">&lt;</span><span class="token" style="color: #6f42c1;">Nothing</span><span class="token">, </span><span class="token" style="color: #6f42c1;">DashboardEvent</span><span class="token">&gt;</span><span class="token">() {
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-800"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-798">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-799'
	>
	Dagger needs a factory for this view model. The generated class looks like this:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-802"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token">class DashboardViewModel_Factory </span><span class="token">implements </span><span class="token">Factory</span><span class="token">&lt;</span><span class="token" style="color: #6f42c1;">DashboardViewModel</span><span class="token">&gt;</span><span class="token"> </span><span class="token">{
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> Provider</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">StringManager</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> stringManagerProvider;
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token">DashboardViewModel_Factory</span><span class="token">(Provider</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">StringManager</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> stringManagerProvider) {
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.stringManagerProvider </span><span class="token" style="color: #d73a49;">=</span><span class="token"> stringManagerProvider;
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #6f42c1;">@Override</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> DashboardViewModel </span><span class="token" style="color: #d73a49;">get</span><span class="token">() {
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> new </span><span class="token">DashboardViewModel</span><span class="token">(stringManagerProvider</span><span class="token">.get</span><span class="token">());
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> static DashboardViewModel_Factory </span><span class="token">create</span><span class="token">(Provider</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">StringManager</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> stringManagerProvider) {
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> new </span><span class="token">DashboardViewModel_Factory</span><span class="token">(stringManagerProvider);
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">public</span><span class="token"> static DashboardViewModel </span><span class="token">newInstance</span><span class="token">(StringManager stringManager) {
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> new </span><span class="token">DashboardViewModel</span><span class="token">(stringManager);
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-805"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-803">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-804'
	>
	As you can see, <code>Provider&lt;StringManager&gt;</code> is all that was needed.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-808"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-806">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-807'
	>
	Maybe you think, “Ok, what did we accomplish here?”.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-811"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-809">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-810'
	>
	Very soon, this view model will need many other objects. We will still have one generated factory class. Inside that factory, each injected object will have its <code>Provider&lt;T&gt;</code>. And none of the objects annotated with <code>@Binds</code> annotation will need to have their own generated factory class.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-814"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-812">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-813'
	>
	In large-scale projects, this makes a difference. Generating files is what really is consuming <strong>build time</strong>.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-817"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-815">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-816'
	>
	If you are still wondering where to find <code>Provider&lt;StringManager&gt;</code> and how it is linked to this factory, let’s take a look at the generated <code>DaggerAppComponent</code> class.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-819"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-kotlin github-light" data-language="kotlin" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">public</span><span class="token"> </span><span class="token" style="color: #d73a49;">final</span><span class="token"> </span><span class="token">class DaggerAppComponent </span><span class="token">implements </span><span class="token">AppComponent </span><span class="token">{  
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> Provider</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">Resources</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> resourcesProvider;  
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> Provider</span><span class="token" style="color: #d73a49;">&lt;</span><span class="token">StringManagerImpl</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> stringManagerImplProvider;
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> void </span><span class="token">initialize</span><span class="token">(</span><span class="token" style="color: #d73a49;">final</span><span class="token"> ApplicationModule applicationModuleParam,  
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">final</span><span class="token"> ApiModule apiModuleParam, </span><span class="token" style="color: #d73a49;">final</span><span class="token"> PlaygroundApp applicationParam) {
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.resourcesProvider </span><span class="token" style="color: #d73a49;">=</span><span class="token"> DoubleCheck</span><span class="token">.provider</span><span class="token">(ApplicationModule_ResourcesProviderFactory</span><span class="token">.create</span><span class="token">(applicationModuleParam, provideApplicationContextProvider));  
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.stringManagerImplProvider </span><span class="token" style="color: #d73a49;">=</span><span class="token"> StringManagerImpl_Factory</span><span class="token">.create</span><span class="token">(resourcesProvider);  
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">this</span><span class="token">.stringProvider </span><span class="token" style="color: #d73a49;">=</span><span class="token"> DoubleCheck</span><span class="token">.provider</span><span class="token">((Provider) stringManagerImplProvider);
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">    }
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">..</span><span class="token">.
</span></span><span class="line"><span class="token">}
</span></span><span class="line"><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-822"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-820">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-821'
	>
	<code>DaggerAppComponent</code> provides the implementation of all components listed in the <code>AppComponent</code> interface. The<code>DoubleCheck.provider</code> method simply returns a <code>Provider</code> that caches the value from the given delegate provider.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-825"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-823">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-824'
	>
	Use @Binds annotation wherever possible</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-828"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-826">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-827'
	>
	We talked about Dagger module optimization through code examples. I have tested this approach on one of our projects at Infinum.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-831"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-829">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-830'
	>
	I made the changes using three rules:</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-835"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-832">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-833'
	>
	1</p>	<div class="bullet__content">
		<p	class='typography typography--size-16-text-roman js-typography bullet__paragraph'
	data-id='es-834'
	>
	I have converted<code>@Binds</code><span style="color: var(--typography-color);font-family: var(--typography-font-family);font-size: var(--typography-font-size);font-weight: var(--typography-font-weight);letter-spacing: var(--typography-letter-spacing)"> to </span><code>@Provides</code><span style="color: var(--typography-color);font-family: var(--typography-font-family);font-size: var(--typography-font-size);font-weight: var(--typography-font-weight);letter-spacing: var(--typography-letter-spacing)"> annotation wherever possible.</span></p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-839"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-836">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-837'
	>
	2</p>	<div class="bullet__content">
		<p	class='typography typography--size-16-text-roman js-typography bullet__paragraph'
	data-id='es-838'
	>
	Whenever I could, <span style="color: var(--typography-color);font-family: var(--typography-font-family);font-size: var(--typography-font-size);font-weight: var(--typography-font-weight);letter-spacing: var(--typography-letter-spacing)">I changed class or abstract class into interface. Interface is convenient because it forces you to use </span><code>@Binds</code><span style="color: var(--typography-color);font-family: var(--typography-font-family);font-size: var(--typography-font-size);font-weight: var(--typography-font-weight);letter-spacing: var(--typography-letter-spacing)"> annotation.</span></p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-843"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="bullet bullet--left bullet__type--number bullet__color--black block-bullet__bullet" data-id="es-840">
	<p	class='typography typography--size-14-text js-typography bullet__dot'
	data-id='es-841'
	>
	3</p>	<div class="bullet__content">
		<p	class='typography typography--size-16-text-roman js-typography bullet__paragraph'
	data-id='es-842'
	>
	If there were some <span style="color: var(--typography-color);font-family: var(--typography-font-family);font-size: var(--typography-font-size);font-weight: var(--typography-font-weight);letter-spacing: var(--typography-letter-spacing)">methods that required implementation, I moved them into another module.</span></p>	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-848"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="blockquote block-blockquote__blockquote" data-id="es-844">
	
	<div class="blockquote__content">
		<i
	class="icon blockquote__icon icon--size-16 icon--scale-100"
	 aria-hidden='true' data-name='blockquote-24' data-id='es-845'>
	<svg fill='none' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='m12 24c6.6274 0 12-5.3726 12-12 0-2.79685-.9568-5.37021-2.561-7.41062-.581.22951-1.0832.60583-1.5069 1.12898-.5132.60844-.7698 1.41969-.7698 2.43375v.07605h2.5789v5.59004h-5.6197v-5.01962c0-1.11547.154-2.06616.4619-2.85205.3336-.81125.757-1.48307 1.2702-2.01545.528-.52161 1.1175-.92155 1.7687-1.1998-2.0728-1.70651-4.7279-2.73128-7.6223-2.73128-6.62742 0-12 5.37258-12 12 0 6.6274 5.37258 12 12 12zm-3.53811-18.05347c-.30793.78589-.46189 1.73658-.46189 2.85205v5.01962h5.6197v-5.59004h-2.5789v-.07605c0-1.01406.2566-1.82531.7698-2.43375.5389-.63379 1.1804-1.05209 1.9245-1.2549v-2.28164c-.7441.07605-1.4626.25351-2.1555.53238-.6928.27887-1.3086.68449-1.84752 1.21688-.51321.53238-.9366 1.2042-1.27019 2.01545z' fill='currentColor' fill-rule='evenodd'/></svg></i><p	class='typography typography--size-36-text js-typography blockquote__quote'
	data-id='es-846'
	>
	After applying those changes, I managed to reduce build time by 20%.</p>
		<div class="blockquote__caption-wrap">
					</div>
	</div>
</div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-851"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-849">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-850'
	>
	I have also counted generated files for both commit builds, and as expected, for each @Provides -&gt; @Binds conversion there was one generated file less.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-854"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-852">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-853'
	>
	One other benefit is that DaggerAppComponent generated less code.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-857"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-855">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-856'
	>
	All of this didn’t take more than 10 minutes.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-860"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-858">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-859'
	>
	TL;DR<br>Use <code>@Binds</code> instead of <code>@Provides</code> annotation wherever possible.</p></div>	</div>
</div>
</div>		</div>
	</div><p>The post <a href="https://infinum.com/blog/how-to-optimize-dagger-module/">How to Optimize Dagger Module</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</content:encoded>
			</item>
		
	</channel>
</rss>