/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d14ccb94828b */ import { assert, expect, it, test } from "vitest"; import { Glean } from "../index.js"; import { RFCDate } from "../types/index.js"; import { createTestHTTPClient } from "./testclient.js"; test("Answers Createanswer", async () => { const testHttpClient = createTestHTTPClient("createanswer"); const glean = new Glean({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", }); const result = await glean.client.answers.create({ data: { question: "Why is the sky blue?", bodyText: "From https://en.wikipedia.org/wiki/Diffuse_sky_radiation, the sky is blue because blue light is more strongly scattered than longer-wavelength light.", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], addedRoles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", relatedDocuments: [ { querySuggestion: { query: "app:github type:pull author:mortimer", searchProviderInfo: { name: "Google", searchLinkUrlTemplate: "https://www.google.com/search?q={query}&hl=en", }, label: "Mortimer's PRs", datasource: "github", requestOptions: { datasourceFilter: "JIRA", datasourcesFilter: [ "JIRA", ], queryOverridesFacetFilters: true, facetFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], facetFilterSets: [ { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, ], facetBucketSize: 134365, authTokens: [ { accessToken: "123abc", datasource: "gmail", scope: "email profile https://www.googleapis.com/auth/gmail.readonly", tokenType: "Bearer", authUser: "1", }, ], }, ranges: [ { startIndex: 796474, document: { metadata: { datasource: "datasource", objectType: "Feature Request", container: "container", parentId: "JIRA_EN-1337", mimeType: "mimeType", documentId: "documentId", createTime: new Date("2000-01-23T04:56:07.000Z"), updateTime: new Date("2000-01-23T04:56:07.000Z"), components: [ "Backend", "Networking", ], status: "[\"Done\"]", pins: [ { audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], documentId: "", }, { audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], documentId: "", }, { audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], documentId: "", }, ], collections: [ { name: "", description: "fumigate convection though zowie", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], id: 496323, items: [ { collectionId: 782367, itemType: "DOCUMENT", }, ], }, ], interactions: { reacts: [ {}, {}, {}, ], shares: [ { numDaysAgo: 219974, }, { numDaysAgo: 449221, }, { numDaysAgo: 427887, }, ], }, verification: { state: "VERIFIED", metadata: { reminders: [ { assignee: { name: "George Clooney", obfuscatedId: "abc123", }, remindAt: 491427, }, ], lastReminder: { assignee: { name: "George Clooney", obfuscatedId: "abc123", }, remindAt: 490420, }, }, }, customData: { "someCustomField": {}, }, }, }, }, ], inputDetails: { hasCopyPaste: true, }, }, results: [ { title: "title", url: "https://example.com/foo/bar", nativeAppUrl: "slack://foo/bar", snippets: [ { mimeType: "mimeType", snippet: "snippet", }, ], }, ], }, { querySuggestion: { query: "app:github type:pull author:mortimer", searchProviderInfo: { name: "Google", searchLinkUrlTemplate: "https://www.google.com/search?q={query}&hl=en", }, label: "Mortimer's PRs", datasource: "github", requestOptions: { datasourceFilter: "JIRA", datasourcesFilter: [ "JIRA", ], queryOverridesFacetFilters: true, facetFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], facetFilterSets: [ { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, ], facetBucketSize: 45416, authTokens: [ { accessToken: "123abc", datasource: "gmail", scope: "email profile https://www.googleapis.com/auth/gmail.readonly", tokenType: "Bearer", authUser: "1", }, ], }, inputDetails: { hasCopyPaste: true, }, }, }, ], metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: { suggestions: [ { query: "app:github type:pull author:mortimer", label: "Mortimer's PRs", datasource: "github", }, ], }, inviteInfo: { invites: [ {}, ], }, customFields: [ { label: "", values: [ {}, {}, ], }, { label: "", values: [], }, ], badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "OWNER", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "VERIFIER", }, ], removedRoles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "VERIFIER", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "ANSWER_MODERATOR", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "OWNER", }, ], roles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "ANSWER_MODERATOR", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "OWNER", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "VERIFIER", }, ], combinedAnswerText: { text: "From https://en.wikipedia.org/wiki/Diffuse_sky_radiation, the sky is blue because blue light is more strongly scattered than longer-wavelength light.", }, }, }); expect(result).toBeDefined(); }); test("Answers Deleteanswer", async () => { const testHttpClient = createTestHTTPClient("deleteanswer"); const glean = new Glean({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", }); await glean.client.answers.delete({ id: 3, docId: "ANSWERS_answer_3", }); }); test("Answers Editanswer", async () => { const testHttpClient = createTestHTTPClient("editanswer"); const glean = new Glean({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", }); const result = await glean.client.answers.update({ id: 3, docId: "ANSWERS_answer_3", question: "Why is the sky blue?", bodyText: "From https://en.wikipedia.org/wiki/Diffuse_sky_radiation, the sky is blue because blue light is more strongly scattered than longer-wavelength light.", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], addedRoles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", relatedDocuments: [ { querySuggestion: { query: "app:github type:pull author:mortimer", searchProviderInfo: { name: "Google", searchLinkUrlTemplate: "https://www.google.com/search?q={query}&hl=en", }, label: "Mortimer's PRs", datasource: "github", requestOptions: { datasourceFilter: "JIRA", datasourcesFilter: [ "JIRA", ], queryOverridesFacetFilters: true, facetFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], facetFilterSets: [ { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, ], facetBucketSize: 149825, authTokens: [ { accessToken: "123abc", datasource: "gmail", scope: "email profile https://www.googleapis.com/auth/gmail.readonly", tokenType: "Bearer", authUser: "1", }, ], }, ranges: [ { startIndex: 700217, document: { metadata: { datasource: "datasource", objectType: "Feature Request", container: "container", parentId: "JIRA_EN-1337", mimeType: "mimeType", documentId: "documentId", createTime: new Date("2000-01-23T04:56:07.000Z"), updateTime: new Date("2000-01-23T04:56:07.000Z"), components: [ "Backend", "Networking", ], status: "[\"Done\"]", pins: [ { audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], documentId: "", }, { audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], documentId: "", }, ], collections: [ { name: "", description: "about huzzah institute violin aw pillow abnegate memorable", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], id: 384736, items: [ { collectionId: 670716, itemType: "URL", }, { collectionId: 793957, itemType: "URL", }, ], }, { name: "", description: "trouser twine because unnaturally card gallery among", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], id: 818393, }, { name: "", description: "zebra ugh exactly pfft once", audienceFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], id: 29269, }, ], interactions: { reacts: [ {}, {}, {}, ], shares: [ { numDaysAgo: 177137, }, { numDaysAgo: 127401, }, ], }, verification: { state: "UNVERIFIED", metadata: { reminders: [ { assignee: { name: "George Clooney", obfuscatedId: "abc123", }, remindAt: 843043, }, ], lastReminder: { assignee: { name: "George Clooney", obfuscatedId: "abc123", }, remindAt: 630893, }, }, }, customData: { "someCustomField": {}, }, }, }, }, ], inputDetails: { hasCopyPaste: true, }, }, results: [ { title: "title", url: "https://example.com/foo/bar", nativeAppUrl: "slack://foo/bar", snippets: [ { mimeType: "mimeType", snippet: "snippet", }, ], }, ], }, { querySuggestion: { query: "app:github type:pull author:mortimer", searchProviderInfo: { name: "Google", searchLinkUrlTemplate: "https://www.google.com/search?q={query}&hl=en", }, label: "Mortimer's PRs", datasource: "github", requestOptions: { datasourceFilter: "JIRA", datasourcesFilter: [ "JIRA", ], queryOverridesFacetFilters: true, facetFilters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], facetFilterSets: [ { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, { filters: [ { fieldName: "type", values: [ { value: "Spreadsheet", relationType: "EQUALS", }, { value: "Presentation", relationType: "EQUALS", }, ], }, ], }, ], facetBucketSize: 862908, authTokens: [ { accessToken: "123abc", datasource: "gmail", scope: "email profile https://www.googleapis.com/auth/gmail.readonly", tokenType: "Bearer", authUser: "1", }, ], }, inputDetails: { hasCopyPaste: true, }, }, }, ], metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: { suggestions: [ { query: "app:github type:pull author:mortimer", label: "Mortimer's PRs", datasource: "github", }, ], }, inviteInfo: { invites: [ {}, {}, {}, ], }, customFields: [ { label: "", values: [ {}, {}, ], }, ], badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "EDITOR", }, ], removedRoles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "EDITOR", }, ], roles: [ { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "ANSWER_MODERATOR", }, { person: { name: "George Clooney", obfuscatedId: "abc123", metadata: { type: "FULL_TIME", title: "Actor", department: "Movies", email: "george@example.com", location: "Hollywood, CA", phone: "6505551234", photoUrl: "https://example.com/george.jpg", startDate: new RFCDate("2000-01-23"), datasourceProfile: [ { datasource: "github", handle: "", }, ], querySuggestions: {}, inviteInfo: {}, badges: [ { key: "deployment_name_new_hire", displayName: "New hire", iconConfig: { color: "#343CED", key: "person_icon", iconType: "GLYPH", name: "user", }, }, ], }, }, role: "OWNER", }, ], combinedAnswerText: { text: "From https://en.wikipedia.org/wiki/Diffuse_sky_radiation, the sky is blue because blue light is more strongly scattered than longer-wavelength light.", }, }); expect(result).toBeDefined(); }); test("Answers Getanswer", async () => { const testHttpClient = createTestHTTPClient("getanswer"); const glean = new Glean({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", }); const result = await glean.client.answers.retrieve({ id: 3, docId: "ANSWERS_answer_3", }); expect(result).toBeDefined(); }); test("Answers Listanswers", async () => { const testHttpClient = createTestHTTPClient("listanswers"); const glean = new Glean({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", }); const result = await glean.client.answers.list({}); expect(result).toBeDefined(); }); it.skip("Answers Previewanswer", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step previewanswer.test referencing operation previewanswer not found in document`]", ); }); it.skip("Answers Previewanswerdraft", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step previewanswerdraft.test referencing operation previewanswerdraft not found in document`]", ); }); it.skip("Answers Updateanswerlikes", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step updateanswerlikes.test referencing operation updateanswerlikes not found in document`]", ); }); it.skip("Answers Createanswerboard", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step createanswerboard.test referencing operation createanswerboard not found in document`]", ); }); it.skip("Answers Deleteanswerboards", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step deleteanswerboards.test referencing operation deleteanswerboards not found in document`]", ); }); it.skip("Answers Editanswerboard", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step editanswerboard.test referencing operation editanswerboard not found in document`]", ); }); it.skip("Answers Getanswerboard", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step getanswerboard.test referencing operation getanswerboard not found in document`]", ); }); it.skip("Answers Listanswerboards", async () => { assert.fail( "incomplete test found please make sure to address the following errors: [`workflow step listanswerboards.test referencing operation listanswerboards not found in document`]", ); });