takttusur / takt-media

Check our news and participate to competitions and other events
MIT License
0 stars 0 forks source link

Implement News importer for VK #6

Closed andreygolubkow closed 8 months ago

andreygolubkow commented 10 months ago

Importing news from VK.com

Acceptance criteria

  1. Implement VkApiClient using https://dev.vk.com/ru/method/wall.get
    1. API client provides methods for
      1. Get information about VK Group
      2. Get posts from wall of any VK Group
    2. API Client uses API key
      1. API key should be provided using options pattern
      2. For saving API key dotnet secrets should be used
  2. Implement VkNewsImporter
    1. Importer uses options, which contains
      1. ID of VK group to import news
    2. Import method returns wall posts with fields:
      1. Date time of creation
      2. Copyright notes
      3. Post type
      4. Attachments
      5. Text
      6. URL link to this post at vk.com
  3. Unit tests should be written

Technical details

see https://restsharp.dev/intro.html#introduction

classDiagram

class IVkApiClient{
    <<interface>>
    +GetGroupInfoAsync(groupId, cancellationToken) Task~VkGroupInfo~
    +GetPostsAsync(request, cancellationToken) Task~VkPost[]~
}
class VkApiClient
IVkApiClient <|.. VkApiClient

class INewsImporter{
    <<interface>>
    +ImportAsync(skip: integer, take: integer, cancellationToken): Task~ImportBundle~Article~~
}
class ImportBundle~T~{
    <<template>>
    +PublisherInformation: ExternalPublisher
    +ImportData: T[]
}
class Article
class IVkNewsImporter{
    <<interface>>
}
class VkNewsImporter
INewsImporter <|.. IVkNewsImporter
IVkNewsImporter <|.. VkNewsImporter
VkNewsImporter ..> IVkApiClient
INewsImporter ..> ImportBundle
INewsImporter ..> Article