-
Notifications
You must be signed in to change notification settings - Fork 37
Add an endpoint consumer
Andrey edited this page Dec 15, 2023
·
1 revision
- Add a new class in
org.wordpress.android.fluxc.network.rest.*
with{LogicalName}RestClient
- Inject WooNetwork
@Inject constructor(private val wooNetwork: WooNetwork) {
- To generate an endpoint, go to
fluxc-processor/src/main/resources/*
. Rebuild the project - Now to do the request, using
wooNetwork
do something like
val url = WOOCOMMERCE.payments.connection_tokens.pathV3
val response = wooNetwork.executePostGsonRequest(
site = site,
path = url,
clazz = ConnectionTokenApiResponse::class.java
)
where ConnectionTokenApiResponse
is data class that uses gson
annotations
- Map response to
response.toWooPayload()
- Upstream do the caching if necessary in a class usually called
{LogicalName}Store