@articlesq/sdk 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -315,6 +315,7 @@ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boole
315
315
  type ClientOptions = {
316
316
  baseUrl: "https://articlesq.com/api/v1" | (string & {});
317
317
  };
318
+ type Webhooks = ArticlePublishedWebhookRequest | ArticleUpdatedWebhookRequest | ArticleUnpublishedWebhookRequest;
318
319
  type ApiError = {
319
320
  error: {
320
321
  title: string;
@@ -390,7 +391,7 @@ type Article = {
390
391
  */
391
392
  datePublished: string | null;
392
393
  /**
393
- * Last meaningful content update (schema.org `dateModified`) as an ISO 8601 string. Null until the article is edited after being published.
394
+ * Last meaningful content update (schema.org `dateModified`) as an ISO 8601 string. Stamped automatically when a published article's content changes, and overridable from the dashboard for imported content. Null until either happens.
394
395
  */
395
396
  dateModified: string | null;
396
397
  };
@@ -454,6 +455,24 @@ type UpdateArticleBody = {
454
455
  */
455
456
  faq?: Array<FaqItem>;
456
457
  };
458
+ type ArticleEvent = {
459
+ /**
460
+ * Which event fired. `article.published` on an article becoming public, `article.updated` on a content change to an already-published article, `article.unpublished` when it returns to draft and leaves the public API.
461
+ */
462
+ type: "article.published" | "article.updated" | "article.unpublished";
463
+ /**
464
+ * When the event was generated, ISO 8601. Matches the `webhook-timestamp` header (seconds since the epoch) used to sign the request.
465
+ */
466
+ timestamp: string;
467
+ /**
468
+ * Identifies the article that changed. Fetch `GET /articles/{slug}` for the current content: the event is a notification, not a snapshot.
469
+ */
470
+ article: {
471
+ id: string;
472
+ slug: string;
473
+ projectId: string;
474
+ };
475
+ };
457
476
  type ListArticlesData = {
458
477
  body?: never;
459
478
  path?: never;
@@ -594,6 +613,36 @@ type UpdateArticleResponses = {
594
613
  200: ArticleResponse;
595
614
  };
596
615
  type UpdateArticleResponse = UpdateArticleResponses[keyof UpdateArticleResponses];
616
+ /**
617
+ * Event payload
618
+ */
619
+ type ArticlePublishedWebhookPayload = ArticleEvent;
620
+ type ArticlePublishedWebhookRequest = {
621
+ body: ArticlePublishedWebhookPayload;
622
+ key: "article.published";
623
+ path?: never;
624
+ query?: never;
625
+ };
626
+ /**
627
+ * Event payload
628
+ */
629
+ type ArticleUpdatedWebhookPayload = ArticleEvent;
630
+ type ArticleUpdatedWebhookRequest = {
631
+ body: ArticleUpdatedWebhookPayload;
632
+ key: "article.updated";
633
+ path?: never;
634
+ query?: never;
635
+ };
636
+ /**
637
+ * Event payload
638
+ */
639
+ type ArticleUnpublishedWebhookPayload = ArticleEvent;
640
+ type ArticleUnpublishedWebhookRequest = {
641
+ body: ArticleUnpublishedWebhookPayload;
642
+ key: "article.unpublished";
643
+ path?: never;
644
+ query?: never;
645
+ };
597
646
 
598
647
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
599
648
  /**
@@ -733,4 +782,4 @@ declare function createArticlesNamespace(client: Client): {
733
782
  }>;
734
783
  };
735
784
 
736
- export { type ApiError, type ApiErrorCode, type Article, type ArticleResponse, type ArticleStatus, Articles, ArticlesQ, type ArticlesQOptions, type ClientOptions, type CreateArticleBody, type CreateArticleData, type CreateArticleError, type CreateArticleErrors, type CreateArticleResponse, type CreateArticleResponses, type FaqItem, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponse2, type ListArticlesResponses, type Options, type Pagination, type UpdateArticleBody, type UpdateArticleData, type UpdateArticleError, type UpdateArticleErrors, type UpdateArticleResponse, type UpdateArticleResponses, ArticlesQ as default };
785
+ export { type ApiError, type ApiErrorCode, type Article, type ArticleEvent, type ArticlePublishedWebhookPayload, type ArticlePublishedWebhookRequest, type ArticleResponse, type ArticleStatus, type ArticleUnpublishedWebhookPayload, type ArticleUnpublishedWebhookRequest, type ArticleUpdatedWebhookPayload, type ArticleUpdatedWebhookRequest, Articles, ArticlesQ, type ArticlesQOptions, type ClientOptions, type CreateArticleBody, type CreateArticleData, type CreateArticleError, type CreateArticleErrors, type CreateArticleResponse, type CreateArticleResponses, type FaqItem, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponse2, type ListArticlesResponses, type Options, type Pagination, type UpdateArticleBody, type UpdateArticleData, type UpdateArticleError, type UpdateArticleErrors, type UpdateArticleResponse, type UpdateArticleResponses, type Webhooks, ArticlesQ as default };
package/dist/index.d.ts CHANGED
@@ -315,6 +315,7 @@ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boole
315
315
  type ClientOptions = {
316
316
  baseUrl: "https://articlesq.com/api/v1" | (string & {});
317
317
  };
318
+ type Webhooks = ArticlePublishedWebhookRequest | ArticleUpdatedWebhookRequest | ArticleUnpublishedWebhookRequest;
318
319
  type ApiError = {
319
320
  error: {
320
321
  title: string;
@@ -390,7 +391,7 @@ type Article = {
390
391
  */
391
392
  datePublished: string | null;
392
393
  /**
393
- * Last meaningful content update (schema.org `dateModified`) as an ISO 8601 string. Null until the article is edited after being published.
394
+ * Last meaningful content update (schema.org `dateModified`) as an ISO 8601 string. Stamped automatically when a published article's content changes, and overridable from the dashboard for imported content. Null until either happens.
394
395
  */
395
396
  dateModified: string | null;
396
397
  };
@@ -454,6 +455,24 @@ type UpdateArticleBody = {
454
455
  */
455
456
  faq?: Array<FaqItem>;
456
457
  };
458
+ type ArticleEvent = {
459
+ /**
460
+ * Which event fired. `article.published` on an article becoming public, `article.updated` on a content change to an already-published article, `article.unpublished` when it returns to draft and leaves the public API.
461
+ */
462
+ type: "article.published" | "article.updated" | "article.unpublished";
463
+ /**
464
+ * When the event was generated, ISO 8601. Matches the `webhook-timestamp` header (seconds since the epoch) used to sign the request.
465
+ */
466
+ timestamp: string;
467
+ /**
468
+ * Identifies the article that changed. Fetch `GET /articles/{slug}` for the current content: the event is a notification, not a snapshot.
469
+ */
470
+ article: {
471
+ id: string;
472
+ slug: string;
473
+ projectId: string;
474
+ };
475
+ };
457
476
  type ListArticlesData = {
458
477
  body?: never;
459
478
  path?: never;
@@ -594,6 +613,36 @@ type UpdateArticleResponses = {
594
613
  200: ArticleResponse;
595
614
  };
596
615
  type UpdateArticleResponse = UpdateArticleResponses[keyof UpdateArticleResponses];
616
+ /**
617
+ * Event payload
618
+ */
619
+ type ArticlePublishedWebhookPayload = ArticleEvent;
620
+ type ArticlePublishedWebhookRequest = {
621
+ body: ArticlePublishedWebhookPayload;
622
+ key: "article.published";
623
+ path?: never;
624
+ query?: never;
625
+ };
626
+ /**
627
+ * Event payload
628
+ */
629
+ type ArticleUpdatedWebhookPayload = ArticleEvent;
630
+ type ArticleUpdatedWebhookRequest = {
631
+ body: ArticleUpdatedWebhookPayload;
632
+ key: "article.updated";
633
+ path?: never;
634
+ query?: never;
635
+ };
636
+ /**
637
+ * Event payload
638
+ */
639
+ type ArticleUnpublishedWebhookPayload = ArticleEvent;
640
+ type ArticleUnpublishedWebhookRequest = {
641
+ body: ArticleUnpublishedWebhookPayload;
642
+ key: "article.unpublished";
643
+ path?: never;
644
+ query?: never;
645
+ };
597
646
 
598
647
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
599
648
  /**
@@ -733,4 +782,4 @@ declare function createArticlesNamespace(client: Client): {
733
782
  }>;
734
783
  };
735
784
 
736
- export { type ApiError, type ApiErrorCode, type Article, type ArticleResponse, type ArticleStatus, Articles, ArticlesQ, type ArticlesQOptions, type ClientOptions, type CreateArticleBody, type CreateArticleData, type CreateArticleError, type CreateArticleErrors, type CreateArticleResponse, type CreateArticleResponses, type FaqItem, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponse2, type ListArticlesResponses, type Options, type Pagination, type UpdateArticleBody, type UpdateArticleData, type UpdateArticleError, type UpdateArticleErrors, type UpdateArticleResponse, type UpdateArticleResponses, ArticlesQ as default };
785
+ export { type ApiError, type ApiErrorCode, type Article, type ArticleEvent, type ArticlePublishedWebhookPayload, type ArticlePublishedWebhookRequest, type ArticleResponse, type ArticleStatus, type ArticleUnpublishedWebhookPayload, type ArticleUnpublishedWebhookRequest, type ArticleUpdatedWebhookPayload, type ArticleUpdatedWebhookRequest, Articles, ArticlesQ, type ArticlesQOptions, type ClientOptions, type CreateArticleBody, type CreateArticleData, type CreateArticleError, type CreateArticleErrors, type CreateArticleResponse, type CreateArticleResponses, type FaqItem, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponse2, type ListArticlesResponses, type Options, type Pagination, type UpdateArticleBody, type UpdateArticleData, type UpdateArticleError, type UpdateArticleErrors, type UpdateArticleResponse, type UpdateArticleResponses, type Webhooks, ArticlesQ as default };
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@articlesq/sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "description": "Official TypeScript SDK for the ArticlesQ API.",
6
6
  "license": "Apache-2.0",
7
7
  "author": "ArticlesQ",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/alexand-ro/2-articlesq.git",
11
+ "directory": "packages/sdk"
12
+ },
8
13
  "homepage": "https://articlesq.com",
9
14
  "keywords": [
10
15
  "articlesq",