Skip to content

Commit db78573

Browse files
Merge pull request #149 from autodesk-platform-services/development
Keep Main branch updated with changes to development
2 parents 8e29d38 + aa686ac commit db78573

30 files changed

Lines changed: 914 additions & 232 deletions

construction/issues/source/api/issue-attachments-api.ts

Lines changed: 376 additions & 0 deletions
Large diffs are not rendered by default.

construction/issues/source/api/issue-comments-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AxiosPromise, AxiosInstance } from 'axios';
33
import {ApsServiceRequestConfig, IApsConfiguration, SdkManager, ApiResponse} from "@aps_sdk/autodesk-sdkmanager";
44
import { assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
55
import { COLLECTION_FORMATS, RequestArgs, BaseApi, RequiredError, ConstructionIssuesApiError } from '../base';
6-
import { Comments, CommentsPage } from '../model';
6+
import { Comment, CommentsPage } from '../model';
77
import { CommentsPayload } from '../model';
88
import { Region } from '../model';
99
import { SortBy } from '../model';
@@ -147,7 +147,7 @@ export const IssueCommentsApiFp = function(sdkManager?: SdkManager) {
147147
* @param {*} [options] Override http request option.
148148
* @throws {RequiredError}
149149
*/
150-
async createComments(accessToken: string, projectId: string, issueId: string, xAdsRegion?: Region, commentsPayload?: CommentsPayload, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Comments>> {
150+
async createComments(accessToken: string, projectId: string, issueId: string, xAdsRegion?: Region, commentsPayload?: CommentsPayload, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Comment>> {
151151
const localVarAxiosArgs = await localVarAxiosParamCreator.createComments(accessToken, projectId, issueId, xAdsRegion, commentsPayload, options);
152152
return createRequestFunction(localVarAxiosArgs, sdkManager);
153153
},

construction/issues/source/api/issue-types-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AxiosPromise, AxiosInstance } from 'axios';
33
import {ApsServiceRequestConfig, IApsConfiguration, SdkManager, ApiResponse} from "@aps_sdk/autodesk-sdkmanager";
44
import { assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
55
import { COLLECTION_FORMATS, RequestArgs, BaseApi, RequiredError, ConstructionIssuesApiError } from '../base';
6-
import { TypesPage } from '../model';
6+
import { IssueTypesPage } from '../model';
77
import { Region } from '../model';
88
/**
99
* IssueTypesApi - axios parameter creator
@@ -103,7 +103,7 @@ export const IssueTypesApiFp = function(sdkManager?: SdkManager) {
103103
* @param {*} [options] Override http request option.
104104
* @throws {RequiredError}
105105
*/
106-
async getIssuesTypes(accessToken: string, projectId: string, include?: string, limit?: number, offset?: number, filterUpdatedAt?: string, filterIsActive?: boolean, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TypesPage>> {
106+
async getIssuesTypes(accessToken: string, projectId: string, include?: string, limit?: number, offset?: number, filterUpdatedAt?: string, filterIsActive?: boolean, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<IssueTypesPage>> {
107107
const localVarAxiosArgs = await localVarAxiosParamCreator.getIssuesTypes(accessToken, projectId, include, limit, offset, filterUpdatedAt, filterIsActive, xAdsRegion, options);
108108
return createRequestFunction(localVarAxiosArgs, sdkManager);
109109
},

construction/issues/source/custom-code/issuesClient.ts

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { SdkManager, ApiResponse, ApsServiceRequestConfig, BaseClient, IAuthenticationProvider, SdkManagerBuilder } from "@aps_sdk/autodesk-sdkmanager";
2-
import { Region, DataType, AttrDefinitionPage, Fields, IssuePayload, SortBy, User, Issue, IssuesPage, TypesPage, RootCauseCategoriesPage, AttrMappingPage, CommentsPayload, Comments, CommentsPage } from "../model";
1+
import { ApiResponse, ApsServiceRequestConfig, BaseClient, IAuthenticationProvider, SdkManager, SdkManagerBuilder } from "@aps_sdk/autodesk-sdkmanager";
32
import { IssueAttributeDefinitionsApi, IssueAttributeMappingsApi, IssueCommentsApi, IssueRootCauseCategoriesApi, IssueTypesApi, IssuesApi, IssuesProfileApi } from "../api";
3+
import { Attachments, AttachmentsPayload, AttrDefinitionPage, AttrMappingPage, Comment, CommentsPage, CommentsPayload, DataType, Fields, Issue, IssuePayload, IssuesPage, Region, RootCauseCategoriesPage, SortBy, IssueTypesPage, User } from "../model";
4+
import { IssueAttachmentsApi } from "../api/issue-attachments-api";
45

56
export class IssuesClient extends BaseClient {
67

8+
public issueAttachmentsApi: IssueAttachmentsApi;
79
public issueattributedefinitionsapi: IssueAttributeDefinitionsApi;
810
public issueAttributemappingsapi: IssueAttributeMappingsApi;
911
public issuecommentsapi: IssueCommentsApi;
@@ -16,6 +18,7 @@ export class IssuesClient extends BaseClient {
1618
if (!optionalArgs?.sdkManager) {
1719
(optionalArgs ??= {}).sdkManager = SdkManagerBuilder.create().build();
1820
}
21+
this.issueAttachmentsApi = new IssueAttachmentsApi(optionalArgs.sdkManager);
1922
this.issueattributedefinitionsapi = new IssueAttributeDefinitionsApi(optionalArgs.sdkManager);
2023
this.issueAttributemappingsapi = new IssueAttributeMappingsApi(optionalArgs.sdkManager);
2124
this.issuecommentsapi = new IssueCommentsApi(optionalArgs.sdkManager);
@@ -24,6 +27,71 @@ export class IssuesClient extends BaseClient {
2427
this.issuesapi = new IssuesApi(optionalArgs.sdkManager);
2528
this.issuesprofileapi = new IssuesProfileApi(optionalArgs.sdkManager);
2629
}
30+
/**
31+
* Adds attachments to an existing issue.
32+
*
33+
* Links one or more files in Autodesk Docs (uploaded via the Data Management OSS API) to the specified issue.
34+
*
35+
* Note that an issue can have up to 100 attachments. Files can include images,
36+
* PDFs, or other supported formats.
37+
*
38+
* For more information about uploading attachments, see the Upload Issue Attachment tutorial.
39+
* @summary Your POST endpoint
40+
* @param {string} projectId The ID of the project.
41+
* @param {AttachmentsPayload} attachmentsPayload
42+
* @param {*} [options] Override http request option.
43+
* @throws {RequiredError}
44+
*/
45+
public async addAttachments(projectId: string, attachmentsPayload: AttachmentsPayload, optionalArgs?: { accessToken?: string, options?: ApsServiceRequestConfig }): Promise<Attachments> {
46+
if (!optionalArgs?.accessToken && !this.authenticationProvider) {
47+
throw new Error("Please provide a valid access token or an authentication provider");
48+
}
49+
else if (!optionalArgs?.accessToken) {
50+
(optionalArgs ??= {}).accessToken = await this.authenticationProvider.getAccessToken();
51+
}
52+
const response = await this.issueAttachmentsApi.addAttachments(optionalArgs?.accessToken, projectId, attachmentsPayload, optionalArgs?.options);
53+
return response.content;
54+
}
55+
/**
56+
* Deletes a specific attachment from an issue in a project.
57+
* @summary Your DELETE endpoint
58+
* @param {string} projectId The ID of the project. Use the Data Management API to retrieve the project ID. For more information, see the Retrieve a Project ID tutorial. You need to convert the project ID into a project ID for the ACC API by removing the “b." prefix. For example, a project ID of b.a4be0c34a-4ab7 translates to a project ID of a4be0c34a-4ab7.
59+
* @param {string} issueId The unique identifier of the issue. To find the ID, call GET issues.
60+
* @param {string} attachmentId The unique identifier of the attachment. To find the ID, call GET attachments.
61+
* @param {*} [options] Override http request option.
62+
* @throws {RequiredError}
63+
*/
64+
public async deleteAttachment(projectId: string, issueId: string, attachmentId: string, optionalArgs?: { accessToken?: string, options?: ApsServiceRequestConfig }): Promise<ApiResponse> {
65+
if (!optionalArgs?.accessToken && !this.authenticationProvider) {
66+
throw new Error("Please provide a valid access token or an authentication provider");
67+
}
68+
else if (!optionalArgs?.accessToken) {
69+
(optionalArgs ??= {}).accessToken = await this.authenticationProvider.getAccessToken();
70+
}
71+
const response = await this.issueAttachmentsApi.deleteAttachment(optionalArgs?.accessToken, projectId, issueId, attachmentId, optionalArgs?.options);
72+
return response;
73+
}
74+
/**
75+
* Retrieves all attachments for a specific issue in a project.
76+
* For details about retrieving metadata for a specific attachment, see the Retrieve Issue Attachment tutorial.
77+
* For details about downloading an attachment, see the Download Issue Attachment tutorial.
78+
* @summary Your GET endpoint
79+
* @param {string} projectId The ID of the project. Use the Data Management API to retrieve the project ID. For more information, see the Retrieve a Project ID tutorial. You need to convert the project ID into a project ID for the ACC API by removing the “b." prefix. For example, a project ID of b.a4be0c34a-4ab7 translates to a project ID of a4be0c34a-4ab7.
80+
* @param {string} issueId The unique identifier of the issue. To find the ID, call GET issues.
81+
* @param {*} [options] Override http request option.
82+
* @throws {RequiredError}
83+
*/
84+
public async getAttachments(projectId: string, issueId: string, optionalArgs?: { accessToken?: string, options?: ApsServiceRequestConfig }): Promise<Attachments> {
85+
if (!optionalArgs?.accessToken && !this.authenticationProvider) {
86+
throw new Error("Please provide a valid access token or an authentication provider");
87+
}
88+
else if (!optionalArgs?.accessToken) {
89+
(optionalArgs ??= {}).accessToken = await this.authenticationProvider.getAccessToken();
90+
}
91+
const response = await this.issueAttachmentsApi.getAttachments(optionalArgs?.accessToken, projectId, issueId, optionalArgs?.options);
92+
return response.content;
93+
}
94+
2795
/**
2896
* Retrieves information about issue custom attributes (custom fields) for a project, including the custom attribute title, description and type.
2997
* @summary Your GET endpoint
@@ -121,7 +189,7 @@ export class IssuesClient extends BaseClient {
121189
* @param {*} [options] Override http request option.
122190
* @throws {RequiredError}
123191
*/
124-
public async createComments(projectId: string, issueId: string, commentsPayload: CommentsPayload, optionalArgs?: { xAdsRegion?: Region, accessToken?: string, options?: ApsServiceRequestConfig }): Promise<Comments> {
192+
public async createComments(projectId: string, issueId: string, commentsPayload: CommentsPayload, optionalArgs?: { xAdsRegion?: Region, accessToken?: string, options?: ApsServiceRequestConfig }): Promise<Comment> {
125193
if (!optionalArgs?.accessToken && !this.authenticationProvider) {
126194
throw new Error("Please provide a valid access token or an authentication provider");
127195
}
@@ -225,7 +293,7 @@ export class IssuesClient extends BaseClient {
225293
* @throws {RequiredError}
226294
* @memberof IssueTypesApiInterface
227295
*/
228-
public async getIssuesTypes(projectId: string, optionalArgs?: { include?: string, limit?: number, offset?: number, filterUpdatedAt?: string, filterIsActive?: boolean, xAdsRegion?: Region, accessToken?: string, options?: ApsServiceRequestConfig }): Promise<TypesPage> {
296+
public async getIssuesTypes(projectId: string, optionalArgs?: { include?: string, limit?: number, offset?: number, filterUpdatedAt?: string, filterIsActive?: boolean, xAdsRegion?: Region, accessToken?: string, options?: ApsServiceRequestConfig }): Promise<IssueTypesPage> {
229297
if (!optionalArgs?.accessToken && !this.authenticationProvider) {
230298
throw new Error("Please provide a valid access token or an authentication provider");
231299
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
2+
3+
/**
4+
* A list of attachments to add to the issue.
5+
* @export
6+
* @interface Attachment
7+
*/
8+
export interface Attachment {
9+
/**
10+
* The unique identifier for the attachment, set by the client when creating the attachment reference. This can be any unique GUID, but it is recommended to use the OSS storage GUID. For more information, see the Upload Issue Attachment tutorial.
11+
* @type {string}
12+
* @memberof Attachment
13+
*/
14+
'attachmentId'?: string;
15+
/**
16+
* The human-readable display name for the attachment, including the file extension (for example, .pdf, .jpg, .dwg). This name appears in the ACC web UI and is used when downloading the file from the issue.
17+
* @type {string}
18+
* @memberof Attachment
19+
*/
20+
'displayName'?: string;
21+
/**
22+
* The unique filename of the attachment, typically formatted as {attachmentId}.{fileExtension}.
23+
* This value must exactly match the name of the file stored in Autodesk Docs (OSS) that you uploaded via the OSS process.
24+
*
25+
* For more information, see the Upload Issue Attachment tutorial.
26+
* @type {string}
27+
* @memberof Attachment
28+
*/
29+
'fileName'?: string;
30+
/**
31+
* The type of attachment to create. Set to issue-attachment. Will always be: issue-attachment
32+
* @type {string}
33+
* @memberof Attachment
34+
*/
35+
'attachmentType'?: AttachmentAttachmentTypeEnum;
36+
/**
37+
* The Object Storage Service (OSS) URN that uniquely identifies where the file is stored in Autodesk’s cloud infrastructure. You obtain this value after uploading the file to OSS (see the Upload Issue Attachment tutorial) or by retrieving it from an existing attachment (see the Downloading Issue Attachments tutorial).
38+
* @type {string}
39+
* @memberof Attachment
40+
*/
41+
'storageUrn'?: string;
42+
/**
43+
* The size of the file in bytes.
44+
* @type {number}
45+
* @memberof Attachment
46+
*/
47+
'fileSize'?: number;
48+
/**
49+
* The file extension (without the dot), for example pdf or jpg.
50+
* @type {string}
51+
* @memberof Attachment
52+
*/
53+
'fileType'?: string;
54+
/**
55+
* The ID of the issue that owns the attachment.
56+
* @type {string}
57+
* @memberof Attachment
58+
*/
59+
'domainEntityId'?: string;
60+
/**
61+
* The document lineage URN for the attachment’s source file.
62+
* @type {string}
63+
* @memberof Attachment
64+
*/
65+
'lineageUrn'?: string;
66+
/**
67+
* The document version number.
68+
* @type {number}
69+
* @memberof Attachment
70+
*/
71+
'version'?: number;
72+
/**
73+
* The URN for the specific file version that was attached to the issue. This may differ from the latest version URN (tipVersionUrn) if a newer version of the file exists in Autodesk Docs.
74+
* @type {string}
75+
* @memberof Attachment
76+
*/
77+
'versionUrn'?: string;
78+
/**
79+
* The URN for the latest (tip) version of the file.
80+
* @type {string}
81+
* @memberof Attachment
82+
*/
83+
'tipVersionUrn'?: string;
84+
/**
85+
* Not relevant
86+
* @type {string}
87+
* @memberof Attachment
88+
*/
89+
'bubbleUrn'?: string;
90+
/**
91+
* The ID of the user who created the issue attachment. For details about the user, call GET users.
92+
* @type {string}
93+
* @memberof Attachment
94+
*/
95+
'createdBy'?: string;
96+
/**
97+
* The date and time when the issue attachment was created, in ISO8601 format.
98+
* @type {string}
99+
* @memberof Attachment
100+
*/
101+
'createdOn'?: string;
102+
/**
103+
* Not relevant
104+
* @type {string}
105+
* @memberof Attachment
106+
*/
107+
'modifiedBy'?: string;
108+
/**
109+
* Not relevant
110+
* @type {string}
111+
* @memberof Attachment
112+
*/
113+
'modifiedOn'?: string;
114+
/**
115+
* The ID of the user who deleted the issue attachment, if applicable. For details about the user, call GET users.
116+
* @type {string}
117+
* @memberof Attachment
118+
*/
119+
'deletedBy'?: string;
120+
/**
121+
* The date and time when the issue attachment was deleted, if applicable.
122+
* @type {string}
123+
* @memberof Attachment
124+
*/
125+
'deletedOn'?: string;
126+
/**
127+
* true: The attachment has been deleted.
128+
* false: (default) The attachment has not been deleted.
129+
* @type {boolean}
130+
* @memberof Attachment
131+
*/
132+
'isDeleted'?: boolean;
133+
}
134+
135+
export const AttachmentAttachmentTypeEnum = {
136+
IssueAttachment: 'issue-attachment'
137+
} as const;
138+
139+
export type AttachmentAttachmentTypeEnum = typeof AttachmentAttachmentTypeEnum[keyof typeof AttachmentAttachmentTypeEnum];
140+
141+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
3+
/**
4+
* A list of attachments to add to the issue.
5+
* @export
6+
* @interface AttachmentObject
7+
*/
8+
export interface AttachmentObject {
9+
/**
10+
* The unique identifier for the attachment, set by the client when creating the attachment reference. This can be any unique GUID, but it is recommended to use the OSS storage GUID. For more information, see the Upload Issue Attachment tutorial.
11+
* @type {string}
12+
* @memberof AttachmentObject
13+
*/
14+
'attachmentId': string;
15+
/**
16+
* The human-readable display name for the attachment, including the file extension (for example, .pdf, .jpg, .dwg). This name appears in the ACC web UI and is used when downloading the file from the issue.
17+
* @type {string}
18+
* @memberof AttachmentObject
19+
*/
20+
'displayName': string;
21+
/**
22+
* The unique filename of the attachment, typically formatted as {attachmentId}.{fileExtension}.
23+
* This value must exactly match the name of the file stored in Autodesk Docs (OSS) that you uploaded via the OSS process.
24+
*
25+
* For more information, see the Upload Issue Attachment tutorial.
26+
* @type {string}
27+
* @memberof AttachmentObject
28+
*/
29+
'fileName': string;
30+
/**
31+
* The type of attachment to create. Set to issue-attachment. Will always be: issue-attachment
32+
* @type {string}
33+
* @memberof AttachmentObject
34+
*/
35+
'attachmentType': AttachmentObjectAttachmentTypeEnum;
36+
/**
37+
* The Object Storage Service (OSS) URN that uniquely identifies where the file is stored in Autodesk’s cloud infrastructure. You obtain this value after uploading the file to OSS (see the Upload Issue Attachment tutorial) or by retrieving it from an existing attachment (see the Downloading Issue Attachments tutorial).
38+
* @type {string}
39+
* @memberof AttachmentObject
40+
*/
41+
'storageUrn': string;
42+
}
43+
44+
export const AttachmentObjectAttachmentTypeEnum = {
45+
IssueAttachment: 'issue-attachment'
46+
} as const;
47+
48+
export type AttachmentObjectAttachmentTypeEnum = typeof AttachmentObjectAttachmentTypeEnum[keyof typeof AttachmentObjectAttachmentTypeEnum];
49+
50+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
import { Attachment } from './attachment';
3+
4+
/**
5+
* An optional array of attachments associated with this object.
6+
* @export
7+
* @interface Attachments
8+
*/
9+
export interface Attachments {
10+
/**
11+
* An optional array of attachments associated with this object.
12+
* @type {Array<Attachment>}
13+
* @memberof Attachments
14+
*/
15+
'attachmentList'?: Array<Attachment>;
16+
}
17+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import { AttachmentObject } from './attachmentObject';
3+
4+
/**
5+
* Represents the payload for adding attachments to an issue.
6+
* @export
7+
* @interface AttachmentsPayload
8+
*/
9+
export interface AttachmentsPayload {
10+
/**
11+
* The unique identifier of the issue to which the attachments will be added.
12+
* @type {string}
13+
* @memberof AttachmentsPayload
14+
*/
15+
'domainEntityId'?: string;
16+
/**
17+
* The list of attachments to be added to the issue.
18+
* @type {Array<AttachmentObject>}
19+
* @memberof AttachmentsPayload
20+
*/
21+
'attachments'?: Array<AttachmentObject>;
22+
}
23+

0 commit comments

Comments
 (0)