Getting the repository ID

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

This lesson preview is part of the Fullstack React with TypeScript Masterclass course and can be unlocked immediately with a single-time purchase. Already have access to this course? Log in here.

This video is available to students only
Unlock This Course

Get unlimited access to Fullstack React with TypeScript Masterclass with a single-time purchase.

Thumbnail for the \newline course Fullstack React with TypeScript Masterclass
  • [00:00 - 00:08] Getting the repository ID. Before we move on to other resources, we'll create another shared query that will get the ID of the repository by its name.

    [00:09 - 00:19] We'll use this ID to get or create the issues and pull requests for the given repository. Create a new file, SRC queries get repository TS.

    [00:20 - 00:27] Inside of this file, we define the get repository query. Expert const get repository equals GQL.

    [00:28 - 00:34] Here we define the query query get repository. It receives an owner of type string.

    [00:35 - 00:40] It's required fields. We add an exclamation mark and name also a string and also required.

    [00:41 - 00:52] Then we expect to get the repository using the owner, owner argument and name field from the name argument. And for each repository, we're only interested in the ID field.

    [00:53 - 01:00] So passing the ID. Here we want to find the repository by the owner and the name of the repository .

    [01:01 - 01:06] And in the query, we specify that we only want the ID field. Run the code generator to get the types for the query.

    [01:07 - 01:23] You can copy the command from the text version of this lesson. We're running code gen generate, provide the path to the schema file, specify the target language, tag name that we should parse, options to add type name and where to add the global types.

    [01:24 - 01:38] Run the command and after it's done, make sure that you have the types folder with the types for this query. The query will contain the repository where we'll get the ID of type string and we'll need to pass the variables with fields owner and name.