Skip to content

Commit

Permalink
Merge pull request #2991 from bcameron1231/v4---presets-all
Browse files Browse the repository at this point in the history
v4 - Updating Presets
  • Loading branch information
bcameron1231 authored Apr 15, 2024
2 parents e7876c5 + 10ae984 commit 739a0c2
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 62 deletions.
2 changes: 1 addition & 1 deletion docs/graph/to-do.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ More information can be found in the official Graph documentation:

- [To-do Resource Type](https://learn.microsoft.com/en-us/graph/api/resources/todo-overview?view=graph-rest-1.0)

## IAttachment, IAttachments, IChecklistItem, IChecklistItems, ILinkedResource, ILinkedResources, ITask, ITaskList, ITaskLists, ITodo
## ITodoAttachment, ITodoAttachments, IChecklistItem, IChecklistItems, ILinkedResource, ILinkedResources, ITodoTask, ITaskList, ITaskLists, ITodo
[![Selective Imports Banner](https://img.shields.io/badge/Selective%20Imports-informational.svg)](../concepts/selective-imports.md)

## taskLists
Expand Down
73 changes: 47 additions & 26 deletions packages/graph/presets/all.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,67 @@
import "../admin/index.js";
import "../analytics/index.js";
import "../appCatalog/index.js";
import "../attachments/index.js";
import "../calendars/index.js";
import "../cloud-communications/index.js";
import "../columns/index.js";
import "../compliance/index.js";
import "../contacts/index.js";
import "../content-types/index.js";
import "../conversations/index.js";
import "../directory-objects/index.js";
import "../files/index.js";
import "../groups/index.js";
import "../insights/index.js";
import "../invitations/index.js";
import "../members/index.js";
import "../list-item/index.js";
import "../lists/index.js";
import "../mail/index.js";
import "../files/index.js";
import "../members/index.js";
import "../onenote/index.js";
import "../operations/index.js";
import "../permissions/index.js";
import "../photos/index.js";
import "../places/index.js";
import "../planner/index.js";
import "../search/index.js";
import "../shares/index.js";
import "../sites/index.js";
import "../subscriptions/index.js";
import "../teams/index.js";
import "../taxonomy/index.js";
import "../to-do/index.js";
import "../users/index.js";

export * from "../appCatalog/index.js";
export * from "../attachments/index.js";
export * from "../calendars/index.js";
export * from "../cloud-communications/index.js";
export * from "../contacts/index.js";
export * from "../conversations/index.js";
export * from "../directory-objects/index.js";
export * from "../groups/index.js";
export * from "../insights/index.js";
export * from "../invitations/index.js";
export * from "../members/index.js";
export * from "../mail/index.js";
export * from "../files/index.js";
export * from "../onenote/index.js";
export * from "../operations/index.js";
export * from "../photos/index.js";
export * from "../planner/index.js";
export * from "../search/index.js";
export * from "../shares/index.js";
export * from "../subscriptions/index.js";
export * from "../teams/index.js";
export * from "../users/index.js";
export * from "../index.js";
export * from "../admin/index.js";
export * from "../analytics/index.js";
export * from "../appCatalog/index.js";
export * from "../attachments/index.js";
export * from "../calendars/index.js";
export * from "../cloud-communications/index.js";
export * from "../columns/index.js";
export * from "../compliance/index.js";
export * from "../contacts/index.js";
export * from "../content-types/index.js";
export * from "../conversations/index.js";
export * from "../directory-objects/index.js";
export * from "../files/index.js";
export * from "../groups/index.js";
export * from "../insights/index.js";
export * from "../invitations/index.js";
export * from "../list-item/index.js";
export * from "../lists/index.js";
export * from "../mail/index.js";
export * from "../members/index.js";
export * from "../onenote/index.js";
export * from "../operations/index.js";
export * from "../permissions/index.js";
export * from "../photos/index.js";
export * from "../places/index.js";
export * from "../planner/index.js";
export * from "../search/index.js";
export * from "../shares/index.js";
export * from "../sites/index.js";
export * from "../subscriptions/index.js";
export * from "../taxonomy/index.js";
export * from "../to-do/index.js";
export * from "../users/index.js";
10 changes: 4 additions & 6 deletions packages/graph/to-do/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import "./user.js";

export {
IAttachment,
IAttachments,
ITodoAttachment,
ITodoAttachments,
IChecklistItem,
IChecklistItems,
ILinkedResource,
ILinkedResources,
ITask,
ITodoTask,
ITaskList,
ITaskLists,
ITodo,
Attachment,
Attachments,
ChecklistItem,
ChecklistItems,
LinkedResource,
LinkedResources,
Tasks,
ITodoTasks,
TaskList,
TaskLists,
} from "./types.js";
54 changes: 27 additions & 27 deletions packages/graph/to-do/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const Todo = graphInvokableFactory<ITodo>(_Todo);
@deleteable()
@updateable()
export class _TaskList extends _GraphInstance<ITodoTaskListType> {
public get tasks(): ITasks{
return Tasks(this);
public get tasks(): ITodoTasks{
return TodoTasks(this);
}

// TODO Create Open Extension. Wait for it to be built as part of extensions module
Expand All @@ -50,14 +50,14 @@ export interface ITaskLists extends _TaskLists, IGetById<ITaskList>, IAddable<IT
export const TaskLists = graphInvokableFactory<ITaskLists>(_TaskLists);

/**
* Task
* TodoTask
*/
@deleteable()
@updateable()
export class _Task extends _GraphInstance<ITodoTaskType> {
export class _TodoTask extends _GraphInstance<ITodoTaskType> {

public get attachments(): IAttachments{
return Attachments(this);
public get attachments(): ITodoAttachments{
return TodoAttachments(this);
}

public get checklistItems(): IChecklistItems{
Expand All @@ -70,51 +70,51 @@ export class _Task extends _GraphInstance<ITodoTaskType> {
// TODO Create Open Extension. Wait for it to be built as part of extensions module
// TODO Get Open Extension. Wait for it to be built as part of extensions module
}
export interface ITask extends _Task, IUpdateable<ITodoTaskType>, IDeleteable{ }
export const Task = graphInvokableFactory<ITask>(_Task);
export interface ITodoTask extends _TodoTask, IUpdateable<ITodoTaskType>, IDeleteable{ }
export const TodoTask = graphInvokableFactory<ITodoTask>(_TodoTask);

/**
* Tasks
* TodoTasks
*/
@defaultPath("tasks")
@getById(Task)
@getById(TodoTask)
@addable()
@hasDelta()
export class _Tasks extends _GraphCollection<ITodoTaskType[]> { }
export interface ITasks extends _Tasks, IGetById<ITask>, IAddable<ITodoTaskType>, IHasDelta<Omit<IDeltaProps, "token">, ITodoTaskType> { }
export const Tasks = graphInvokableFactory<ITasks>(_Tasks);
export class _TodoTasks extends _GraphCollection<ITodoTaskType[]> { }
export interface ITodoTasks extends _TodoTasks, IGetById<ITodoTask>, IAddable<ITodoTaskType>, IHasDelta<Omit<IDeltaProps, "token">, ITodoTaskType> { }
export const TodoTasks = graphInvokableFactory<ITodoTasks>(_TodoTasks);

/**
* Attachment
* TodoAttachment
*/
@deleteable()
export class _Attachment extends _GraphInstance<ITodoAttachmentType> {
export class _TodoAttachment extends _GraphInstance<ITodoAttachmentType> {

public get attachments(): IAttachments{
return Attachments(this);
public get TodoAttachments(): ITodoAttachments{
return TodoAttachments(this);
}
}
export interface IAttachment extends _Attachment, IDeleteable{ }
export const Attachment = graphInvokableFactory<IAttachments>(_Attachment);
export interface ITodoAttachment extends _TodoAttachment, IDeleteable{ }
export const TodoAttachment = graphInvokableFactory<ITodoAttachments>(_TodoAttachment);

/**
* Attachments
* TodoAttachments
*/
@defaultPath("attachments")
@getById(Attachment)
export class _Attachments extends _GraphCollection<ITodoAttachmentType[]> {
@getById(TodoAttachment)
export class _TodoAttachments extends _GraphCollection<ITodoAttachmentType[]> {

public async add(attachmentInfo: IAddAttachmentOptions): Promise<ITodoAttachmentType>{
public async add(TodoAttachmentInfo: IAddTodoAttachmentOptions): Promise<ITodoAttachmentType>{

const postBody = {
"@odata.type": "#microsoft.graph.taskFileAttachment",
...attachmentInfo,
...TodoAttachmentInfo,
};
return graphPost(this, body(postBody));
}
}
export interface IAttachments extends _Attachments, IGetById<IAttachment> { }
export const Attachments = graphInvokableFactory<IAttachments>(_Attachments);
export interface ITodoAttachments extends _TodoAttachments, IGetById<ITodoAttachment> { }
export const TodoAttachments = graphInvokableFactory<ITodoAttachments>(_TodoAttachments);

/**
* Checklist
Expand Down Expand Up @@ -158,6 +158,6 @@ export interface IAddTaskListOptions{
displayName: string;
}

export interface IAddAttachmentOptions extends ITodoAttachmentType{
export interface IAddTodoAttachmentOptions extends ITodoAttachmentType{
contentBytes: string;
}
4 changes: 2 additions & 2 deletions test/graph/to-do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import "@pnp/graph/to-do";
import { pnpTest } from "../pnp-test.js";
import { getRandomString, stringIsNullOrEmpty } from "@pnp/core";
import { ChecklistItem } from "@microsoft/microsoft-graph-types";
import { ITaskList, ITask } from "@pnp/graph/to-do";
import { ITaskList, ITodoTask } from "@pnp/graph/to-do";
import getValidUser from "./utilities/getValidUser.js";
import { IUser } from "@pnp/graph/users";

describe("To-do", function () {
let user: IUser;
let taskList: ITaskList;
let todoTask: ITask;
let todoTask: ITodoTask;

before(pnpTest("94d99e35-9891-4b50-a23c-359a43eeadc7", async function () {

Expand Down

0 comments on commit 739a0c2

Please sign in to comment.