Skip to content

Commit

Permalink
Merge pull request #79 from fa0311/dev
Browse files Browse the repository at this point in the history
add CommunityJoinActionUnavailable model
  • Loading branch information
fa0311 authored Nov 14, 2024
2 parents 408fd99 + cf7429f commit d64bf3e
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 13 deletions.
36 changes: 30 additions & 6 deletions dist/compatible/openapi-3.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ components:
enum:
- Member
- Moderator
- Admin
type: string
user_results:
$ref: '#/components/schemas/UserResults'
Expand Down Expand Up @@ -211,14 +212,11 @@ components:
visualStyle:
enum:
- Default
- Tentative
type: string
required:
- destinationUrl
- footer
- note
- subtitle
- title
- shorttitle
- iconType
BirdwatchPivotCallToAction:
properties:
Expand Down Expand Up @@ -316,7 +314,7 @@ components:
delete_action_result:
$ref: '#/components/schemas/CommunityDeleteActionResult'
join_action_result:
$ref: '#/components/schemas/CommunityJoinActionResult'
$ref: '#/components/schemas/CommunityJoinActionUnion'
leave_action_result:
$ref: '#/components/schemas/CommunityLeaveActionResult'
pin_action_result:
Expand Down Expand Up @@ -349,6 +347,7 @@ components:
invites_policy:
enum:
- MemberInvitesAllowed
- ModeratorInvitesAllowed
type: string
invites_result:
$ref: '#/components/schemas/CommunityInvitesResult'
Expand All @@ -357,6 +356,7 @@ components:
join_policy:
enum:
- Open
- RestrictedJoinRequestsRequireModeratorApproval
type: string
join_requests_result:
$ref: '#/components/schemas/CommunityJoinRequestsResult'
Expand Down Expand Up @@ -444,6 +444,29 @@ components:
$ref: '#/components/schemas/TypeName'
required:
- __typename
CommunityJoinActionUnavailable:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
message:
type: string
reason:
enum:
- ViewerRequestRequired
type: string
required:
- __typename
- reason
- message
CommunityJoinActionUnion:
discriminator:
mapping:
CommunityJoinAction: '#/components/schemas/CommunityJoinActionResult'
CommunityJoinActionUnavailable: '#/components/schemas/CommunityJoinActionUnavailable'
propertyName: __typename
oneOf:
- $ref: '#/components/schemas/CommunityJoinActionResult'
- $ref: '#/components/schemas/CommunityJoinActionUnavailable'
CommunityJoinRequestsResult:
properties:
__typename:
Expand Down Expand Up @@ -2398,6 +2421,7 @@ components:
- stale_tweet
- community_tweet_non_member_public_community
- community_tweet_non_member_closed_community
- blocked_viewer
type: string
place:
additionalProperties: true
Expand Down Expand Up @@ -2575,6 +2599,7 @@ components:
- Community
- CommunityDeleteActionUnavailable
- CommunityJoinAction
- CommunityJoinActionUnavailable
- CommunityLeaveActionUnavailable
- CommunityTweetPinActionUnavailable
- CommunityTweetUnpinActionUnavailable
Expand Down Expand Up @@ -3112,7 +3137,6 @@ components:
required:
- description
- verified_since_msec
- override_verified_year
UserVerificationInfoReasonDescription:
properties:
entities:
Expand Down
36 changes: 30 additions & 6 deletions dist/docs/openapi-3.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ components:
enum:
- Member
- Moderator
- Admin
type: string
user_results:
$ref: '#/components/schemas/UserResults'
Expand Down Expand Up @@ -211,14 +212,11 @@ components:
visualStyle:
enum:
- Default
- Tentative
type: string
required:
- destinationUrl
- footer
- note
- subtitle
- title
- shorttitle
- iconType
BirdwatchPivotCallToAction:
properties:
Expand Down Expand Up @@ -316,7 +314,7 @@ components:
delete_action_result:
$ref: '#/components/schemas/CommunityDeleteActionResult'
join_action_result:
$ref: '#/components/schemas/CommunityJoinActionResult'
$ref: '#/components/schemas/CommunityJoinActionUnion'
leave_action_result:
$ref: '#/components/schemas/CommunityLeaveActionResult'
pin_action_result:
Expand Down Expand Up @@ -349,6 +347,7 @@ components:
invites_policy:
enum:
- MemberInvitesAllowed
- ModeratorInvitesAllowed
type: string
invites_result:
$ref: '#/components/schemas/CommunityInvitesResult'
Expand All @@ -357,6 +356,7 @@ components:
join_policy:
enum:
- Open
- RestrictedJoinRequestsRequireModeratorApproval
type: string
join_requests_result:
$ref: '#/components/schemas/CommunityJoinRequestsResult'
Expand Down Expand Up @@ -444,6 +444,29 @@ components:
$ref: '#/components/schemas/TypeName'
required:
- __typename
CommunityJoinActionUnavailable:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
message:
type: string
reason:
enum:
- ViewerRequestRequired
type: string
required:
- __typename
- reason
- message
CommunityJoinActionUnion:
discriminator:
mapping:
CommunityJoinAction: '#/components/schemas/CommunityJoinActionResult'
CommunityJoinActionUnavailable: '#/components/schemas/CommunityJoinActionUnavailable'
propertyName: __typename
oneOf:
- $ref: '#/components/schemas/CommunityJoinActionResult'
- $ref: '#/components/schemas/CommunityJoinActionUnavailable'
CommunityJoinRequestsResult:
properties:
__typename:
Expand Down Expand Up @@ -2398,6 +2421,7 @@ components:
- stale_tweet
- community_tweet_non_member_public_community
- community_tweet_non_member_closed_community
- blocked_viewer
type: string
place:
additionalProperties: true
Expand Down Expand Up @@ -2575,6 +2599,7 @@ components:
- Community
- CommunityDeleteActionUnavailable
- CommunityJoinAction
- CommunityJoinActionUnavailable
- CommunityLeaveActionUnavailable
- CommunityTweetPinActionUnavailable
- CommunityTweetUnpinActionUnavailable
Expand Down Expand Up @@ -3112,7 +3137,6 @@ components:
required:
- description
- verified_since_msec
- override_verified_year
UserVerificationInfoReasonDescription:
properties:
entities:
Expand Down
26 changes: 25 additions & 1 deletion src/openapi/schemas/tweet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ components:
delete_action_result:
$ref: "#/components/schemas/CommunityDeleteActionResult"
join_action_result:
$ref: "#/components/schemas/CommunityJoinActionResult"
$ref: "#/components/schemas/CommunityJoinActionUnion"
leave_action_result:
$ref: "#/components/schemas/CommunityLeaveActionResult"
pin_action_result:
Expand All @@ -562,13 +562,37 @@ components:
type: string
enum: [Unavailable]

CommunityJoinActionUnion:
oneOf:
- $ref: "#/components/schemas/CommunityJoinActionResult"
- $ref: "#/components/schemas/CommunityJoinActionUnavailable"
discriminator:
propertyName: __typename
mapping: # deprecated
CommunityJoinAction: "#/components/schemas/CommunityJoinActionResult"
CommunityJoinActionUnavailable: "#/components/schemas/CommunityJoinActionUnavailable"

CommunityJoinActionResult:
required:
- "__typename"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # CommunityJoinAction

CommunityJoinActionUnavailable:
required:
- "__typename"
- "reason"
- "message"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # CommunityJoinActionUnavailable
reason:
type: string
enum: [ViewerRequestRequired]
message:
type: string

CommunityLeaveActionResult:
required:
- "__typename"
Expand Down
1 change: 1 addition & 0 deletions test/python/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def error_dump(e):
"1349129669258448897",
"1810188416812019999",
"1851981523207299417",
"1853879226987901408",
]
for id in ids:
try:
Expand Down

0 comments on commit d64bf3e

Please sign in to comment.