UNPKG

@shopify/shopify-api

Version:

Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks

1 lines 13.7 kB
{"version":3,"file":"comment.mjs","sources":["../../../../../../../rest/admin/2025-07/comment.ts"],"sourcesContent":["/***********************************************************************************************************************\n* This file is auto-generated. If you have an issue, please create a GitHub issue. *\n***********************************************************************************************************************/\n\nimport {Base, FindAllResponse} from '../../base';\nimport {ResourcePath, ResourceNames} from '../../types';\nimport {Session} from '../../../lib/session/session';\nimport {ApiVersion} from '../../../lib/types';\n\ninterface FindArgs {\n session: Session;\n id: number | string;\n fields?: unknown;\n}\ninterface AllArgs {\n [key: string]: unknown;\n session: Session;\n limit?: unknown;\n since_id?: unknown;\n created_at_min?: unknown;\n created_at_max?: unknown;\n updated_at_min?: unknown;\n updated_at_max?: unknown;\n published_at_min?: unknown;\n published_at_max?: unknown;\n fields?: unknown;\n published_status?: unknown;\n status?: unknown;\n}\ninterface CountArgs {\n [key: string]: unknown;\n session: Session;\n created_at_min?: unknown;\n created_at_max?: unknown;\n updated_at_min?: unknown;\n updated_at_max?: unknown;\n published_at_min?: unknown;\n published_at_max?: unknown;\n published_status?: unknown;\n status?: unknown;\n}\ninterface ApproveArgs {\n [key: string]: unknown;\n body?: {[key: string]: unknown} | null;\n}\ninterface NotSpamArgs {\n [key: string]: unknown;\n body?: {[key: string]: unknown} | null;\n}\ninterface RemoveArgs {\n [key: string]: unknown;\n body?: {[key: string]: unknown} | null;\n}\ninterface RestoreArgs {\n [key: string]: unknown;\n body?: {[key: string]: unknown} | null;\n}\ninterface SpamArgs {\n [key: string]: unknown;\n body?: {[key: string]: unknown} | null;\n}\n\nexport class Comment extends Base {\n public static apiVersion = ApiVersion.July25;\n\n protected static hasOne: {[key: string]: typeof Base} = {};\n protected static hasMany: {[key: string]: typeof Base} = {};\n protected static paths: ResourcePath[] = [\n {\"http_method\": \"get\", \"operation\": \"count\", \"ids\": [], \"path\": \"comments/count.json\"},\n {\"http_method\": \"get\", \"operation\": \"get\", \"ids\": [], \"path\": \"comments.json\"},\n {\"http_method\": \"get\", \"operation\": \"get\", \"ids\": [\"id\"], \"path\": \"comments/<id>.json\"},\n {\"http_method\": \"post\", \"operation\": \"approve\", \"ids\": [\"id\"], \"path\": \"comments/<id>/approve.json\"},\n {\"http_method\": \"post\", \"operation\": \"not_spam\", \"ids\": [\"id\"], \"path\": \"comments/<id>/not_spam.json\"},\n {\"http_method\": \"post\", \"operation\": \"post\", \"ids\": [], \"path\": \"comments.json\"},\n {\"http_method\": \"post\", \"operation\": \"remove\", \"ids\": [\"id\"], \"path\": \"comments/<id>/remove.json\"},\n {\"http_method\": \"post\", \"operation\": \"restore\", \"ids\": [\"id\"], \"path\": \"comments/<id>/restore.json\"},\n {\"http_method\": \"post\", \"operation\": \"spam\", \"ids\": [\"id\"], \"path\": \"comments/<id>/spam.json\"},\n {\"http_method\": \"put\", \"operation\": \"put\", \"ids\": [\"id\"], \"path\": \"comments/<id>.json\"}\n ];\n protected static resourceNames: ResourceNames[] = [\n {\n \"singular\": \"comment\",\n \"plural\": \"comments\"\n }\n ];\n\n public static async find(\n {\n session,\n id,\n fields = null\n }: FindArgs\n ): Promise<Comment | null> {\n const result = await this.baseFind<Comment>({\n session: session,\n urlIds: {\"id\": id},\n params: {\"fields\": fields},\n });\n return result.data ? result.data[0] : null;\n }\n\n public static async all(\n {\n session,\n limit = null,\n since_id = null,\n created_at_min = null,\n created_at_max = null,\n updated_at_min = null,\n updated_at_max = null,\n published_at_min = null,\n published_at_max = null,\n fields = null,\n published_status = null,\n status = null,\n ...otherArgs\n }: AllArgs\n ): Promise<FindAllResponse<Comment>> {\n const response = await this.baseFind<Comment>({\n session: session,\n urlIds: {},\n params: {\"limit\": limit, \"since_id\": since_id, \"created_at_min\": created_at_min, \"created_at_max\": created_at_max, \"updated_at_min\": updated_at_min, \"updated_at_max\": updated_at_max, \"published_at_min\": published_at_min, \"published_at_max\": published_at_max, \"fields\": fields, \"published_status\": published_status, \"status\": status, ...otherArgs},\n });\n\n return response;\n }\n\n public static async count(\n {\n session,\n created_at_min = null,\n created_at_max = null,\n updated_at_min = null,\n updated_at_max = null,\n published_at_min = null,\n published_at_max = null,\n published_status = null,\n status = null,\n ...otherArgs\n }: CountArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"get\",\n operation: \"count\",\n session: session,\n urlIds: {},\n params: {\"created_at_min\": created_at_min, \"created_at_max\": created_at_max, \"updated_at_min\": updated_at_min, \"updated_at_max\": updated_at_max, \"published_at_min\": published_at_min, \"published_at_max\": published_at_max, \"published_status\": published_status, \"status\": status, ...otherArgs},\n body: {},\n entity: null,\n });\n\n return response ? response.body : null;\n }\n\n public async approve(\n {\n body = null,\n ...otherArgs\n }: ApproveArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"post\",\n operation: \"approve\",\n session: this.session,\n urlIds: {\"id\": this.id},\n params: {...otherArgs},\n body: body,\n entity: this,\n });\n\n return response ? response.body : null;\n }\n\n public async not_spam(\n {\n body = null,\n ...otherArgs\n }: NotSpamArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"post\",\n operation: \"not_spam\",\n session: this.session,\n urlIds: {\"id\": this.id},\n params: {...otherArgs},\n body: body,\n entity: this,\n });\n\n return response ? response.body : null;\n }\n\n public async remove(\n {\n body = null,\n ...otherArgs\n }: RemoveArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"post\",\n operation: \"remove\",\n session: this.session,\n urlIds: {\"id\": this.id},\n params: {...otherArgs},\n body: body,\n entity: this,\n });\n\n return response ? response.body : null;\n }\n\n public async restore(\n {\n body = null,\n ...otherArgs\n }: RestoreArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"post\",\n operation: \"restore\",\n session: this.session,\n urlIds: {\"id\": this.id},\n params: {...otherArgs},\n body: body,\n entity: this,\n });\n\n return response ? response.body : null;\n }\n\n public async spam(\n {\n body = null,\n ...otherArgs\n }: SpamArgs\n ): Promise<unknown> {\n const response = await this.request<Comment>({\n http_method: \"post\",\n operation: \"spam\",\n session: this.session,\n urlIds: {\"id\": this.id},\n params: {...otherArgs},\n body: body,\n entity: this,\n });\n\n return response ? response.body : null;\n }\n\n public article_id: string | null;\n public author: string | null;\n public blog_id: string | null;\n public body: string | null;\n public body_html: string | null;\n public created_at: string | null;\n public email: string | null;\n public id: string | null;\n public ip: string | null;\n public published_at: string | null;\n public status: string | null;\n public updated_at: string | null;\n public user_agent: string | null;\n}\n"],"names":[],"mappings":";;;AAAA;;AAEwH;AA4DlH,MAAO,OAAQ,SAAQ,IAAI,CAAA;AACxB,IAAA,OAAO,UAAU,GAAG,UAAU,CAAC,MAAM;AAElC,IAAA,OAAO,MAAM,GAAiC,EAAE;AAChD,IAAA,OAAO,OAAO,GAAiC,EAAE;IACjD,OAAO,KAAK,GAAmB;AACvC,QAAA,EAAC,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAC;AACtF,QAAA,EAAC,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,eAAe,EAAC;AAC9E,QAAA,EAAC,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAC;AACvF,QAAA,EAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAC;AACpG,QAAA,EAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,6BAA6B,EAAC;AACtG,QAAA,EAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAA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