TITLE: What functors are classified by slices of $\infty$-categories?
QUESTION [11 upvotes]: Suppose I have a functor $f\colon C\to D$ between $\infty$-categories (I'll assume $C$ and $D$ are small.)  Then I can form the slice categories and restriction functors
$$
D_{f/}\to D\qquad \text{and} \qquad D_{/f}\to D.
$$
These maps are left fibrations and right fibrations, respectively.  By the theory of "straightening/unstraightening", these fibrations are classified by certain functors
$$
D\to \mathcal{S} \qquad\text{and} \qquad D^{\mathrm{op}} \to \mathcal{S}
$$
to the $\infty$-category $\mathcal{S}$ of $\infty$-groupoids.  This raises the question:
Q.  What are these functors?
Actually, it's pretty clear what the answer should be:
A.  They are inverse limits of (co)representable functors.
Explicitly, we should be able to describe these functors by
$$
d\mapsto \mathrm{lim}_{c\in C^{\mathrm{op}}}\operatorname{Map}_D(f(c),d)
\qquad \text{and}\qquad
d\mapsto \mathrm{lim}_{c\in C}\operatorname{Map}_D(d,f(c))
$$
respectively.  In the 1-categorical analogue this an elementary argument.  The case of $C=1$ (slices over objects, corresponding to (co)representable functors) is "well-known" (see 5.8 of Cisinski's Higher categories and homotopical algebra).
So my real question is:
Q'.  What is a proof or reference for this fact?

REPLY [5 votes]: I like Maxime's argument better, but here's another.
As you say, the case when $C=\bullet$ is well-known. But we can reduce to that case! The map $D_{/f} \to D$ is pulled back from $\mathsf{Fun}(C, D)_{/f} \to \mathsf{Fun}(C,D)$ along the diagonal map $D \to \mathsf{Fun}(C,D)$. Under (un)straightening, pulling back corresponds to precomposition, and the functor on $\mathsf{Fun}(C,D)$ represented by $f$ restricts to the functor you described.