Skip to content

Commit 78bc385

Browse files
damini-vashishthasilentsakky
authored andcommitted
PREAPPS-8823 Added getItem api request and content in saveDocument request
1 parent fd6cc52 commit 78bc385

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

src/batch-client/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
GetDocumentShareURLEntity,
3333
GetDocumentShareURLResponseEntity,
3434
GetFolderRequest as GetFolderRequestEntity,
35+
GetItem,
3536
GetRightsRequest,
3637
HabGroup,
3738
InviteReply,
@@ -1294,6 +1295,22 @@ export class ZimbraBatchClient {
12941295
name: 'GetImportStatus'
12951296
});
12961297

1298+
public getItem = ({ id }: any) =>
1299+
this.jsonRequest({
1300+
name: 'GetItem',
1301+
namespace: Namespace.Mail,
1302+
body: {
1303+
item: {
1304+
id
1305+
}
1306+
}
1307+
}).then(response => {
1308+
const data = normalize(GetItem)(response);
1309+
return {
1310+
docs: data.documents
1311+
};
1312+
});
1313+
12971314
public getMailboxMetadata = ({ section }: GetMailboxMetadataOptions) =>
12981315
this.jsonRequest({
12991316
name: 'GetMailboxMetadata',

src/batch-client/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export interface AppointmentOptions {
178178
}
179179

180180
export interface SaveDocumentInput {
181+
content: string;
181182
ct: string;
182183
descEnabled: Boolean;
183184
id: string;

src/normalize/entities.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ export const ListDocumentRevisions = new Entity({
533533
doc: ['documents', Document]
534534
});
535535

536+
export const GetItem = new Entity({
537+
doc: ['documents', Document]
538+
});
539+
536540
export const MessagePartInputForDocuments = new Entity({
537541
id: 'messageId',
538542
part: 'attachmentPart'
@@ -545,7 +549,8 @@ export const SaveDocument = new Entity({
545549
ct: 'contentType',
546550
descEnabled: 'descriptionEnabled',
547551
m: ['messageData', MessagePartInputForDocuments],
548-
doc: ['document', Document]
552+
doc: ['document', Document],
553+
content: 'content'
549554
});
550555

551556
export const SearchResponse = new Entity({

src/schema/generated-schema-types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,6 +3664,7 @@ export type Query = {
36643664
getHAB?: Maybe<HabGroup>;
36653665
getIdentities?: Maybe<Identities>;
36663666
getImportStatus?: Maybe<ImportStatusResponse>;
3667+
getItem?: Maybe<Document>;
36673668
getMailboxMetadata?: Maybe<MailboxMetadata>;
36683669
getMessage?: Maybe<MessageInfo>;
36693670
getMessagesMetadata?: Maybe<Array<Maybe<MessageInfo>>>;
@@ -3836,6 +3837,11 @@ export type QueryGetHabArgs = {
38363837
};
38373838

38383839

3840+
export type QueryGetItemArgs = {
3841+
id: Scalars['ID']['input'];
3842+
};
3843+
3844+
38393845
export type QueryGetMailboxMetadataArgs = {
38403846
section?: InputMaybe<Scalars['String']['input']>;
38413847
};
@@ -4172,7 +4178,9 @@ export enum SaveDocumentAction {
41724178

41734179
export type SaveDocumentInput = {
41744180
action?: InputMaybe<SaveDocumentAction>;
4181+
content?: InputMaybe<Scalars['String']['input']>;
41754182
contentType?: InputMaybe<Scalars['String']['input']>;
4183+
desc?: InputMaybe<Scalars['String']['input']>;
41764184
descriptionEnabled?: InputMaybe<Scalars['Boolean']['input']>;
41774185
document?: InputMaybe<SaveDocumentInput>;
41784186
folderId?: InputMaybe<Scalars['ID']['input']>;

src/schema/schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,7 @@ input SaveDocumentInput {
32703270
name: String #name
32713271
version: Float #ver # Note :same item may have different versions (i.e same names) will need to implement ListDocumentRevisionsRequest
32723272
contentType: String #ct
3273+
content: String
32733274
upload: uploadDocument #upload with a id
32743275
messageData: [messagePartForDocument] #m
32753276
descriptionEnabled: Boolean #descEnabled
@@ -3533,6 +3534,7 @@ type Query {
35333534
downloadAttachment(id: ID!, part: ID!): Attachment
35343535
downloadDocument(id: ID!, url: String!): Attachment
35353536
listDocumentRevisions(id: ID!, version: Int!, count: Int!): Document
3537+
getItem(id: ID!): Document
35363538
discoverRights(right: [DiscoverRightInput!]!): DiscoverRights
35373539
freeBusy(names: [String!]!, start: Float, end: Float, excludeUid: String): [FreeBusy]
35383540
getContact(

src/schema/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
113113
downloadAttachment: (_, variables) => client.downloadAttachment(variables),
114114
downloadDocument: (_, variables) => client.downloadDocument(variables),
115115
listDocumentRevisions: (_, variables) => client.listDocumentRevisions(variables),
116+
getItem: (_, variables) => client.getItem(variables),
116117
downloadMessage: (_, variables, context = {}) => {
117118
const { local } = context;
118119

0 commit comments

Comments
 (0)