/*********************************************************************************************************************** * This file is auto-generated. If you have an issue, please create a GitHub issue. * ***********************************************************************************************************************/ import {Base, FindAllResponse} from '../../base'; import {ResourcePath, ResourceNames} from '../../types'; import {Session} from '../../../lib/session/session'; import {ApiVersion} from '../../../lib/types'; interface FindArgs { session: Session; id: number | string; product_id?: number | string | null; fields?: unknown; } interface DeleteArgs { session: Session; id: number | string; product_id?: number | string | null; } interface AllArgs { [key: string]: unknown; session: Session; product_id?: number | string | null; since_id?: unknown; fields?: unknown; } interface CountArgs { [key: string]: unknown; session: Session; product_id?: number | string | null; since_id?: unknown; } export class Image extends Base { public static apiVersion = ApiVersion.January25; protected static hasOne: {[key: string]: typeof Base} = {}; protected static hasMany: {[key: string]: typeof Base} = {}; protected static paths: ResourcePath[] = [ {"http_method": "delete", "operation": "delete", "ids": ["product_id", "id"], "path": "products//images/.json"}, {"http_method": "get", "operation": "count", "ids": ["product_id"], "path": "products//images/count.json"}, {"http_method": "get", "operation": "get", "ids": ["product_id"], "path": "products//images.json"}, {"http_method": "get", "operation": "get", "ids": ["product_id", "id"], "path": "products//images/.json"}, {"http_method": "post", "operation": "post", "ids": ["product_id"], "path": "products//images.json"}, {"http_method": "put", "operation": "put", "ids": ["product_id", "id"], "path": "products//images/.json"} ]; protected static resourceNames: ResourceNames[] = [ { "singular": "image", "plural": "images" } ]; public static async find( { session, id, product_id = null, fields = null }: FindArgs ): Promise { const result = await this.baseFind({ session: session, urlIds: {"id": id, "product_id": product_id}, params: {"fields": fields}, }); return result.data ? result.data[0] : null; } public static async delete( { session, id, product_id = null }: DeleteArgs ): Promise { const response = await this.request({ http_method: "delete", operation: "delete", session: session, urlIds: {"id": id, "product_id": product_id}, params: {}, }); return response ? response.body : null; } public static async all( { session, product_id = null, since_id = null, fields = null, ...otherArgs }: AllArgs ): Promise> { const response = await this.baseFind({ session: session, urlIds: {"product_id": product_id}, params: {"since_id": since_id, "fields": fields, ...otherArgs}, }); return response; } public static async count( { session, product_id = null, since_id = null, ...otherArgs }: CountArgs ): Promise { const response = await this.request({ http_method: "get", operation: "count", session: session, urlIds: {"product_id": product_id}, params: {"since_id": since_id, ...otherArgs}, body: {}, entity: null, }); return response ? response.body : null; } public created_at: string | null; public height: number | null; public id: string | null; public position: number | null; public product_id: string | null; public src: string | null; public updated_at: string | null; public variant_ids: string[] | null; public width: number | null; }