webflow / js-webflow-api

Node.js SDK for the Webflow Data API

Home Page:https://www.npmjs.com/package/webflow-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong type definition for Collection

ulvi-damirli-nursa opened this issue · comments

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>;
}

Apologies for the late check in here, could you try on the latest version v2.3.5? Should be referencing a Field array now
(note, there's a small hiccup here where the Github release marks it as v2.3.3 but the actual npm release is v2.3.5)

https://github.com/webflow/js-webflow-api/blob/master/src/api/types/Collection.ts#L24

Thanks for informing. I realized it is fixed after an update