@@ -48,12 +48,16 @@ <h1 id="articles-api-schemas">Articles API Schemas</h1>
4848- [1] https://developers.intercom.com/intercom-api-reference/reference/the-article-model
4949"""
5050
51+ # Built-in
52+ from enum import Enum
53+
5154# External
5255import marshmallow
5356from marshmallow import fields
5457
5558# From Current API
5659from . import models as a_models
60+ from .languages import ArticleLanguages
5761
5862# From Current Package
5963from ...core.schema_base import SchemaBase
@@ -102,34 +106,52 @@ <h1 id="articles-api-schemas">Articles API Schemas</h1>
102106 default_locale (str): The default locale of the Article.
103107 statistics (dict): The statistics of the Article.
104108 """
105- id = fields.Int(required=True )
106- type = fields.Str(allow_none=True)
107- workspace_id = fields.Str(allow_none=True)
109+ id = fields.Int(required=False )
110+ type = fields.Str(allow_none=True, required=False )
111+ workspace_id = fields.Str(allow_none=True, required=False )
108112 title = fields.Str(required=True)
109- description = fields.Str(allow_none=True)
110- body = fields.Str(required=True )
111- author_id = fields.Int(required=True )
112- state = fields.Str(allow_none=True)
113- created_at = fields.Int(allow_none=True)
114- updated_at = fields.Int(allow_none=True)
115- url = fields.Str(allow_none=True)
116- default_locale = fields.Str(allow_none=True)
117- translated_content = fields.Dict(values=fields.Str(), default='', allow_none=True )
118- statistics = fields.Nested(ArticleStatisticsSchema, allow_none=True)
119-
120- parent_id = fields.Int(allow_none=True)
121- parent_type = fields.Str(allow_none=True)
113+ description = fields.Str(allow_none=True, required=False )
114+ body = fields.Str(required=False )
115+ author_id = fields.Int(required=False )
116+ state = fields.Str(allow_none=True, required=False )
117+ created_at = fields.Int(allow_none=True, required=False )
118+ updated_at = fields.Int(allow_none=True, required=False )
119+ url = fields.Str(allow_none=True, required=False )
120+ default_locale = fields.Str(allow_none=True, required=False )
121+ translated_content = fields.Raw(allow_none=True, required=False )
122+ statistics = fields.Nested(ArticleStatisticsSchema, allow_none=True, required=False )
123+
124+ parent_id = fields.Int(allow_none=True, required=False )
125+ parent_type = fields.Str(allow_none=True, required=False )
122126
123127 @marshmallow.post_load
124128 def make_article(self, data, **kwargs):
125129 return a_models.Article(**data)
126130
127131
132+ class ArticleTranslationSchema(SchemaBase):
133+ """
134+ This schema represents the translation of an Article on Intercom.
135+ """
136+ type = fields.Str(default="article_translated_content")
137+
138+ def __init__(self, **kwargs):
139+ super().__init__(**kwargs)
140+ for language in ArticleLanguages:
141+ locale_code = language.value
142+ self.fields[locale_code] = fields.Str(allow_none=True, required=False)
143+
144+ @marshmallow.post_load
145+ def make_article_translation(self, data, **kwargs):
146+ return a_models.ArticleTranslation(**data)
147+
148+
149+
128150class ArticlePagesSchema(SchemaBase):
129151 """ Paging information for a list of Articles on Intercom. """
130152 type = fields.Str(default='pages')
131153 page = fields.Int()
132- next = fields.Url(allow_none=True)
154+ next = fields.Url(allow_none=True, required=False )
133155 per_page = fields.Int(default=50)
134156 total_pages = fields.Int()
135157
@@ -249,7 +271,7 @@ <h3>Inherited members</h3>
249271 """ Paging information for a list of Articles on Intercom. """
250272 type = fields.Str(default='pages')
251273 page = fields.Int()
252- next = fields.Url(allow_none=True)
274+ next = fields.Url(allow_none=True, required=False )
253275 per_page = fields.Int(default=50)
254276 total_pages = fields.Int()</ code > </ pre >
255277</ details >
@@ -344,23 +366,23 @@ <h2 id="attributes">Attributes</h2>
344366 default_locale (str): The default locale of the Article.
345367 statistics (dict): The statistics of the Article.
346368 """
347- id = fields.Int(required=True )
348- type = fields.Str(allow_none=True)
349- workspace_id = fields.Str(allow_none=True)
369+ id = fields.Int(required=False )
370+ type = fields.Str(allow_none=True, required=False )
371+ workspace_id = fields.Str(allow_none=True, required=False )
350372 title = fields.Str(required=True)
351- description = fields.Str(allow_none=True)
352- body = fields.Str(required=True )
353- author_id = fields.Int(required=True )
354- state = fields.Str(allow_none=True)
355- created_at = fields.Int(allow_none=True)
356- updated_at = fields.Int(allow_none=True)
357- url = fields.Str(allow_none=True)
358- default_locale = fields.Str(allow_none=True)
359- translated_content = fields.Dict(values=fields.Str(), default='', allow_none=True )
360- statistics = fields.Nested(ArticleStatisticsSchema, allow_none=True)
361-
362- parent_id = fields.Int(allow_none=True)
363- parent_type = fields.Str(allow_none=True)
373+ description = fields.Str(allow_none=True, required=False )
374+ body = fields.Str(required=False )
375+ author_id = fields.Int(required=False )
376+ state = fields.Str(allow_none=True, required=False )
377+ created_at = fields.Int(allow_none=True, required=False )
378+ updated_at = fields.Int(allow_none=True, required=False )
379+ url = fields.Str(allow_none=True, required=False )
380+ default_locale = fields.Str(allow_none=True, required=False )
381+ translated_content = fields.Raw(allow_none=True, required=False )
382+ statistics = fields.Nested(ArticleStatisticsSchema, allow_none=True, required=False )
383+
384+ parent_id = fields.Int(allow_none=True, required=False )
385+ parent_type = fields.Str(allow_none=True, required=False )
364386
365387 @marshmallow.post_load
366388 def make_article(self, data, **kwargs):
@@ -473,6 +495,72 @@ <h3>Inherited members</h3>
473495</ li >
474496</ ul >
475497</ dd >
498+ < dt id ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema "> < code class ="flex name class ">
499+ < span > class < span class ="ident "> ArticleTranslationSchema</ span > </ span >
500+ < span > (</ span > < span > **kwargs)</ span >
501+ </ code > </ dt >
502+ < dd >
503+ < div class ="desc "> < p > This schema represents the translation of an Article on Intercom.</ p > </ div >
504+ < details class ="source ">
505+ < summary >
506+ < span > Expand source code</ span >
507+ </ summary >
508+ < pre > < code class ="python "> class ArticleTranslationSchema(SchemaBase):
509+ """
510+ This schema represents the translation of an Article on Intercom.
511+ """
512+ type = fields.Str(default="article_translated_content")
513+
514+ def __init__(self, **kwargs):
515+ super().__init__(**kwargs)
516+ for language in ArticleLanguages:
517+ locale_code = language.value
518+ self.fields[locale_code] = fields.Str(allow_none=True, required=False)
519+
520+ @marshmallow.post_load
521+ def make_article_translation(self, data, **kwargs):
522+ return a_models.ArticleTranslation(**data)</ code > </ pre >
523+ </ details >
524+ < h3 > Ancestors</ h3 >
525+ < ul class ="hlist ">
526+ < li > < a title ="intercom_python_sdk.core.schema_base.SchemaBase " href ="../../core/schema_base.html#intercom_python_sdk.core.schema_base.SchemaBase "> SchemaBase</ a > </ li >
527+ < li > marshmallow.schema.Schema</ li >
528+ < li > marshmallow.base.SchemaABC</ li >
529+ < li > abc.ABC</ li >
530+ </ ul >
531+ < h3 > Class variables</ h3 >
532+ < dl >
533+ < dt id ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.opts "> < code class ="name "> var < span class ="ident "> opts</ span > </ code > </ dt >
534+ < dd >
535+ < div class ="desc "> </ div >
536+ </ dd >
537+ </ dl >
538+ < h3 > Methods</ h3 >
539+ < dl >
540+ < dt id ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.make_article_translation "> < code class ="name flex ">
541+ < span > def < span class ="ident "> make_article_translation</ span > </ span > (< span > self, data, **kwargs)</ span >
542+ </ code > </ dt >
543+ < dd >
544+ < div class ="desc "> </ div >
545+ < details class ="source ">
546+ < summary >
547+ < span > Expand source code</ span >
548+ </ summary >
549+ < pre > < code class ="python "> @marshmallow.post_load
550+ def make_article_translation(self, data, **kwargs):
551+ return a_models.ArticleTranslation(**data)</ code > </ pre >
552+ </ details >
553+ </ dd >
554+ </ dl >
555+ < h3 > Inherited members</ h3 >
556+ < ul class ="hlist ">
557+ < li > < code > < b > < a title ="intercom_python_sdk.core.schema_base.SchemaBase " href ="../../core/schema_base.html#intercom_python_sdk.core.schema_base.SchemaBase "> SchemaBase</ a > </ b > </ code > :
558+ < ul class ="hlist ">
559+ < li > < code > < a title ="intercom_python_sdk.core.schema_base.SchemaBase.Meta " href ="../../core/schema_base.html#intercom_python_sdk.core.schema_base.SchemaBase.Meta "> Meta</ a > </ code > </ li >
560+ </ ul >
561+ </ li >
562+ </ ul >
563+ </ dd >
476564</ dl >
477565</ section >
478566</ article >
@@ -517,6 +605,13 @@ <h4><code><a title="intercom_python_sdk.apis.articles.schemas.ArticleStatisticsS
517605< li > < code > < a title ="intercom_python_sdk.apis.articles.schemas.ArticleStatisticsSchema.opts " href ="#intercom_python_sdk.apis.articles.schemas.ArticleStatisticsSchema.opts "> opts</ a > </ code > </ li >
518606</ ul >
519607</ li >
608+ < li >
609+ < h4 > < code > < a title ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema " href ="#intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema "> ArticleTranslationSchema</ a > </ code > </ h4 >
610+ < ul class ="">
611+ < li > < code > < a title ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.make_article_translation " href ="#intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.make_article_translation "> make_article_translation</ a > </ code > </ li >
612+ < li > < code > < a title ="intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.opts " href ="#intercom_python_sdk.apis.articles.schemas.ArticleTranslationSchema.opts "> opts</ a > </ code > </ li >
613+ </ ul >
614+ </ li >
520615</ ul >
521616</ li >
522617</ ul >
0 commit comments