# Brand

> Brand: how your product appears on the pages and emails NoClick sends for you, and the OAuth apps your users connect with.

## Brand

```typescript
class Brand
```

One per account; rendered on `/h/` pages and human emails. `oauth_apps` names your
own OAuth app per provider, as `{provider: secret id}`. `oauth_redirect_urls` has the
redirect URI to register with your app at every provider you can bring one for, as
`{provider: url}`: you need it to create the app, before it is named here.

| Attribute | Type | Description |
| --- | --- | --- |
| `name` | `string | null` |  |
| `logoUrl` | `string | null` |  |
| `color` | `string | null` |  |
| `supportUrl` | `string | null` |  |
| `emailFromName` | `string | null` |  |
| `raw` | `JsonObject` | The response JSON exactly as the API sent it. |
| `isDefault` | `boolean` | True while nothing is set (the defaults are shown). |
| `domain` | `string | null` | The host your approval, question and hand-off pages are served from; null: NoClick's. |
| `oauthApps` | `Record<string, string>` | Your own OAuth app per provider, as `{ provider: secret id }`. |
| `oauthRedirectUrls` | `Record<string, string>` | The redirect URI to register with your app at every provider you can bring one for, as `{ provider: url }`: you need it to create the app, before it is named in `oauthApps`. |

Types:

```typescript
type JsonObject = { [key: string]: unknown };
```

### Brand.reset

```typescript
static reset(options?: { client?: NoClick }): Promise<Brand>
```

Remove the account's brand: pages and emails go back to the defaults (returned, `isDefault` true).

Parameters:

- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: NoClick's default brand, with `is_default` `True`.

### Brand.get

```typescript
static get(options?: { client?: NoClick }): Promise<Brand>
```

Read the account's brand.

Parameters:

- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The brand your pages and emails show now; `is_default` is `True` while you haven't set one.

### Brand.set

```typescript
static set(fields: BrandFields, options?: { client?: NoClick }): Promise<Brand>
```

Replace the brand: fields left out are cleared. To change one field, use `update`.

Parameters:

- `fields` (`BrandFields`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The saved brand, with `color` lowercased and `is_default` `False`. A field you left out is now empty.

Types:

```typescript
interface BrandFields {
  name?: string | null;
  logoUrl?: string | null;
  /** The pages' accent, as `#RRGGBB` (or `#RGB`); kept as lowercase `#rrggbb`. */
  color?: string | null;
  supportUrl?: string | null;
  emailFromName?: string | null;
  /**
   * A domain your account holds (a `Domain` or its name, like `connect.acme.com`) that serves the
   * approval, question and hand-off pages NoClick shows your users, and that the emails bringing them
   * there link to (they come from NoClick's address under `emailFromName`; connect links stay on
   * NoClick's host for now). A bought domain gets its CNAME at once; a connected one lists the records
   * to add in its `records`: the CNAME, and a TXT that proves the name is yours. The domain's
   * `serves` then includes `brand`. `null` moves the pages back to NoClick's host.
   */
  domain?: string | Domain | null;
  /**
   * Your own OAuth app per provider (`google`, `slack`, `box`, ...): an account `Secret` (or its id
   * or name) holding `CLIENT_ID` and `CLIENT_SECRET`, so the consent screen names you. Register the
   * provider's `oauthRedirectUrls` entry with the app. Connect links made after it is set sign in
   * with it and each connection keeps (and refreshes on) the app it was made with, so connections
   * made before keep NoClick's until they're reconnected. On `update` only the providers named
   * change (links made after for one mapped to `null` sign in with NoClick's app), and
   * `oauthApps: null` removes them all.
   */
  oauthApps?: Record<string, SecretRef | null> | null;
}

/** A secret to pass: a `Secret`, its id, or its name (the user's own, else the account's). */
type SecretRef = string | Secret;
```

### Brand.update

```typescript
static update(
  fields: BrandFields,
  options?: { client?: NoClick },
): Promise<Brand>
```

Change only the fields you pass; the rest stay as they are. `null` clears a field. Before you've
set a brand, it changes NoClick's default one: the name stays `NoClick` until you give it yours.

Parameters:

- `fields` (`BrandFields`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The saved brand. A field you left out is unchanged.

Types:

```typescript
interface BrandFields {
  name?: string | null;
  logoUrl?: string | null;
  /** The pages' accent, as `#RRGGBB` (or `#RGB`); kept as lowercase `#rrggbb`. */
  color?: string | null;
  supportUrl?: string | null;
  emailFromName?: string | null;
  /**
   * A domain your account holds (a `Domain` or its name, like `connect.acme.com`) that serves the
   * approval, question and hand-off pages NoClick shows your users, and that the emails bringing them
   * there link to (they come from NoClick's address under `emailFromName`; connect links stay on
   * NoClick's host for now). A bought domain gets its CNAME at once; a connected one lists the records
   * to add in its `records`: the CNAME, and a TXT that proves the name is yours. The domain's
   * `serves` then includes `brand`. `null` moves the pages back to NoClick's host.
   */
  domain?: string | Domain | null;
  /**
   * Your own OAuth app per provider (`google`, `slack`, `box`, ...): an account `Secret` (or its id
   * or name) holding `CLIENT_ID` and `CLIENT_SECRET`, so the consent screen names you. Register the
   * provider's `oauthRedirectUrls` entry with the app. Connect links made after it is set sign in
   * with it and each connection keeps (and refreshes on) the app it was made with, so connections
   * made before keep NoClick's until they're reconnected. On `update` only the providers named
   * change (links made after for one mapped to `null` sign in with NoClick's app), and
   * `oauthApps: null` removes them all.
   */
  oauthApps?: Record<string, SecretRef | null> | null;
}

/** A secret to pass: a `Secret`, its id, or its name (the user's own, else the account's). */
type SecretRef = string | Secret;
```
