Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvagni committed Nov 17, 2023
1 parent 265ad17 commit da2d566
Show file tree
Hide file tree
Showing 101 changed files with 398 additions and 436 deletions.
6 changes: 0 additions & 6 deletions .perttierrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2
}
11 changes: 4 additions & 7 deletions _snippets/browser/upload-attachment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ function uploadAttachment(fileBlob, uploadFormUrl, uploadFormData) {
form.append(key, value);
});

const file = new File([fileBlob], "file");
form.append("file", file);
const file = new File([fileBlob], 'file');
form.append('file', file);

console.log(`Uploading attachment to ${uploadFormUrl}`);

fetch(uploadFormUrl, {
method: "POST",
method: 'POST',
body: form,
})
.then((res) => {
Expand All @@ -28,10 +28,7 @@ function uploadAttachment(fileBlob, uploadFormUrl, uploadFormData) {
console.log(`File successfully uploaded! (code=${res.status})`);
})
.catch((err) => {
console.log(
`There was an error uploading the file: %s`,
err.message ? err.message : err,
);
console.log(`There was an error uploading the file: %s`, err.message ? err.message : err);
});
}
```
5 changes: 1 addition & 4 deletions _snippets/graphql/add-labels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ mutation addLabels($input: AddLabelsInput!) {
```json filename="Variables"
{
"input": {
"labelTypeIds": [
"lt_01HB8BTNTZ58730MX8H5VMKFD5",
"lt_01HB8BTNKSCF1FK5ETFVRSDC6G"
],
"labelTypeIds": ["lt_01HB8BTNTZ58730MX8H5VMKFD5", "lt_01HB8BTNKSCF1FK5ETFVRSDC6G"],
"threadId": "th_01H8H46YPB2S4MAJM382FG9423"
}
}
Expand Down
4 changes: 1 addition & 3 deletions _snippets/graphql/remove-customer-from-groups.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
```graphql filename="Mutation"
mutation removeCustomerFromCustomerGroup(
$input: RemoveCustomerFromCustomerGroupsInput!
) {
mutation removeCustomerFromCustomerGroup($input: RemoveCustomerFromCustomerGroupsInput!) {
removeCustomerFromCustomerGroups(input: $input) {
error {
message
Expand Down
10 changes: 5 additions & 5 deletions _snippets/node/upload-attachment.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```js
const axios = require("axios");
const FormData = require("form-data");
const axios = require('axios');
const FormData = require('form-data');

/**
* Upload an attachment.
Expand All @@ -15,15 +15,15 @@ function uploadAttachment(fileBuffer, uploadFormUrl, uploadFormData) {
form.append(key, value);
});

form.append("file", fileBuffer, { filename: "file" });
form.append('file', fileBuffer, { filename: 'file' });

console.log(`Uploading attachment to ${uploadFormUrl}`);

axios
.post(uploadFormUrl, form, {
headers: {
...form.getHeaders(),
"Content-Length": form.getLengthSync(),
'Content-Length': form.getLengthSync(),
},
})
.then((res) => {
Expand All @@ -32,7 +32,7 @@ function uploadAttachment(fileBuffer, uploadFormUrl, uploadFormData) {
.catch((err) => {
console.log(
`There was an error uploading the file: %s`,
err.response ? err.response.data : err,
err.response ? err.response.data : err
);
});
}
Expand Down
60 changes: 30 additions & 30 deletions _snippets/typescript-sdk/add-customer-to-group-response.mdx
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
```js
[
{
customerId: "c_01GTC6ZHCMAGR06FMPN9VY5J95",
customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95',
createdAt: {
__typename: "DateTime",
iso8601: "2023-06-21T14:20:12.014Z",
unixTimestamp: "1687357212014",
__typename: 'DateTime',
iso8601: '2023-06-21T14:20:12.014Z',
unixTimestamp: '1687357212014',
},
createdBy: {
__typename: "MachineUserActor",
machineUserId: "mu_01H1P0P0PHA2BJRRS7EC02XKCF",
__typename: 'MachineUserActor',
machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF',
},
updatedAt: {
__typename: "DateTime",
iso8601: "2023-06-21T14:20:12.014Z",
unixTimestamp: "1687357212014",
__typename: 'DateTime',
iso8601: '2023-06-21T14:20:12.014Z',
unixTimestamp: '1687357212014',
},
updatedBy: {
__typename: "MachineUserActor",
machineUserId: "mu_01H1P0P0PHA2BJRRS7EC02XKCF",
__typename: 'MachineUserActor',
machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF',
},
customerGroup: {
id: "cg_01H1P1RK22WTVMFRY8BX6S6VJX",
name: "free tier",
key: "free-tier",
color: "#E78450",
id: 'cg_01H1P1RK22WTVMFRY8BX6S6VJX',
name: 'free tier',
key: 'free-tier',
color: '#E78450',
},
},
{
customerId: "c_01GTC6ZHCMAGR06FMPN9VY5J95",
customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95',
createdAt: {
__typename: "DateTime",
iso8601: "2023-06-21T14:20:12.014Z",
unixTimestamp: "1687357212014",
__typename: 'DateTime',
iso8601: '2023-06-21T14:20:12.014Z',
unixTimestamp: '1687357212014',
},
createdBy: {
__typename: "MachineUserActor",
machineUserId: "mu_01H1P0P0PHA2BJRRS7EC02XKCF",
__typename: 'MachineUserActor',
machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF',
},
updatedAt: {
__typename: "DateTime",
iso8601: "2023-06-21T14:20:12.014Z",
unixTimestamp: "1687357212014",
__typename: 'DateTime',
iso8601: '2023-06-21T14:20:12.014Z',
unixTimestamp: '1687357212014',
},
updatedBy: {
__typename: "MachineUserActor",
machineUserId: "mu_01H1P0P0PHA2BJRRS7EC02XKCF",
__typename: 'MachineUserActor',
machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF',
},
customerGroup: {
id: "cg_01H1P1S2HD9PERNNS591ZT28ZZ",
name: "design partner",
key: "design-partner",
color: "#FBBF24",
id: 'cg_01H1P1S2HD9PERNNS591ZT28ZZ',
name: 'design partner',
key: 'design-partner',
color: '#FBBF24',
},
},
];
Expand Down
10 changes: 5 additions & 5 deletions _snippets/typescript-sdk/add-customer-to-group.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
```tsx
import { PlainClient } from "@team-plain/typescript-sdk";
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: "plainApiKey_xxx" });
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.addCustomerToCustomerGroups({
customerId: "c_01GTC6ZHCMAGR06FMPN9VY5J95",
customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95',
customerGroupIdentifiers: [
{
customerGroupKey: "free-tier",
customerGroupKey: 'free-tier',
},
{
customerGroupKey: "design-partner",
customerGroupKey: 'design-partner',
},
],
});
Expand Down
8 changes: 4 additions & 4 deletions _snippets/typescript-sdk/add-labels.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
```tsx
import { PlainClient } from "@team-plain/typescript-sdk";
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: "plainApiKey_xxx" });
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.addLabels({
labelTypeIds: ["lt_01HB8BTNVM7GEBKBEDNC2K8ST7"],
threadId: "th_01HD1G6649R1DK061W27VBT7QB",
labelTypeIds: ['lt_01HB8BTNVM7GEBKBEDNC2K8ST7'],
threadId: 'th_01HD1G6649R1DK061W27VBT7QB',
});

if (res.error) {
Expand Down
8 changes: 4 additions & 4 deletions _snippets/typescript-sdk/assign-thread.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
```tsx
import { PlainClient } from "@team-plain/typescript-sdk";
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: "XXX",
apiKey: 'XXX',
});

const res = await client.assignThread({
threadId: "th_01H8H46YPB2S4MAJM382FG9423",
userId: "u_01FSVKMHFDHJ3H5XFM20EMCBQN",
threadId: 'th_01H8H46YPB2S4MAJM382FG9423',
userId: 'u_01FSVKMHFDHJ3H5XFM20EMCBQN',

// You could instead assign to a machine user by doing:
// machineUserId: 'XXX'
Expand Down
10 changes: 5 additions & 5 deletions _snippets/typescript-sdk/create-attachment-url.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
```ts /c_XXXXXXXXXXXXXXXXXXXXXXXXXX/
import { AttachmentType, PlainClient } from "@team-plain/typescript-sdk";
import { AttachmentType, PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: "XXX" });
const client = new PlainClient({ apiKey: 'XXX' });

const res = await client.createAttachmentUploadUrl({
customerId: "c_XXXXXXXXXXXXXXXXXXXXXXXXXX",
fileName: "the-filename.jpeg",
customerId: 'c_XXXXXXXXXXXXXXXXXXXXXXXXXX',
fileName: 'the-filename.jpeg',
fileSizeBytes: 32318,
attachmentType: AttachmentType.CustomTimelineEntry,
});

if (res.error) {
console.error(res.error);
} else {
console.log("Attachment upload url created");
console.log('Attachment upload url created');
console.log(res.data);
}
```
20 changes: 10 additions & 10 deletions _snippets/typescript-sdk/create-customer-event.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
```tsx
import { PlainClient, uiComponent } from "@team-plain/typescript-sdk";
import { PlainClient, uiComponent } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: "XXX",
apiKey: 'XXX',
debug: true,
});

const res = await client.createCustomerEvent({
title: "API key generated",
title: 'API key generated',

customerIdentifier: {
// You can use the email:
email: "[email protected]",
email: '[email protected]',

// ...or if you set external id on customers:
// externalId: 'YOUR_ID',
Expand All @@ -22,26 +22,26 @@ const res = await client.createCustomerEvent({

components: [
uiComponent.text({
text: "New API key was added with the fingerprint **3b7896975ee9fd15eeb7** with 4 associated roles.",
text: 'New API key was added with the fingerprint **3b7896975ee9fd15eeb7** with 4 associated roles.',
}),
uiComponent.spacer({
size: "M",
size: 'M',
}),
uiComponent.linkButton({
label: "View in admin",
url: "https://admin.your-app.com",
label: 'View in admin',
url: 'https://admin.your-app.com',
}),
],

// Optional - if provided, this will ensure that this event can only
// be created once and fail on the second time. This external id acts
// as an idempotency key while also letting you correlate an event to
// something your systems.
externalId: "XXX",
externalId: 'XXX',

// Optional - if provided then the event will only be shown
// in a single thread vs all threads from a customer
threadId: "th_01HB924RWAW8H3Q8KZDFWYBJHZ",
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
});

if (res.error) {
Expand Down
10 changes: 5 additions & 5 deletions _snippets/typescript-sdk/create-thread.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
```tsx
import { PlainClient } from "@team-plain/typescript-sdk";
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: "XXX",
apiKey: 'XXX',
debug: true,
});

const res = await client.createThread({
title: "Bug Report",
title: 'Bug Report',
customerIdentifier: {
// You can use the email:
email: "[email protected]",
email: '[email protected]',

// ...or if you set external id on customers:
// externalId: '',
Expand All @@ -27,7 +27,7 @@ const res = await client.createThread({
],
// Label types are created in settings where you can also copy
// their ID.
labelTypeIds: ["lt_01HB924PME9C0YWKW1N4AK3BZA"],
labelTypeIds: ['lt_01HB924PME9C0YWKW1N4AK3BZA'],
});

if (res.error) {
Expand Down
6 changes: 3 additions & 3 deletions _snippets/typescript-sdk/delete-customer.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
```tsx
import { PlainClient } from "../client";
import { PlainClient } from '../client';

const client = new PlainClient({
apiKey: "XXX",
apiKey: 'XXX',
});

const res = await client.deleteCustomer({
customerId: "c_01H1P4TE62AS5KZ4CZFC0578ED",
customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED',
});

if (res.error) {
Expand Down
10 changes: 5 additions & 5 deletions _snippets/typescript-sdk/error-handling.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
```tsx {21}
import { PlainClient } from "../client";
import { PlainClient } from '../client';

export async function createCustomer() {
const client = new PlainClient({ apiKey: "XXX" });
const client = new PlainClient({ apiKey: 'XXX' });

const res = await client.upsertCustomer({
identifier: {
emailAddress: "[email protected]",
emailAddress: '[email protected]',
},
onCreate: {
fullName: "Jane Fargate",
fullName: 'Jane Fargate',
email: {
email: "[email protected]",
email: '[email protected]',
isVerified: true,
},
},
Expand Down
Loading

0 comments on commit da2d566

Please sign in to comment.