# @maxim_mazurok/gapi.client.sourcerepo-v1

> TypeScript typings for Cloud Source Repositories API v1

Latest version **0.0.20240623** (published 2024-06-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @maxim_mazurok/gapi.client.sourcerepo-v1
pnpm add @maxim_mazurok/gapi.client.sourcerepo-v1
yarn add @maxim_mazurok/gapi.client.sourcerepo-v1
bun add @maxim_mazurok/gapi.client.sourcerepo-v1
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.20240623 |
| Published | 2024-06-25 |
| First published | 2022-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 42.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | Maxim Mazurok |

## Links

- npm: https://www.npmjs.com/package/@maxim_mazurok/gapi.client.sourcerepo-v1
- Repository: https://github.com/Maxim-Mazurok/google-api-typings-generator
- Homepage: https://github.com/Maxim-Mazurok/google-api-typings-generator#readme
- Issues: https://github.com/Maxim-Mazurok/google-api-typings-generator/issues
- npm.io page: https://npm.io/package/@maxim_mazurok/gapi.client.sourcerepo-v1

## Dependencies (2)

- [@types/gapi.client](https://npm.io/package/@types/gapi.client.md) *
- [@types/gapi.client.discovery-v1](https://npm.io/package/@types/gapi.client.discovery-v1.md) *

## Recent versions

- 0.0.20240623 (latest) — 2024-06-25
- 0.0.20240617 — 2024-06-18
- 0.0.20240610 — 2024-06-11
- 0.0.20240602 — 2024-06-04
- 0.0.20240520 — 2024-05-21
- 0.0.20240506 — 2024-05-07
- 0.0.20240429 — 2024-04-30
- 0.0.20240422 — 2024-04-23
- 0.0.20240415 — 2024-04-16
- 0.0.20240331 — 2024-04-01
- 0.0.20240324 — 2024-03-26
- 0.0.20240317 — 2024-03-18
- 0.0.20240311 — 2024-03-12
- 0.0.20240304 — 2024-03-05
- 0.0.20240228 — 2024-02-28
- … 61 more at https://npm.io/package/@maxim_mazurok/gapi.client.sourcerepo-v1/versions

## README

# TypeScript typings for Cloud Source Repositories API v1

Accesses source code repositories hosted by Google. Important: Cloud Source Repositories is scheduled for end of sales starting June 17, 2024. Customers who have enabled the API prior to this date will not be affected and can continue to use Cloud Source Repositories. Organizations or projects who have not previously enabled the API cannot use Cloud Source Repositories after this date. View Cloud Source Repositories documentation for more info.
For detailed description please check [documentation](https://cloud.google.com/source-repositories/docs).

## Installing

Install typings for Cloud Source Repositories API:

```
npm install @types/gapi.client.sourcerepo-v1 --save-dev
```

## Usage

You need to initialize Google API client in your code:

```typescript
gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});
```

Then load api client wrapper:

```typescript
gapi.client.load(
  'https://sourcerepo.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.sourcerepo
  }
);
```

```typescript
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('sourcerepo', 'v1', () => {
  // now we can use:
  // gapi.client.sourcerepo
});
```

Don't forget to authenticate your client before sending any request to resources:

```typescript
// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
    'https://www.googleapis.com/auth/cloud-platform',

    // Manage your source code repositories
    'https://www.googleapis.com/auth/source.full_control',

    // View the contents of your source code repositories
    'https://www.googleapis.com/auth/source.read_only',

    // Manage the contents of your source code repositories
    'https://www.googleapis.com/auth/source.read_write',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);
```

After that you can use Cloud Source Repositories API resources: <!-- TODO: make this work for multiple namespaces -->

```typescript
/*
Returns the Cloud Source Repositories configuration of the project.
*/
await gapi.client.sourcerepo.projects.getConfig({name: 'name'});

/*
Updates the Cloud Source Repositories configuration of the project.
*/
await gapi.client.sourcerepo.projects.updateConfig({name: 'name'});
```

---
_Source: https://npm.io/package/@maxim_mazurok/gapi.client.sourcerepo-v1 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
