webflow / js-webflow-api

Node.js SDK for the Webflow Data API
https://www.npmjs.com/package/webflow-api
285 stars 92 forks source link

Wrong type definition for Collection #138

Open ulvi-damirli-nursa opened 3 months ago

ulvi-damirli-nursa commented 3 months ago

When I request Collection details through SDK, the response includes an object of Collection which includes fields list. Collection type defines fields as Record<string, unknown> but it should be Record<string, unknown>[].

My code:

const collectionDetails: Collection = await this.webflowClient.collections.get(
        selectedCollection.id
      );

This is Collection.d.ts file:

/**
 * This file was auto-generated by Fern from our API Definition.
 */
/**
 * A collection object
 */
export interface Collection {
    /** Unique identifier for a Collection */
    id: string;
    /** Name given to the Collection */
    displayName?: string;
    /** The name of one Item in Collection (e.g. ”Blog Post” if the Collection is called “Blog Posts”) */
    singularName?: string;
    /** Slug of Collection in Site URL structure */
    slug?: string;
    /** The date the collection was created */
    createdOn?: Date;
    /** The date the collection was last updated */
    lastUpdated?: Date;
    /** The list of fields in the Collection */
    fields: Record<string, unknown>;
}