-
Notifications
You must be signed in to change notification settings - Fork 7
feat: expand API resource coverage and harden test suite #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akhil-vamshi-konam
wants to merge
8
commits into
main
Choose a base branch
from
feat/expand-api-resource-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3ed54fa
feat: expand API resource coverage and harden test suite
akhil-vamshi-konam a4dcdb9
chore: bump version
akhil-vamshi-konam 6280f5a
chore: update version to 0.2.13
akhil-vamshi-konam 206f816
chore: enhance error logging and clean up page deletion tests
akhil-vamshi-konam 63b8fec
chore: add regression test for importing workspace work item types in…
akhil-vamshi-konam f3a1746
chore: enhance Cycles and Modules API with work item listing and filt…
akhil-vamshi-konam 77ab658
chore: update ListInitiativesParams to use per_page and cursor for pa…
akhil-vamshi-konam b4eaf3d
chore: update version to 0.2.12
akhil-vamshi-konam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { BaseResource } from "../BaseResource"; | ||
| import { Configuration } from "../../Configuration"; | ||
| import { CollectionMember, CreateCollectionMember, UpdateCollectionMember } from "../../models/Collection"; | ||
|
|
||
| /** | ||
| * CollectionMembers sub-resource | ||
| * Manages members of a (typically private) collection | ||
| */ | ||
| export class Members extends BaseResource { | ||
| constructor(config: Configuration) { | ||
| super(config); | ||
| } | ||
|
|
||
| /** | ||
| * List members of a collection | ||
| */ | ||
| async list(workspaceSlug: string, collectionId: string): Promise<CollectionMember[]> { | ||
| const data = await this.get<CollectionMember[] | { results: CollectionMember[] }>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/members/` | ||
| ); | ||
| return Array.isArray(data) ? data : data.results; | ||
| } | ||
|
|
||
| /** | ||
| * Add a member to a collection | ||
| */ | ||
| async add( | ||
| workspaceSlug: string, | ||
| collectionId: string, | ||
| memberData: CreateCollectionMember | ||
| ): Promise<CollectionMember> { | ||
| return this.post<CollectionMember>(`/workspaces/${workspaceSlug}/collections/${collectionId}/members/`, memberData); | ||
| } | ||
|
|
||
| /** | ||
| * Update a collection member's access level. | ||
| * | ||
| * @param memberId - UUID of the CollectionMember row (not the user id) | ||
| */ | ||
| async update( | ||
| workspaceSlug: string, | ||
| collectionId: string, | ||
| memberId: string, | ||
| memberData: UpdateCollectionMember | ||
| ): Promise<CollectionMember> { | ||
| return this.patch<CollectionMember>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/members/${memberId}/`, | ||
| memberData | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Remove a member from a collection. | ||
| * | ||
| * @param memberId - UUID of the CollectionMember row (not the user id) | ||
| */ | ||
| async remove(workspaceSlug: string, collectionId: string, memberId: string): Promise<void> { | ||
| return this.httpDelete(`/workspaces/${workspaceSlug}/collections/${collectionId}/members/${memberId}/`); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { BaseResource } from "../BaseResource"; | ||
| import { Configuration } from "../../Configuration"; | ||
| import { PaginatedResponse } from "../../models/common"; | ||
| import { | ||
| AddCollectionPages, | ||
| CollectionBranchPage, | ||
| CollectionPage, | ||
| CollectionPageSearchResult, | ||
| ListCollectionPagesParams, | ||
| UpdateCollectionPage, | ||
| } from "../../models/Collection"; | ||
|
|
||
| /** | ||
| * CollectionPages sub-resource | ||
| * Manages the pages that belong to a collection | ||
| */ | ||
| export class Pages extends BaseResource { | ||
| constructor(config: Configuration) { | ||
| super(config); | ||
| } | ||
|
|
||
| /** | ||
| * List pages that belong to a collection. | ||
| * Without `parent_id`, returns only top-level (non-sub) pages. | ||
| */ | ||
| async list( | ||
| workspaceSlug: string, | ||
| collectionId: string, | ||
| params?: ListCollectionPagesParams | ||
| ): Promise<PaginatedResponse<CollectionBranchPage>> { | ||
| return this.get<PaginatedResponse<CollectionBranchPage>>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/pages/`, | ||
| params | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Add existing page(s) to a collection | ||
| */ | ||
| async add(workspaceSlug: string, collectionId: string, pagesData: AddCollectionPages): Promise<CollectionPage[]> { | ||
| const result = await this.post<CollectionPage[] | { results: CollectionPage[] }>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/pages/`, | ||
| pagesData | ||
| ); | ||
| return Array.isArray(result) ? result : result.results; | ||
| } | ||
|
|
||
| /** | ||
| * Search pages that are not yet in a collection, to add them. | ||
| * | ||
| * @param search - Optional case-insensitive substring filter on page name | ||
| */ | ||
| async search(workspaceSlug: string, collectionId: string, search?: string): Promise<CollectionPageSearchResult[]> { | ||
| const data = await this.get<CollectionPageSearchResult[] | { results: CollectionPageSearchResult[] }>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/pages-search/`, | ||
| search ? { search } : undefined | ||
| ); | ||
| return Array.isArray(data) ? data : data.results; | ||
| } | ||
|
|
||
| /** | ||
| * Move a page to a different collection, or reorder it within the current one. | ||
| * Omit `collection` in the payload to just reorder. | ||
| * | ||
| * @param pageCollectionId - UUID of the page-collection membership row | ||
| */ | ||
| async update( | ||
| workspaceSlug: string, | ||
| collectionId: string, | ||
| pageCollectionId: string, | ||
| updateData: UpdateCollectionPage | ||
| ): Promise<CollectionPage> { | ||
| return this.patch<CollectionPage>( | ||
| `/workspaces/${workspaceSlug}/collections/${collectionId}/pages/${pageCollectionId}/`, | ||
| updateData | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Remove a page from a collection (does not delete the page itself). | ||
| * | ||
| * @param pageCollectionId - UUID of the page-collection membership row | ||
| */ | ||
| async remove(workspaceSlug: string, collectionId: string, pageCollectionId: string): Promise<void> { | ||
| return this.httpDelete(`/workspaces/${workspaceSlug}/collections/${collectionId}/pages/${pageCollectionId}/`); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { BaseResource } from "../BaseResource"; | ||
| import { Configuration } from "../../Configuration"; | ||
| import { Collection, CreateCollection, UpdateCollection } from "../../models/Collection"; | ||
| import { Members } from "./Members"; | ||
| import { Pages } from "./Pages"; | ||
|
|
||
| /** | ||
| * Collections API resource | ||
| * Manages collections (folders that group workspace pages) with member and | ||
| * page sub-resources | ||
| */ | ||
| export class Collections extends BaseResource { | ||
| public members: Members; | ||
| public pages: Pages; | ||
|
|
||
| constructor(config: Configuration) { | ||
| super(config); | ||
| this.members = new Members(config); | ||
| this.pages = new Pages(config); | ||
| } | ||
|
|
||
| /** | ||
| * List all collections in a workspace | ||
| */ | ||
| async list(workspaceSlug: string): Promise<Collection[]> { | ||
| const data = await this.get<Collection[] | { results: Collection[] }>(`/workspaces/${workspaceSlug}/collections/`); | ||
| return Array.isArray(data) ? data : data.results; | ||
| } | ||
|
|
||
| /** | ||
| * Create a new collection in a workspace | ||
| */ | ||
| async create(workspaceSlug: string, createCollection: CreateCollection): Promise<Collection> { | ||
| return this.post<Collection>(`/workspaces/${workspaceSlug}/collections/`, createCollection); | ||
| } | ||
|
|
||
| /** | ||
| * Retrieve a collection by ID | ||
| */ | ||
| async retrieve(workspaceSlug: string, collectionId: string): Promise<Collection> { | ||
| return this.get<Collection>(`/workspaces/${workspaceSlug}/collections/${collectionId}/`); | ||
| } | ||
|
|
||
| /** | ||
| * Update a collection's name, logo, or sort order. | ||
| * A collection's access level cannot be changed after creation. | ||
| */ | ||
| async update(workspaceSlug: string, collectionId: string, updateCollection: UpdateCollection): Promise<Collection> { | ||
| return this.patch<Collection>(`/workspaces/${workspaceSlug}/collections/${collectionId}/`, updateCollection); | ||
| } | ||
|
|
||
| /** | ||
| * Delete a collection. | ||
| * | ||
| * @param archivePages - Whether to archive the collection's pages instead of | ||
| * leaving them unfiled. Omit to use the server's default (true). Private | ||
| * collections always archive their pages regardless. | ||
| */ | ||
| async delete(workspaceSlug: string, collectionId: string, archivePages?: boolean): Promise<void> { | ||
| const params = archivePages === undefined ? undefined : { archive_pages: archivePages ? "true" : "false" }; | ||
| return this.httpDelete(`/workspaces/${workspaceSlug}/collections/${collectionId}/`, undefined, params); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.