Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions types/google-apps-script/google-apps-script.card-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,13 +831,19 @@ declare namespace GoogleAppsScript {
/**
* An enum that specifies the style for TextButton.
*
* TEXT is the default; it renders a simple text button with clear background.
* OUTLINED is the default; it renders a simple text button with clear background.
* FILLED buttons have a background color you can set with
* TextButton.setBackgroundColor(backgroundColor).
*
* To call an enum, you call its parent class, name, and property.
* For example, CardService.TextButtonStyle.OUTLINED.
*/
enum TextButtonStyle {
TEXT,
OUTLINED,
/** @deprecated DO NOT USE */ TEXT,
FILLED,
FILLED_TONAL,
BORDERLESS,
}
/**
* A input field widget that accepts text input.
Expand Down
17 changes: 13 additions & 4 deletions types/google-apps-script/google-apps-script.gmail.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ declare namespace GoogleAppsScript {
*/
replyTo?: string | undefined;
}
/**
* Options for a Gmail draft reply.
*/
interface GmailReplyOptions extends GmailAdvancedOptions {
/**
* The subject line for the reply draft (up to 250 characters).
*/
subject?: string | undefined;
}
/** alias to GmailAdvancedOptions */
type GmailDraftOptions = GmailAdvancedOptions;
/**
Expand Down Expand Up @@ -220,9 +229,9 @@ declare namespace GoogleAppsScript {
*/
interface GmailMessage {
createDraftReply(body: string): GmailDraft;
createDraftReply(body: string, options: GmailAdvancedOptions): GmailDraft;
createDraftReply(body: string, options: GmailReplyOptions): GmailDraft;
createDraftReplyAll(body: string): GmailDraft;
createDraftReplyAll(body: string, options: GmailAdvancedOptions): GmailDraft;
createDraftReplyAll(body: string, options: GmailReplyOptions): GmailDraft;
forward(recipient: string): GmailMessage;
forward(recipient: string, options: GmailAdvancedOptions): GmailMessage;
getAttachments(): GmailAttachment[];
Expand Down Expand Up @@ -264,9 +273,9 @@ declare namespace GoogleAppsScript {
interface GmailThread {
addLabel(label: GmailLabel): GmailThread;
createDraftReply(body: string): GmailDraft;
createDraftReply(body: string, options: GmailAdvancedOptions): GmailDraft;
createDraftReply(body: string, options: GmailReplyOptions): GmailDraft;
createDraftReplyAll(body: string): GmailDraft;
createDraftReplyAll(body: string, options: GmailAdvancedOptions): GmailDraft;
createDraftReplyAll(body: string, options: GmailReplyOptions): GmailDraft;
getFirstMessageSubject(): string;
getId(): string;
getLabels(): GmailLabel[];
Expand Down
52 changes: 52 additions & 0 deletions types/google-apps-script/test/google-apps-script-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,11 @@ CardService.newAction().setInteraction(CardService.Interaction.OPEN_DIALOG); //

CardService.newTextButton().setAltText("alt text"); // $ExpectType TextButton

CardService.newTextButton().setTextButtonStyle(CardService.TextButtonStyle.OUTLINED); // $ExpectType TextButton
CardService.newTextButton().setTextButtonStyle(CardService.TextButtonStyle.FILLED); // $ExpectType TextButton
CardService.newTextButton().setTextButtonStyle(CardService.TextButtonStyle.FILLED_TONAL); // $ExpectType TextButton
CardService.newTextButton().setTextButtonStyle(CardService.TextButtonStyle.BORDERLESS); // $ExpectType TextButton

CardService.newLinkPreview().setTitle("Smart chip title"); // $ExpectType LinkPreview

CardService.newDecoratedText(); // $ExpectType DecoratedText
Expand Down Expand Up @@ -1536,3 +1541,50 @@ function optionalFields() {
console.log("Found an element");
}
}

// GmailMessage.createDraftReply and createDraftReplyAll with subject option
function testGmailDraftReplyWithSubject() {
const message = GmailApp.getMessageById("message-id");
const thread = GmailApp.getThreadById("thread-id");

// Test GmailMessage.createDraftReply with subject option
message.createDraftReply("Reply body"); // $ExpectType GmailDraft
message.createDraftReply("Reply body", { subject: "Custom subject" }); // $ExpectType GmailDraft
// $ExpectType GmailDraft
message.createDraftReply("Reply body", {
subject: "Custom subject",
cc: "cc@example.com",
bcc: "bcc@example.com",
htmlBody: "<p>HTML reply</p>",
});

// Test GmailMessage.createDraftReplyAll with subject option
message.createDraftReplyAll("Reply all body"); // $ExpectType GmailDraft
message.createDraftReplyAll("Reply all body", { subject: "Custom subject for all" }); // $ExpectType GmailDraft
// $ExpectType GmailDraft
message.createDraftReplyAll("Reply all body", {
subject: "Custom subject for all",
cc: "cc@example.com",
htmlBody: "<p>HTML reply all</p>",
});

// Test GmailThread.createDraftReply with subject option
thread.createDraftReply("Thread reply body"); // $ExpectType GmailDraft
thread.createDraftReply("Thread reply body", { subject: "Thread custom subject" }); // $ExpectType GmailDraft
// $ExpectType GmailDraft
thread.createDraftReply("Thread reply body", {
subject: "Thread custom subject",
from: "from@example.com",
name: "Custom Name",
});

// Test GmailThread.createDraftReplyAll with subject option
thread.createDraftReplyAll("Thread reply all body"); // $ExpectType GmailDraft
thread.createDraftReplyAll("Thread reply all body", { subject: "Thread custom subject for all" }); // $ExpectType GmailDraft
// $ExpectType GmailDraft
thread.createDraftReplyAll("Thread reply all body", {
subject: "Thread custom subject for all",
replyTo: "replyto@example.com",
attachments: [DriveApp.getFileById("file-id").getBlob()],
});
}
2 changes: 2 additions & 0 deletions types/leaflet.gridlayer.googlemutant/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ declare module "leaflet" {
* Google's map styles.
*/
styles?: GoogleMutantStyle[] | undefined;

mapId?: string | undefined;
}

function googleMutant(options?: GoogleMutantOptions): GoogleMutant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ const styled = L.gridLayer
styled.addGoogleLayer("TrafficLayer").then(nativeTrafficLayer => {
styled.removeGoogleLayer("TrafficLayer");
});

const withMapId = L.gridLayer
.googleMutant({
type: "roadmap",
mapId: "mapId",
})
.addTo(map);