Giter Club home page Giter Club logo

Comments (5)

fa0311 avatar fa0311 commented on June 2, 2024

Can you write according to the OpenAPI specification?

I will modify it to placeholder.json.

from twitter-openapi.

huafsud avatar huafsud commented on June 2, 2024

I have used the format of twitter-openapi,
but I'm not sure if it's working correctly.

but, the response body has mostly the same fields. so INIT and FINALIZE can use the same of MediaUploadResponse

--------INIT ------------

[POST] https://upload.twitter.com/i/media/upload.json?command=INIT&total_bytes=1856821&media_type=video/mp4&video_duration_ms=11562.086000000001&media_category=tweet_video

[response body] {"media_id":1677217907460407298,"media_id_string":"1677217907460407298","expires_after_secs":86399,"media_key":"7_1677217907460407298"}

--------APPEND-----------

[POST] https://upload.twitter.com/i/media/upload.json?command=APPEND&media_id=1677217907460407298&segment_index=0
[response body]

-------FINALIZE----------

https://upload.twitter.com/i/media/upload.json?command=FINALIZE&media_id=1677217907460407298&allow_async=true

[response body] {"media_id":1677217907460407298,"media_id_string":"1677217907460407298","media_key":"7_1677217907460407298","size":1856821,"expires_after_secs":86400,"processing_info":{"state":"pending","check_after_secs":1}}

openapi: 3.0.3
info:
  title: Twitter OpenAPI
  version: 0.0.1

paths:
  /i/media/upload.json:
    post:
      operationId: postMediaUpload
      description: post media upload
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaUploadResponse"
      tags:
        - "v-media-post"

#  {"media_id":1677217907460407298,"media_id_string":"1677217907460407298",
#"expires_after_secs":86399,"media_key":"7_1677217907460407298"}

#  {"media_id":1677217907460407298,"media_id_string":"1677217907460407298",
#"media_key":"7_1677217907460407298","size":1856821,
#"expires_after_secs":86400,
#"processing_info":{"state":"pending","check_after_secs":1}}
components:
  schemas:
    MediaUploadResponse:
      required:
        - "media_id"
        - "media_id_string"
        - "media_key"
        - "expires_after_secs"
      properties:
        media_id:
          type: "integer"
        media_id_string:
          type: "string"
        media_key:
          type: "string"
        expires_after_secs:
          type: "integer"
        processing_info:
          $ref: "#/components/schemas/MediaUploadResponseProcessingInfo"



    MediaUploadResponseProcessingInfo:
      properties:
        state:
          type: "string"
        check_after_secs:
          type: "integer"

or download this yaml file

v-media-post.yaml.txt

from twitter-openapi.

huafsud avatar huafsud commented on June 2, 2024

hi fa0311:

I don't know how to write the URL request JSON format rules in placeholder.json. It's a complicated.

from twitter-openapi.

fa0311 avatar fa0311 commented on June 2, 2024

It's a complicated.

You're right about that.

It seems that this request cannot be written according to the current rules for placeholder.json, so it would be better to write it according to openapi.
If you send us a pull request, we will merge them.

from twitter-openapi.

huafsud avatar huafsud commented on June 2, 2024

ok

from twitter-openapi.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.