| 369 | } |
| 370 | |
| 371 | pub async fn upsert_link( |
| 372 | &self, |
| 373 | input: graphql::UpsertLinkInput, |
| 374 | ) -> Result<git::UpsertLinkResult> { |
| 375 | let add_parent_topic_id = if let Some(id) = &input.add_parent_topic_id { |
| 376 | Some(ExternalId::try_from(id)?) |
| 377 | } else { |
| 378 | None |
| 379 | }; |
| 380 | |
| 381 | git::UpsertLink { |
| 382 | add_parent_topic_id, |
| 383 | actor: self.viewer.to_owned(), |
| 384 | // FIXME: use id instead of prefix |
| 385 | repo_id: input.repo_id.try_into()?, |
| 386 | title: input.title, |
| 387 | url: input.url, |
| 388 | fetcher: Box::new(http::Fetcher), |
| 389 | } |
| 390 | .call(self.mutation()?, &self.redis) |
| 391 | } |
| 392 | |
| 393 | pub async fn upsert_session( |
| 394 | &self, |