Skip to content

Commit

Permalink
Release v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jun 14, 2023
1 parent 71e7b16 commit 2cb4c28
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 83 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mercoa/javascript",
"version": "v0.1.0",
"version": "v0.1.1",
"private": false,
"repository": "https://github.com/mercoa-finance/javascript",
"main": "./index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/api/resources/invoice/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class Invoice {
public async approve(
invoiceId: Mercoa.InvoiceId,
request: Mercoa.ApprovalRequest
): Promise<Mercoa.InvoiceResponse> {
): Promise<Mercoa.CommentResponse> {
const _response = await core.fetcher({
url: urlJoin(
this.options.environment ?? environments.MercoaEnvironment.Production,
Expand All @@ -259,7 +259,7 @@ export class Invoice {
body: await serializers.ApprovalRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
});
if (_response.ok) {
return await serializers.InvoiceResponse.parseOrThrow(_response.body, {
return await serializers.CommentResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
Expand Down Expand Up @@ -291,7 +291,7 @@ export class Invoice {
/**
* Reject invoice
*/
public async reject(invoiceId: Mercoa.InvoiceId, request: Mercoa.ApprovalRequest): Promise<Mercoa.InvoiceResponse> {
public async reject(invoiceId: Mercoa.InvoiceId, request: Mercoa.ApprovalRequest): Promise<Mercoa.CommentResponse> {
const _response = await core.fetcher({
url: urlJoin(
this.options.environment ?? environments.MercoaEnvironment.Production,
Expand All @@ -305,7 +305,7 @@ export class Invoice {
body: await serializers.ApprovalRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
});
if (_response.ok) {
return await serializers.InvoiceResponse.parseOrThrow(_response.body, {
return await serializers.CommentResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
Expand Down
5 changes: 2 additions & 3 deletions src/api/resources/invoice/types/Approver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import { Mercoa } from "@mercoa/javascript";

export interface Approver {
userId: Mercoa.EntityUserId;
date: Date;
export interface Approver extends Mercoa.SetApprover {
roles: string[];
action: Mercoa.ApproverAction;
}
6 changes: 2 additions & 4 deletions src/api/resources/invoice/types/InvoiceRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ export interface InvoiceRequest {
serviceEndDate?: Date;
payerId?: Mercoa.EntityId;
paymentSourceId?: Mercoa.PaymentMethodId;
/** Set approvers for this invoice. */
approvers?: Mercoa.SetApprover[];
vendorId?: Mercoa.EntityId;
paymentDestinationId?: Mercoa.PaymentMethodId;
/** When paying to a new vendor, use the createVendor object. Mercoa will create the vendor entity and tie it to this invoice. This object is ignored when updating an invoice. */
createVendor?: Mercoa.CreateVendorRequest;
/** When paying to an existing vendor with an incomplete profile, use the updateVendor object. Mercoa will update the vendor entity tied to this invoice. This object is ignored if the vendor already has already been created with complete information and when creating a new invoice. */
updateVendor?: Mercoa.CreateVendorRequest;
lineItems?: Mercoa.InvoiceLineItemRequest[];
/** Metadata associated with this invoice. You can specify up to 10 keys, with key names up to 40 characters long and values up to 200 characters long. */
metadata?: Record<string, string>;
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/invoice/types/InvoiceResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface InvoiceResponse {
transactions?: Mercoa.TransactionResponse[];
lineItems?: Mercoa.InvoiceLineItemResponse[];
approvers: Mercoa.Approver[];
approvalPolicy: Mercoa.ApprovalPolicyResponse[];
/** Metadata associated with this invoice. */
metadata: Record<string, string>;
/** Entity user who created this invoice. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Mercoa } from "@mercoa/javascript";

export interface CreateVendorRequest {
vendor: Mercoa.EntityRequest;
paymentMethod?: Mercoa.PaymentMethodRequest;
export interface SetApprover {
userId: Mercoa.EntityUserId;
date: Date;
}
2 changes: 1 addition & 1 deletion src/api/resources/invoice/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from "./InvoiceRequest";
export * from "./InvoiceResponse";
export * from "./InvoiceId";
export * from "./CommentId";
export * from "./SetApprover";
export * from "./Approver";
export * from "./ApproverResponse";
export * from "./ApproverAction";
Expand All @@ -11,7 +12,6 @@ export * from "./DocumentResponse";
export * from "./CommentRequest";
export * from "./ApprovalRequest";
export * from "./CommentResponse";
export * from "./CreateVendorRequest";
export * from "./InvoiceStatus";
export * from "./InvoiceOrderByField";
export * from "./CurrencyCode";
4 changes: 2 additions & 2 deletions src/api/resources/ocr/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Ocr {
}

public async emailInbox(request: Mercoa.EmailOcr): Promise<void> {
const { org, ..._body } = request;
const { org, body: _body } = request;
const _queryParams = new URLSearchParams();
_queryParams.append("org", org);
const _response = await core.fetcher({
Expand All @@ -74,7 +74,7 @@ export class Ocr {
},
contentType: "application/json",
queryParameters: _queryParams,
body: await serializers.EmailOcr.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
body: _body,
});
if (_response.ok) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/ocr/client/requests/EmailOcr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import { Mercoa } from "@mercoa/javascript";

export interface EmailOcr {
org: Mercoa.OrganizationId;
items: Mercoa.EmailOcrRequest[];
body?: unknown;
}
15 changes: 7 additions & 8 deletions src/serialization/resources/invoice/types/Approver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import * as serializers from "../../..";
import { Mercoa } from "@mercoa/javascript";
import * as core from "../../../../core";

export const Approver: core.serialization.ObjectSchema<serializers.Approver.Raw, Mercoa.Approver> =
core.serialization.object({
userId: core.serialization.lazy(async () => (await import("../../..")).EntityUserId),
date: core.serialization.date(),
export const Approver: core.serialization.ObjectSchema<serializers.Approver.Raw, Mercoa.Approver> = core.serialization
.object({
roles: core.serialization.list(core.serialization.string()),
action: core.serialization.lazy(async () => (await import("../../..")).ApproverAction),
});
})
.extend(core.serialization.lazyObject(async () => (await import("../../..")).SetApprover));

export declare namespace Approver {
interface Raw {
userId: serializers.EntityUserId.Raw;
date: string;
interface Raw extends serializers.SetApprover.Raw {
roles: string[];
action: serializers.ApproverAction.Raw;
}
}
24 changes: 0 additions & 24 deletions src/serialization/resources/invoice/types/CreateVendorRequest.ts

This file was deleted.

12 changes: 4 additions & 8 deletions src/serialization/resources/invoice/types/InvoiceRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ export const InvoiceRequest: core.serialization.ObjectSchema<serializers.Invoice
serviceEndDate: core.serialization.date().optional(),
payerId: core.serialization.lazy(async () => (await import("../../..")).EntityId).optional(),
paymentSourceId: core.serialization.lazy(async () => (await import("../../..")).PaymentMethodId).optional(),
approvers: core.serialization
.list(core.serialization.lazyObject(async () => (await import("../../..")).SetApprover))
.optional(),
vendorId: core.serialization.lazy(async () => (await import("../../..")).EntityId).optional(),
paymentDestinationId: core.serialization
.lazy(async () => (await import("../../..")).PaymentMethodId)
.optional(),
createVendor: core.serialization
.lazyObject(async () => (await import("../../..")).CreateVendorRequest)
.optional(),
updateVendor: core.serialization
.lazyObject(async () => (await import("../../..")).CreateVendorRequest)
.optional(),
lineItems: core.serialization
.list(core.serialization.lazyObject(async () => (await import("../../..")).InvoiceLineItemRequest))
.optional(),
Expand All @@ -54,10 +51,9 @@ export declare namespace InvoiceRequest {
serviceEndDate?: string | null;
payerId?: serializers.EntityId.Raw | null;
paymentSourceId?: serializers.PaymentMethodId.Raw | null;
approvers?: serializers.SetApprover.Raw[] | null;
vendorId?: serializers.EntityId.Raw | null;
paymentDestinationId?: serializers.PaymentMethodId.Raw | null;
createVendor?: serializers.CreateVendorRequest.Raw | null;
updateVendor?: serializers.CreateVendorRequest.Raw | null;
lineItems?: serializers.InvoiceLineItemRequest.Raw[] | null;
metadata?: Record<string, string> | null;
uploadedImage?: string | null;
Expand Down
4 changes: 4 additions & 0 deletions src/serialization/resources/invoice/types/InvoiceResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export const InvoiceResponse: core.serialization.ObjectSchema<serializers.Invoic
approvers: core.serialization.list(
core.serialization.lazyObject(async () => (await import("../../..")).Approver)
),
approvalPolicy: core.serialization.list(
core.serialization.lazyObject(async () => (await import("../../..")).ApprovalPolicyResponse)
),
metadata: core.serialization.record(core.serialization.string(), core.serialization.string()),
createdBy: core.serialization.lazyObject(async () => (await import("../../..")).EntityUserResponse).optional(),
processedAt: core.serialization.date().optional(),
Expand Down Expand Up @@ -83,6 +86,7 @@ export declare namespace InvoiceResponse {
transactions?: serializers.TransactionResponse.Raw[] | null;
lineItems?: serializers.InvoiceLineItemResponse.Raw[] | null;
approvers: serializers.Approver.Raw[];
approvalPolicy: serializers.ApprovalPolicyResponse.Raw[];
metadata: Record<string, string>;
createdBy?: serializers.EntityUserResponse.Raw | null;
processedAt?: string | null;
Expand Down
20 changes: 20 additions & 0 deletions src/serialization/resources/invoice/types/SetApprover.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../..";
import { Mercoa } from "@mercoa/javascript";
import * as core from "../../../../core";

export const SetApprover: core.serialization.ObjectSchema<serializers.SetApprover.Raw, Mercoa.SetApprover> =
core.serialization.object({
userId: core.serialization.lazy(async () => (await import("../../..")).EntityUserId),
date: core.serialization.date(),
});

export declare namespace SetApprover {
interface Raw {
userId: serializers.EntityUserId.Raw;
date: string;
}
}
2 changes: 1 addition & 1 deletion src/serialization/resources/invoice/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from "./InvoiceRequest";
export * from "./InvoiceResponse";
export * from "./InvoiceId";
export * from "./CommentId";
export * from "./SetApprover";
export * from "./Approver";
export * from "./ApproverResponse";
export * from "./ApproverAction";
Expand All @@ -11,7 +12,6 @@ export * from "./DocumentResponse";
export * from "./CommentRequest";
export * from "./ApprovalRequest";
export * from "./CommentResponse";
export * from "./CreateVendorRequest";
export * from "./InvoiceStatus";
export * from "./InvoiceOrderByField";
export * from "./CurrencyCode";
22 changes: 0 additions & 22 deletions src/serialization/resources/ocr/client/requests/EmailOcr.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/serialization/resources/ocr/client/requests/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { RunOcr } from "./RunOcr";
export { EmailOcr } from "./EmailOcr";

0 comments on commit 2cb4c28

Please sign in to comment.